[Bug] `SandboxImportNotificationPolicy.WARN_ON_UNINTENTIONAL_PASSTHROUGH` warns on import of the workflow itself to the sandbox
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Inizia da temporalio/worker/workflow_sandbox/_importer.py, in prossimità dell’avviso alla riga 323, quindi esegui la riproduzione minima del worker riportata nell’issue con WARN_ON_UNINTENTIONAL_PASSTHROUGH abilitato. Traccia il modo in cui il modulo del workflow viene caricato nella sandbox e assicurati che il caricamento del workflow stesso non produca l’avviso di unintentional-passthrough, mantenendo invariato il comportamento di avviso richiesto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What are you really trying to do?
Leverage SandboxImportNotificationPolicy.WARN_ON_UNINTENTIONAL_PASSTHROUGH to identify imports that aren't intentionally passed through to the sandbox.
Describe the bug
Using a sandboxed runner with the workflows defined in a separate from the worker triggers the unintentional passthrough warning. The workflow must be loaded into the sandbox each time and therefore should be exempt from this warning.
Minimal Reproduction
# workflows.py
from datetime import timedelta
from temporalio import workflow
from warning.activities import echo_activity
@workflow.defn
class ExampleWorkflow:
@workflow.run
async def run(self) -> str:
activity_result = await workflow.execute_activity(
echo_activity,
"example",
task_queue="example-task-queue",
start_to_close_timeout=timedelta(seconds=10),
)
return activity_result
# activities.py
from temporalio import activity
@activity.defn
async def echo_activity(input: str) -> str:
return f"hello {input}"
# worker.py
import asyncio
from temporalio.client import Client
from temporalio.envconfig import ClientConfig
from temporalio.worker import Worker
from temporalio.worker.workflow_sandbox import (
SandboxedWorkflowRunner,
SandboxRestrictions,
)
from temporalio.workflow import SandboxImportNotificationPolicy
from warning.activities import echo_activity
from warning.workflows import ExampleWorkflow
async def main():
config = ClientConfig.load_client_connect_config()
config.setdefault("target_host", "localhost:7233")
# Start client
client = await Client.connect(**config)
worker = Worker(
client,
task_queue="example-task-queue",
workflows=[ExampleWorkflow],
activities=[echo_activity],
workflow_runner=SandboxedWorkflowRunner(
restrictions=SandboxRestrictions.default.with_import_notification_policy(
SandboxImportNotificationPolicy.WARN_ON_DYNAMIC_IMPORT
| SandboxImportNotificationPolicy.WARN_ON_UNINTENTIONAL_PASSTHROUGH
)
),
)
await worker.run()
if __name__ == "__main__":
asyncio.run(main())
Starting the above worker yields this log on startup and workflow execution:
uv run warning/worker.py
/.../temporalio/worker/workflow_sandbox/_importer.py:323: UserWarning: Module warning.workflows was not intentionally passed through to the sandbox.
warnings.warn(
/.../temporalio/worker/workflow_sandbox/_importer.py:323: UserWarning: Module warning.activities was not intentionally passed through to the sandbox.
warnings.warn(
Environment/Versions
- Temporal Version: SDK 1.20
Additional context
- Lingua principale
- Python
- Stelle
- 1.2k
- Fork
- 241
- Merge medio
- 3g 2h
- PR unite (30g)
- 49
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di temporalio/sdk-python
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
temporalio/sdk-python#1517 · 10 commenti ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
temporalio/sdk-python#496 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
temporalio/sdk-python#1890 ·
-
[Bug] Local activity resolutions regrouped on replay since 1.32.0, delivering the wrong payload Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
temporalio/sdk-python#1881 · 1 commento ·
-
bug
temporalio/sdk-python#1817 · 1 commento · 1 assegnatario ·
Tutte le issue di temporalio/sdk-python
Issue simili
-
triage/confirmed
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
NousResearch/hermes-agent#118866 ·
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
apache/cloudstack#14222 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100