MatchedVisitMetricsRunner¶
-
class
lsst.validate.drp.matchedVisitMetricsTask.MatchedVisitMetricsRunner(TaskClass, parsedCmd, doReturnResults=False)¶ Bases:
lsst.pipe.base.TaskRunnerSubclass of TaskRunner for MatchedVisitMetrics
This class transforms the processed arguments generated by the ArgumentParser into the arguments expected by MatchedVisitMetricsTask.run().
Methods Summary
__call__(args)Run the Task on a single target. getTargetList(parsedCmd, **kwargs)Get a list of (dataRef, kwargs) for TaskRunner.__call__.Methods Documentation
-
__call__(args)¶ Run the Task on a single target.
Parameters: - args
Arguments for Task.runDataRef()
Returns: - struct :
lsst.pipe.base.Struct Contains these fields if
doReturnResultsisTrue:dataRef: the provided data reference.metadata: task metadata after execution of run.result: result returned by task run, orNoneif the task fails.exitStatus: 0 if the task completed successfully, 1 otherwise.
If
doReturnResultsisFalsethe struct contains:exitStatus: 0 if the task completed successfully, 1 otherwise.
Notes
This default implementation assumes that the
argsis a tuple containing a data reference and a dict of keyword arguments.Warning
If you override this method and wish to return something when
doReturnResultsisFalse, then it must be picklable to support multiprocessing and it should be small enough that pickling and unpickling do not add excessive overhead.
-
static
getTargetList(parsedCmd, **kwargs)¶ Get a list of (dataRef, kwargs) for
TaskRunner.__call__.Parameters: - parsedCmd :
argparse.Namespace The parsed command object returned by
lsst.pipe.base.ArgumentParser.parse_args.- kwargs
Any additional keyword arguments. In the default
TaskRunnerthis is an empty dict, but having it simplifies overridingTaskRunnerfor tasks whose runDataRef method takes additional arguments (see case (1) below).
Notes
The default implementation of
TaskRunner.getTargetListandTaskRunner.__call__works for any command-line task whose runDataRef method takes exactly one argument: a data reference. Otherwise you must provide a variant of TaskRunner that overridesTaskRunner.getTargetListand possiblyTaskRunner.__call__. There are two cases.Case 1
If your command-line task has a
runDataRefmethod that takes one data reference followed by additional arguments, then you need only overrideTaskRunner.getTargetListto return the additional arguments as an argument dict. To make this easier, your overridden version ofgetTargetListmay callTaskRunner.getTargetListwith the extra arguments as keyword arguments. For example, the following adds an argument dict containing a single key: “calExpList”, whose value is the list of data IDs for the calexp ID argument:def getTargetList(parsedCmd): return TaskRunner.getTargetList( parsedCmd, calExpList=parsedCmd.calexp.idList )
It is equivalent to this slightly longer version:
@staticmethod def getTargetList(parsedCmd): argDict = dict(calExpList=parsedCmd.calexp.idList) return [(dataId, argDict) for dataId in parsedCmd.id.idList]
Case 2
If your task does not meet condition (1) then you must override both TaskRunner.getTargetList and
TaskRunner.__call__. You may do this however you see fit, so long asTaskRunner.getTargetListreturns a list, each of whose elements is sent toTaskRunner.__call__, which runs your task.- parsedCmd :
-