spdl.pipeline.TaskStatsHook

class TaskStatsHook(name: str, interval: float = -1)[source]

Track the task runtimes and success rate.

See also

Parameters:
  • name – Name of the stage. Only used for logging.

  • interval – The interval (in second) to report the performance stats periodically. The default behavior is no periodic reporting.

Methods

interval_stats_callback(stats)

Callback for processing interval performance statistics.

stage_hook()

Track the stage runtime and log the task stats.

task_hook()

Track task runtime and success rate.

async interval_stats_callback(stats: TaskPerfStats) None[source]

Callback for processing interval performance statistics.

When interval reporting is enabled, this method is periodically called with the delta metrics.

The default behavior is to log the metrics to console.

You can override this method and modify the destination of the log.

stage_hook() AsyncIterator[None][source]

Track the stage runtime and log the task stats.

task_hook() AsyncIterator[None][source]

Track task runtime and success rate.