temporalio / temporalio/samples-python
[Bug] RestrictedWorkflowAccessError on async context manager in return close of an activity.
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 367
- Forks
- 121
- Merge medio
- 3 d 20 h
- PR fusionados (30 d)
- 11
Descripción
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
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Reproduce el ejemplo mínimo de actividad del issue con temporal==1.10.0 y httpx.AsyncClient; después, investiga si las restricciones del sandbox del workflow se reactivan durante aexit del gestor de contexto asíncrono. Se considera terminado cuando la actividad puede devolver la respuesta HTTP sin generar RestrictedWorkflowAccessError.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- backend
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100