[Bug] `workflow.wait` broken with `asyncio.FIRST_COMPLETED` and local activities
还没有人认领这个 Issue。
评估
调研方向
从链接的最小复现以及 Python SDK 对本地 activity 的 workflow.wait 处理入手,并将其与非本地 activity 进行比较。使用报告中的命令和时间戳复现 FIRST_COMPLETED 情况,然后验证第一个本地 activity 完成时等待会返回,并且可以取消其余 activity。
由索引模型根据 Issue 内容生成。
描述
What are you really trying to do?
Start N local activities, wait for the first one to finish, cancel the others.
Describe the bug
If I start N local activities, then use workflow.wait(tasks, return_when=asyncio.FIRST_COMPLETED), the workflow.wait coro blocks until all of the activities actually finish, instead of returning when the first one finishes. If I use non-local activities, this bug does not happen.
Minimal Reproduction
https://github.com/andmis/snippets/tree/temporal-python-sdk-local-activity-workflow-wait-bug
# Worker output after `python run_workflow.py`
2024-12-09 19:02:30.750775+00:00 (Workflow) Starting, local=False
2024-12-09 19:02:30.750775+00:00 (Workflow) Waiting for first completed activity
2024-12-09 11:02:30.760073 (Activity 0) Running sandbox_activity
2024-12-09 11:02:30.760565 (Activity 1) Running sandbox_activity
2024-12-09 11:02:32.875597 (Activity 1) Exiting sandbox_activity
2024-12-09 19:02:32.891753+00:00 (Workflow) Got first completed activity, cancelling others and exiting
2024-12-09 19:02:32.891753+00:00 (Workflow) Exiting
2024-12-09 11:02:35.328912 (Activity 0) Cancelling sandbox_activity
# Worker output after `python run_workflow.py -l`
2024-12-09 19:03:48.421271+00:00 (Workflow) Starting, local=True
2024-12-09 19:03:48.421271+00:00 (Workflow) Waiting for first completed activity
2024-12-09 11:03:48.425911 (Activity 0) Running sandbox_activity
2024-12-09 11:03:48.426165 (Activity 1) Running sandbox_activity
2024-12-09 11:03:49.817020 (Activity 1) Exiting sandbox_activity
2024-12-09 11:03:56.397142 (Activity 0) Exiting sandbox_activity
2024-12-09 19:03:56.394210+00:00 (Workflow) Got first completed activity, cancelling others and exiting
2024-12-09 19:03:56.394210+00:00 (Workflow) Exiting
# Note the timestamps
Environment/Versions
- OS and processor: macOS, M1
- Temporal version: 1.1.2
- Python SDK version: 1.8.0
- Are you using Docker or Kubernetes or building Temporal from source? No
Additional context
- 主要语言
- Python
- 星标
- 1.2k
- 派生
- 241
- 平均合并
- 3 天 2 小时
- 30 天内合并 PR
- 49
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
temporalio/sdk-python 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 74/100
temporalio/sdk-python#1517 · 10 条评论 ·
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
temporalio/sdk-python#496 ·
-
难度 5/5 一周以上 新手友好度 25/100
temporalio/sdk-python#1890 ·
-
难度 4/5 3-5 天 新手友好度 52/100
temporalio/sdk-python#1881 · 1 条评论 ·
-
bug
temporalio/sdk-python#1817 · 1 条评论 · 已指派 1 人 ·
查看 temporalio/sdk-python 的全部 Issue
相似的 Issue
-
bug ci good first issue
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 76/100
-
documentation
难度 2/5 半天 新手友好度 62/100
inmanta/inmanta-core#10835 ·
-
难度 1/5 1 小时以内 新手友好度 92/100
-
sponsored
难度 2/5 1-3 小时 新手友好度 65/100