lsst.pipe.base  13.0-9-g1c7d9c5+5
 All Classes Namespaces Files Functions Variables Pages
Classes | Functions | Variables
lsst.pipe.base.cmdLineTask Namespace Reference

Classes

class  TaskRunner
 
class  ButlerInitializedTaskRunner
 A TaskRunner for CmdLineTasks that require a 'butler' keyword argument to be passed to their constructor. More...
 
class  CmdLineTask
 Base class for command-line tasks: tasks that may be executed from the command line. More...
 

Functions

def profile
 Context manager for profiling with cProfile. More...
 

Variables

list __all__ = ["CmdLineTask", "TaskRunner", "ButlerInitializedTaskRunner"]
 

Function Documentation

def lsst.pipe.base.cmdLineTask.profile (   filename,
  log = None 
)

Context manager for profiling with cProfile.

Parameters
filenamefilename to which to write profile (profiling disabled if None or empty)
loglog object for logging the profile operations

If profiling is enabled, the context manager returns the cProfile.Profile object (otherwise it returns None), which allows additional control over profiling. You can obtain this using the "as" clause, e.g.:

with profile(filename) as prof:
    runYourCodeHere()

The output cumulative profile can be printed with a command-line like:

python -c 'import pstats; pstats.Stats("<filename>").sort_stats("cumtime").print_stats(30)'

Definition at line 74 of file cmdLineTask.py.

Variable Documentation

list lsst.pipe.base.cmdLineTask.__all__ = ["CmdLineTask", "TaskRunner", "ButlerInitializedTaskRunner"]

Definition at line 40 of file cmdLineTask.py.