GatherResourceUsageTask#

class lsst.analysis.tools.tasks.GatherResourceUsageTask(*, config: PipelineTaskConfig | None = None, log: logging.Logger | LsstLogAdapter | None = None, initInputs: dict[str, Any] | None = None, **kwargs: Any)#

Bases: PipelineTask

A PipelineTask that gathers resource usage statistics from task metadata.

Notes#

This is an unusual PipelineTask in that its input connection has dynamic dimensions.

Its output table has columns for each of the dimensions of the input metadata’s data ID, as well as (subject to configuration):

  • memory: the maximum resident set size for the entire quantum (in bytes);

  • prep_time: the time spent in the pre-initialization step in which the middleware checks which of the quantum’s inputs are available;

  • init_time: the time spent in task construction;

  • run_time: the time spent executing the task’s runQuantum method.

  • wall_time : elapsed time in the pre-initialization step, in task construction, and in executing the task’s runQuantum method. Specifically, this is the difference between prepUtc, which triggers as soon as single quantum execution has begun (but can include some checks and running updatedQuantumInputs), and endUtc, which triggers immediately after runQuantum.

  • {method}: the time spent in a particular task or subtask method decorated with lsst.utils.timer.timeMethod.

All time durations are CPU times in seconds, and all columns are 64-bit floating point. Methods or steps that did not run are given a duration of zero.

It is expected that this task will be configured to run multiple times in most pipelines, often once for each other task in the pipeline.

Methods Summary

run(universe, input_metadata)

Gather resource usage statistics from per-quantum metadata.

runQuantum(butlerQC, inputRefs, outputRefs)

Do butler IO and transform to provide in memory objects for tasks run method.

Methods Documentation

run(universe, input_metadata)#

Gather resource usage statistics from per-quantum metadata.

Parameters#

universeDimensionUniverse

Object managing all dimensions recognized by the butler; used to standardize and expand GatherResourceUsageConfig.dimensions.

input_metadatalist [ DeferredDatasetHandle ]

List of lsst.daf.butler.DeferredDatasetHandle that can be used to load all input metadata datasets.

Returns#

resultStruct

Structure with a single element:

  • outout_table: a pandas.DataFrame that aggregates the configured resource usage statistics.

runQuantum(butlerQC, inputRefs, outputRefs)#

Do butler IO and transform to provide in memory objects for tasks run method.

Parameters#

butlerQCQuantumContext

A butler which is specialized to operate in the context of a lsst.daf.butler.Quantum.

inputRefsInputQuantizedConnection

Datastructure whose attribute names are the names that identify connections defined in corresponding PipelineTaskConnections class. The values of these attributes are the lsst.daf.butler.DatasetRef objects associated with the defined input/prerequisite connections.

outputRefsOutputQuantizedConnection

Datastructure whose attribute names are the names that identify connections defined in corresponding PipelineTaskConnections class. The values of these attributes are the lsst.daf.butler.DatasetRef objects associated with the defined output connections.