roastcoffea.backends.dask

Dask backend for metrics collection.

Implements metrics collection for Dask executors, including: - Worker resource tracking via scheduler sampling - Fine-grained metrics via Dask Spans

Classes

DaskMetricsBackend(client)

Dask-specific metrics collection backend.

class roastcoffea.backends.dask.DaskMetricsBackend(client)[source]

Bases: AbstractMetricsBackend

Dask-specific metrics collection backend.

Parameters:

client (Any)

start_tracking(interval=1.0)[source]

Start tracking worker resources.

Parameters:

interval (float) – Sampling interval in seconds

Return type:

None

stop_tracking()[source]

Stop tracking and return collected data.

Returns:

Tracking data with worker_counts, worker_memory, etc.

Return type:

dict

create_span(name)[source]

Create a performance span for fine metrics collection.

Parameters:

name (str) – Name of the span

Returns:

span_info – Dictionary with ‘context’ (context manager) and ‘name’ (span name)

Return type:

dict

get_span_metrics(span_info, delay=0.5)[source]

Extract metrics from a span from scheduler.

Span metrics sync from workers to scheduler after a delay (default: 0.5s interval).

Parameters:
  • span_info (dict) – Span info dict from create_span containing ‘id’ and ‘name’

  • delay (float, default 0.5) – Delay in seconds before extracting span metrics

Returns:

cumulative_worker_metrics from span, or empty dict if span_id not available

Return type:

dict

supports_fine_metrics()[source]

Check if this backend supports fine-grained metrics.

Returns:

True for Dask (supports Spans)

Return type:

bool