[Bug] RestrictedWorkflowAccessError on async context manager in return close of an activity.
まだ誰も着手していません。
評価
調査の方向性
temporal==1.10.0 と httpx.AsyncClient を使用して issue の最小アクティビティ例を再現し、その後、非同期コンテキストマネージャーの aexit 中に workflow sandbox の制限が再有効化されるかどうかを調査します。アクティビティが RestrictedWorkflowAccessError を発生させずに HTTP レスポンスを返せれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Python
- スター
- 367
- フォーク
- 121
- 平均マージ
- 3日 20時間
- マージ済み PR(30日)
- 11
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
temporalio/samples-python のほかの issue
-
enhancement
temporalio/samples-python#254 · コメント 1 件 · 担当者 1 名 ·
-
enhancement
temporalio/samples-python#253 · 担当者 1 名 ·
-
enhancement
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
temporalio/samples-python#231 · コメント 1 件 ·
-
enhancement
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
temporalio/samples-python#191 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 48/100
temporalio/samples-python#184 ·
temporalio/samples-python の issue をすべて見る
似ている issue
-
triage/confirmed
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
NousResearch/hermes-agent#118866 ·
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
apache/cloudstack#14222 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100