JointcalRunner¶
- class lsst.jointcal.JointcalRunner(TaskClass, parsedCmd, doReturnResults=False)¶
Bases:
ButlerInitializedTaskRunner
Subclass of TaskRunner for jointcalTask (gen2)
jointcalTask.runDataRef() takes a number of arguments, one of which is a list of dataRefs extracted from the command line (whereas most CmdLineTasks’ runDataRef methods take single dataRef, are are called repeatedly). This class transforms the processed arguments generated by the ArgumentParser into the arguments expected by Jointcal.runDataRef().
See pipeBase.TaskRunner for more information.
Attributes Summary
Default timeout (seconds) for multiprocessing.
Methods Summary
__call__
(args)- Parameters:
getTargetList
(parsedCmd, **kwargs)Return a list of tuples per tract, each containing (dataRefs, kwargs).
makeTask
([parsedCmd, args])A variant of the base version that passes a butler argument to the task's constructor.
precall
(parsedCmd)Hook for code that should run exactly once, before multiprocessing.
Prepare this instance for multiprocessing
run
(parsedCmd)Run the task on all targets.
runTask
(task, dataRef, kwargs)Make the actual call to
runDataRef
for this task.Attributes Documentation
- TIMEOUT = 2592000¶
Default timeout (seconds) for multiprocessing.
Methods Documentation
- __call__(args)¶
- Parameters:
- args
Arguments for Task.runDataRef()
- Returns:
- pipe.base.Struct
if self.doReturnResults is False:
exitStatus
: 0 if the task completed successfully, 1 otherwise.
if self.doReturnResults is True:
result
: the result of calling jointcal.runDataRef()exitStatus
: 0 if the task completed successfully, 1 otherwise.
- static getTargetList(parsedCmd, **kwargs)¶
Return a list of tuples per tract, each containing (dataRefs, kwargs).
Jointcal operates on lists of dataRefs simultaneously.
- makeTask(parsedCmd=None, args=None)¶
A variant of the base version that passes a butler argument to the task’s constructor.
- Parameters:
- parsedCmd
argparse.Namespace
Parsed command-line options, as returned by the
ArgumentParser
; if specified then args is ignored.- args
Other arguments; if
parsedCmd
isNone
then this must be specified.
- parsedCmd
- Raises:
- RuntimeError
Raised if
parsedCmd
andargs
are bothNone
.
- precall(parsedCmd)¶
Hook for code that should run exactly once, before multiprocessing.
Notes
Must return True if
TaskRunner.__call__
should subsequently be called.Warning
Implementations must take care to ensure that no unpicklable attributes are added to the TaskRunner itself, for compatibility with multiprocessing.
The default implementation writes package versions, schemas and configs, or compares them to existing files on disk if present.
- prepareForMultiProcessing()¶
Prepare this instance for multiprocessing
Optional non-picklable elements are removed.
This is only called if the task is run under multiprocessing.
- run(parsedCmd)¶
Run the task on all targets.
- Parameters:
- parsedCmd
argparse.Namespace
Parsed command
argparse.Namespace
.
- parsedCmd
- Returns:
Notes
The task is run under multiprocessing if
TaskRunner.numProcesses
is more than 1; otherwise processing is serial.
- runTask(task, dataRef, kwargs)¶
Make the actual call to
runDataRef
for this task.- Parameters:
- task
lsst.pipe.base.CmdLineTask
class The class of the task to run.
- dataRef
Butler data reference that contains the data the task will process.
- kwargs
Any additional keyword arguments. See
TaskRunner.getTargetList
above.
- task
Notes
The default implementation of
TaskRunner.runTask
works for any command-line task which has arunDataRef
method that takes a data reference and an optional set of additional keyword arguments. This method returns the results generated by the task’srunDataRef
method.