Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

spans and annotations lost across copute() boundaries

Aperta
#9,138 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

@rohitsalla ci sta già lavorando.

Dal 4/8/2026.

  • #9340 di @rohitsalla — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python

Direzione di ricerca

Inizia eseguendo l’esempio LocalCluster fornito sia con inner_sync sia con inner_async, confrontando le chiamate dirette con il calcolo differito e optimize_graph=False. Segui i punti di ingresso delayed, compute, annotate/get_annotations e span per determinare dove vengono perse le annotazioni e perché span 2 conserva span 1. Il lavoro è completato quando sia le attività delayed sincrone sia quelle asincrone conservano le annotazioni e usano lo span del chiamante nell’esecuzione locale e distribuita.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
Python
Stelle
1.7k
Fork
781
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di dask/distributed

Tutte le issue di dask/distributed

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.