LSSTApplications
10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
|
Base class for command-line tasks: tasks that may be executed from the command line. More...
Public Member Functions | |
def | applyOverrides |
A hook to allow a task to change the values of its config after the camera-specific overrides are loaded but before any command-line overrides are applied. More... | |
def | parseAndRun |
Parse an argument list and run the command. More... | |
def | writeConfig |
Write the configuration used for processing the data, or check that an existing one is equal to the new one if present. More... | |
def | writeSchemas |
Write the schemas returned by getAllSchemaCatalogs. More... | |
def | writeMetadata |
Write the metadata produced from processing the data. More... | |
Static Public Attributes | |
RunnerClass = TaskRunner | |
canMultiprocess = True | |
Private Member Functions | |
def | _makeArgumentParser |
Create and return an argument parser. More... | |
def | _getConfigName |
Return the name of the config dataset type, or None if config is not to be persisted. More... | |
def | _getMetadataName |
Return the name of the metadata dataset type, or None if metadata is not to be persisted. More... | |
Base class for command-line tasks: tasks that may be executed from the command line.
See pipe_base introduction to learn what tasks are, and how to write a command-line task for more information about writing command-line tasks. If the second link is broken (as it will be before the documentation is cross-linked) then look at the main page of pipe_tasks documentation for a link.
Subclasses must specify the following class variables:
Subclasses may also specify the following class variables:
Subclasses must specify a method named "run":
run
accepts a single butler data reference, but you can specify an alternate task runner (subclass of TaskRunner) as the value of class variable RunnerClass
if your run method needs something else.run
is expected to return its data in a Struct. This provides safety for evolution of the task since new values may be added without harming existing code.run
must be picklable if your task is to support multiprocessing. Definition at line 356 of file cmdLineTask.py.
|
private |
Return the name of the config dataset type, or None if config is not to be persisted.
Definition at line 529 of file cmdLineTask.py.
|
private |
Return the name of the metadata dataset type, or None if metadata is not to be persisted.
Definition at line 536 of file cmdLineTask.py.
|
private |
Create and return an argument parser.
[in] | cls | the class object |
By default this returns an ArgumentParser with one ID argument named --id
of dataset type "raw".
Your task subclass may need to override this method to change the dataset type or data ref level, or to add additional data ID arguments. If you add additional data ID arguments or your task's run method takes more than a single data reference then you will also have to provide a task-specific task runner (see TaskRunner for more information).
Definition at line 444 of file cmdLineTask.py.
def lsst.pipe.base.cmdLineTask.CmdLineTask.applyOverrides | ( | cls, | |
config | |||
) |
A hook to allow a task to change the values of its config after the camera-specific overrides are loaded but before any command-line overrides are applied.
This is necessary in some cases because the camera-specific overrides may retarget subtasks, wiping out changes made in ConfigClass.setDefaults. See LSST Trac ticket #2282 for more discussion.
[in] | cls | the class object |
[in] | config | task configuration (an instance of cls.ConfigClass) |
Definition at line 390 of file cmdLineTask.py.
def lsst.pipe.base.cmdLineTask.CmdLineTask.parseAndRun | ( | cls, | |
args = None , |
|||
config = None , |
|||
log = None , |
|||
doReturnResults = False |
|||
) |
Parse an argument list and run the command.
Calling this method with no arguments specified is the standard way to run a command-line task from the command line. For an example see pipe_tasks bin/makeSkyMap.py
or almost any other file in that directory.
cls | the class object |
args | list of command-line arguments; if None use sys.argv |
config | config for task (instance of pex_config Config); if None use cls.ConfigClass() |
log | log (instance of lsst.pex.logging.Log); if None use the default log |
doReturnResults | Return the collected results from each invocation of the task? This is only intended for unit tests and similar use. It can easily exhaust memory (if the task returns enough data and you call it enough times) and it will fail when using multiprocessing if the returned data cannot be pickled. |
None
unless doReturnResults is True
; see cls.RunnerClass (TaskRunner by default) for more information. Definition at line 406 of file cmdLineTask.py.
def lsst.pipe.base.cmdLineTask.CmdLineTask.writeConfig | ( | self, | |
butler, | |||
clobber = False |
|||
) |
Write the configuration used for processing the data, or check that an existing one is equal to the new one if present.
[in] | butler | data butler used to write the config. The config is written to dataset type self._getConfigName() |
[in] | clobber | a boolean flag that controls what happens if a config already has been saved:
|
Definition at line 461 of file cmdLineTask.py.
def lsst.pipe.base.cmdLineTask.CmdLineTask.writeMetadata | ( | self, | |
dataRef | |||
) |
Write the metadata produced from processing the data.
[in] | dataRef | butler data reference used to write the metadata. The metadata is written to dataset type self._getMetadataName() |
Definition at line 516 of file cmdLineTask.py.
def lsst.pipe.base.cmdLineTask.CmdLineTask.writeSchemas | ( | self, | |
butler, | |||
clobber = False |
|||
) |
Write the schemas returned by getAllSchemaCatalogs.
[in] | butler | data butler used to write the schema. Each schema is written to the dataset type specified as the key in the dict returned by getAllSchemaCatalogs. |
[in] | clobber | a boolean flag that controls what happens if a schema already has been saved:
|
Definition at line 488 of file cmdLineTask.py.
|
static |
Definition at line 387 of file cmdLineTask.py.
|
static |
Definition at line 386 of file cmdLineTask.py.