Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

spans and annotations lost across copute() boundaries

オープン
#9,138 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
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 の本文から書いたものです。

説明

bug

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 2 did not overwrite span 1 for 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 はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dask/distributed のほかの issue

dask/distributed の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。