timeMethod

lsst.pipe.base.timeMethod(func)

Decorator to measure duration of a task method.

Parameters:
func

The method to wrap.

Notes

Writes various measures of time and possibly memory usage to the task’s metadata; all items are prefixed with the function name.

Warning

This decorator only works with instance methods of Task, or any class with these attributes:

  • metadata: an instance of lsst.daf.base.PropertyList (or other object with add(name, value) method).
  • log: an instance of logging.Logger or subclass.

Examples

To use:

import lsst.pipe.base as pipeBase
class FooTask(pipeBase.Task):
    pass

    @pipeBase.timeMethod
    def run(self, ...): # or any other instance method you want to time
        pass