spans and annotations lost across copute() boundaries
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- python
調査の方向性
まず、提供されている LocalCluster の例を inner_sync と inner_async の両方で実行し、直接呼び出しと遅延計算、および optimize_graph=False を比較します。delayed、compute、annotate/get_annotations、span のエントリポイントを追跡して、アノテーションがどこで失われるのか、またなぜ span 2 が span 1 を保持するのかを特定します。同期と非同期の両方の delayed タスクがアノテーションを保持し、ローカル実行と分散実行で呼び出し元の span を使用すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the issue:
Minimal Complete Verifiable Example:
This is broken for both sync and async delayed functions. Calling functions directly (removing delayed decorator) preserves spans and annotations.
This is an issue for both local and distributed cluster.
import asyncio
import time
from dask import annotate, delayed, get_annotations
from dask.distributed import LocalCluster
from distributed import span
cluster = LocalCluster(processes=False)
client = cluster.get_client()
def outer(i: int):
with span(str(i)), annotate(also_i=i):
print("annotations before compute", get_annotations())
# inner_async(i).compute(optimize_graph=False)
inner_sync(i).compute(optimize_graph=False)
@delayed
def inner_sync(i: int):
for _ in range(5):
time.sleep(1)
print("task", i, "annotations:", get_annotations())
@delayed
async def inner_async(i: int):
for _ in range(5):
await asyncio.sleep(1)
print("task", i, "annotations:", get_annotations())
client.submit(outer, 1)
time.sleep(2)
client.submit(outer, 2).result()
Results in:
annotations before compute {'span': {'name': ('1',), 'ids': ('e6f9a463-dbea-42d9-86e9-74348f017677',)}, 'also_i': 1}
task 1 annotations: {'span': {'name': ('1',), 'ids': ('e6f9a463-dbea-42d9-86e9-74348f017677',)}}
annotations before compute {'span': {'name': ('2',), 'ids': ('e975dde3-d903-4643-b7ad-ee26f239be78',)}, 'also_i': 2}
task 1 annotations: {'span': {'name': ('1',), 'ids': ('e6f9a463-dbea-42d9-86e9-74348f017677',)}}
task 2 annotations: {'span': {'name': ('1',), 'ids': ('e6f9a463-dbea-42d9-86e9-74348f017677',)}}
task 1 annotations: {'span': {'name': ('1',), 'ids': ('e6f9a463-dbea-42d9-86e9-74348f017677',)}}
task 2 annotations: {'span': {'name': ('1',), 'ids': ('e6f9a463-dbea-42d9-86e9-74348f017677',)}}
task 1 annotations: {'span': {'name': ('1',), 'ids': ('e6f9a463-dbea-42d9-86e9-74348f017677',)}}
task 2 annotations: {'span': {'name': ('1',), 'ids': ('e6f9a463-dbea-42d9-86e9-74348f017677',)}}
task 1 annotations: {'span': {'name': ('1',), 'ids': ('e6f9a463-dbea-42d9-86e9-74348f017677',)}}
task 2 annotations: {'span': {'name': ('1',), 'ids': ('e6f9a463-dbea-42d9-86e9-74348f017677',)}}
task 2 annotations: {'span': {'name': ('1',), 'ids': ('e6f9a463-dbea-42d9-86e9-74348f017677',)}}
2 things here:
- annotations got lost after entering delayed
- span
2did not overwrite span1for second task
Anything else we need to know?:
There is an issue about lost annotations from 2021: https://github.com/dask/dask/issues/7036
It mentions graph optimization but optimize_graph=False does not help.
Environment:
- Dask version:
2025.11.0 - Python version:
3.12 - Operating System: Linux
- Install method (conda, pip, source): uv
- 主要言語
- Python
- スター
- 1.7k
- フォーク
- 780
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dask/distributed のほかの issue
-
needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
dask/distributed#9366 ·
-
needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
dask/distributed#9353 ·
-
documentation
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
dask/distributed#8304 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
dask/distributed#4816 · コメント 2 件 ·
-
documentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
dask/distributed#2378 · コメント 2 件 ·
dask/distributed の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
letsencrypt/cp-cps#353 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
PedestrianDynamics/pyFDS-Evac#394 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
DOI-USGS/pywatershed#421 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
python-pillow/Pillow#10087 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信