TimingMetricTask

TimingMetricTask creates a wall-clock timing Measurement based on data collected by @timeMethod. It reads the raw timing data from the top-level CmdLineTask’s metadata, which is identified by the task configuration.

Processing summary

TimingMetricTask searches the metadata for @timeMethod-generated keys corresponding to the method of interest. If it finds matching keys, it stores the elapsed time as a Measurement.

Python API summary

from lsst.verify.tasks.commonMetrics import TimingMetricTask
classTimingMetricTask(**kwargs)

A Task that computes a wall-clock time using metadata produced by the `lsst.pipe.base.timeMethod` decorator...

attributeconfig

Access configuration fields and retargetable subtasks.

methodrun(metadata)

Compute a measurement from science task metadata...

See also

See the TimingMetricTask API reference for complete details.

Butler datasets

Input datasets

metadata
The metadata of the top-level command-line task (e.g., ProcessCcdTask, ApPipeTask) being instrumented. Because the metadata produced by each top-level task is a different Butler dataset type, this dataset must be explicitly configured when running TimingMetricTask or a MetricsControllerTask that contains it.

Retargetable subtasks

No subtasks.

Configuration fields

metadata

Data type
lsst.pipe.base.config.InputDatasetConfig
Field type
ConfigField
The target top-level task’s metadata. The name must be set to the metadata’s butler type, such as ‘processCcd_metadata’.

metric

Default
None
Field type
str Field
The fully qualified name of the metric to store the timing information.

target

Default
None
Field type
str Field
The method to time, optionally prefixed by one or more tasks in the format of lsst.pipe.base.Task.getFullMetadata().

Examples

from lsst.verify.tasks import TimingMetricTask

config = TimingMetricTask.ConfigClass()
config.metadata.name = "apPipe_metadata"
config.target = "apPipe:ccdProcessor.runDataRef"
config.metric = "pipe_tasks.ProcessCcdTime"
task = TimingMetricTask(config)

# config.metadata provided for benefit of MetricsControllerTask/Pipeline
# but since we've defined it we might as well use it
metadata = butler.get(config.metadata.name)
processCcdTime = task.run(metadata).measurement