lsst.pipe.base  13.0-12-gaf0c0ec+8
Classes | Functions | Variables
lsst.pipe.base.argumentParser Namespace Reference

Classes

class  ArgumentParser
 An argument parser for pipeline tasks that is based on argparse.ArgumentParser. More...
 
class  ConfigDatasetType
 A dataset type specified by a config parameter. More...
 
class  ConfigFileAction
 argparse action to load config overrides from one or more files More...
 
class  ConfigValueAction
 argparse action callback to override config parameters using name=value pairs from the command line More...
 
class  DataIdArgument
 Glorified struct for data about id arguments, used by ArgumentParser.add_id_argument. More...
 
class  DataIdContainer
 A container for data IDs and associated data references. More...
 
class  DatasetArgument
 A dataset type specified by a command-line argument. More...
 
class  DynamicDatasetType
 Abstract base class for a dataset type determined from parsed command-line arguments. More...
 
class  IdValueAction
 argparse action callback to process a data ID into a dict More...
 
class  InputOnlyArgumentParser
 
class  LogLevelAction
 argparse action to set log level More...
 

Functions

def getTaskDict (config, taskDict=None, baseName="")
 Get a dictionary of task info for all subtasks in a config. More...
 
def obeyShowArgument (showOpts, config=None, exit=False)
 Process arguments specified with –show (but ignores "data") More...
 
def showTaskHierarchy (config)
 Print task hierarchy to stdout. More...
 
def setDottedAttr (item, name, value)
 Like setattr, but accepts hierarchical names, e.g. More...
 
def getDottedAttr (item, name)
 Like getattr, but accepts hierarchical names, e.g. More...
 
def dataExists (butler, datasetType, dataRef)
 Return True if data exists at the current level or any data exists at a deeper level, False otherwise. More...
 

Variables

string DEFAULT_INPUT_NAME = "PIPE_INPUT_ROOT"
 
string DEFAULT_CALIB_NAME = "PIPE_CALIB_ROOT"
 
string DEFAULT_OUTPUT_NAME = "PIPE_OUTPUT_ROOT"
 

Function Documentation

◆ dataExists()

def lsst.pipe.base.argumentParser.dataExists (   butler,
  datasetType,
  dataRef 
)

Return True if data exists at the current level or any data exists at a deeper level, False otherwise.

Parameters
[in]butlerdata butler (a lsst.daf.persistence.Butler)
[in]datasetTypedataset type (a str)
[in]dataRefbutler data reference (a lsst.daf.persistence.ButlerDataRef)

Definition at line 1007 of file argumentParser.py.

◆ getDottedAttr()

def lsst.pipe.base.argumentParser.getDottedAttr (   item,
  name 
)

Like getattr, but accepts hierarchical names, e.g.

foo.bar.baz

Parameters
[in]itemobject whose attribute is to be returned
[in]namename of item to get

For example if name is foo.bar.baz then returns item.foo.bar.baz

Definition at line 993 of file argumentParser.py.

◆ getTaskDict()

def lsst.pipe.base.argumentParser.getTaskDict (   config,
  taskDict = None,
  baseName = "" 
)

Get a dictionary of task info for all subtasks in a config.

Designed to be called recursively; the user should call with only a config (leaving taskDict and baseName at their default values).

Parameters
[in]configconfiguration to process, an instance of lsst.pex.config.Config
[in,out]taskDictusers should not specify this argument; (supports recursion; if provided, taskDict is updated in place, else a new dict is started)
[in]baseNameusers should not specify this argument. (supports recursion: if a non-empty string then a period is appended and the result is used as a prefix for additional entries in taskDict; otherwise no prefix is used)
Returns
taskDict: a dict of config field name: task name

Definition at line 686 of file argumentParser.py.

◆ obeyShowArgument()

def lsst.pipe.base.argumentParser.obeyShowArgument (   showOpts,
  config = None,
  exit = False 
)

Process arguments specified with –show (but ignores "data")

Parameters
showOptsList of options passed to –show
configThe provided config
exitExit if "run" isn't included in showOpts

Supports the following options in showOpts:

  • config[=PAT] Dump all the config entries, or just the ones that match the glob pattern
  • history=PAT Show where the config entries that match the glob pattern were set
  • tasks Show task hierarchy
  • data Ignored; to be processed by caller
  • run Keep going (the default behaviour is to exit if –show is specified)

Calls sys.exit(1) if any other option found.

Definition at line 716 of file argumentParser.py.

◆ setDottedAttr()

def lsst.pipe.base.argumentParser.setDottedAttr (   item,
  name,
  value 
)

Like setattr, but accepts hierarchical names, e.g.

foo.bar.baz

Parameters
[in,out]itemobject whose attribute is to be set
[in]namename of item to set
[in]valuenew value for the item

For example if name is foo.bar.baz then item.foo.bar.baz is set to the specified value.

Definition at line 977 of file argumentParser.py.

◆ showTaskHierarchy()

def lsst.pipe.base.argumentParser.showTaskHierarchy (   config)

Print task hierarchy to stdout.

Parameters
[in]configconfiguration to process (an lsst.pex.config.Config)

Definition at line 813 of file argumentParser.py.

Variable Documentation

◆ DEFAULT_CALIB_NAME

string lsst.pipe.base.argumentParser.DEFAULT_CALIB_NAME = "PIPE_CALIB_ROOT"

Definition at line 51 of file argumentParser.py.

◆ DEFAULT_INPUT_NAME

string lsst.pipe.base.argumentParser.DEFAULT_INPUT_NAME = "PIPE_INPUT_ROOT"

Definition at line 50 of file argumentParser.py.

◆ DEFAULT_OUTPUT_NAME

string lsst.pipe.base.argumentParser.DEFAULT_OUTPUT_NAME = "PIPE_OUTPUT_ROOT"

Definition at line 52 of file argumentParser.py.