collect_task_runtimes#

lsst.analysis.ap.collect_task_runtimes(butler, collections, threshold=1.0, *, plot=False, ax=None)#

Per-task runtime and memory summary for a butler run collection.

Each <task>_metadata dataset under collections is loaded and its timing fields extracted with from_task_metadata. Tasks whose every quantum runs faster than threshold seconds are dropped; tasks with at least one quantum at or above threshold contribute all their quanta to the per-task summary statistics, so the summary reflects cross-quantum variability rather than a single outlier.

Parameters#

butlerlsst.daf.butler.Butler

Butler used to query the registry and load metadata datasets.

collectionsstr or iterable of str

Collections to query, typically a single run collection name.

thresholdfloat, optional

Minimum task duration (seconds) for inclusion. A task is kept iff at least one of its quanta has total_time >= threshold. Default 1.0.

plotbool, optional

If True, render a horizontal box plot of per-quantum total_time per surviving task (tasks ordered by max total_time descending) and return the (df, fig) pair instead of just df.

axmatplotlib.axes.Axes or None

Axes to plot onto. Only used when plot=True. If None, a new figure and axes are created.

Returns#

dfpandas.DataFrame

One row per task, with columns:

  • task: pipeline task label

  • n_quanta: number of surviving quanta contributing to the row

  • total_time_mean, total_time_min, total_time_max, total_time_std: seconds

  • memory_mean_<UNIT>, memory_min_<UNIT>, memory_max_<UNIT>, memory_std_<UNIT>: where UNIT is GB if any task’s peak memory crosses 1 GB and MB otherwise. The unit is chosen once across the whole table so the columns remain numerically comparable.

figmatplotlib.figure.Figure

Only returned when plot=True.