[Bug] RestrictedWorkflowAccessError on async context manager in return close of an activity.
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Riprodurre l'esempio minimo di attività dell'issue con temporal==1.10.0 e httpx.AsyncClient, quindi verificare se le restrizioni della sandbox del workflow vengono riattivate durante aexit del context manager asincrono. Il lavoro è completato quando l'attività può restituire la risposta HTTP senza sollevare RestrictedWorkflowAccessError.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What are you really trying to do?
When using
@register_activity
@activity.defn
async def get_http_response(URL: str) -> dict:
async with httpx.AsyncClient() as client:
return await client.get(url)
Describe the bug
We get the following error:
RestrictedWorkflowAccessError
Cannot access threading.local.mro_entries from inside a workflow. If this is code from a module not used in a workflow or known to only be used deterministically from a workflow, mark the import as pass through.
Minimal Reproduction
I believe the workflow sandbox is reactivated before the asynclient __aexit__ code.
Which leads to Temporal thinking its execution is happening in the workflow scope rather than within the activity one.
Environment/Versions
temporal==1.10.0
Additional context
I'm trying to split it in two calls to make it work:
@register_activity
@activity.defn
async def get_http_response(URL: str) -> dict:
async with httpx.AsyncClient() as client:
response = await client.get(url)
return response
- Lingua principale
- Python
- Stelle
- 367
- Fork
- 121
- Merge medio
- 3g 20h
- PR unite (30g)
- 11
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
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/samples-python
-
enhancement
temporalio/samples-python#254 · 1 commento · 1 assegnatario ·
-
enhancement
temporalio/samples-python#253 · 1 assegnatario ·
-
enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
temporalio/samples-python#231 · 1 commento ·
-
enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
temporalio/samples-python#191 ·
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 48/100
temporalio/samples-python#184 ·
Tutte le issue di temporalio/samples-python
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
learningequality/ricecooker#747 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
run-llama/llama_index#23199 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
KhronosGroup/glTF-Blender-IO#2769 ·