Base class for components in a job. More...
Public Member Functions | |
__init__ (self, name, command=None, nevents=None, seed=1, inputs=[], outputs=None, append_tok=None, output_ext=None, ignore_job_params=[], **kwargs) | |
cmd_line_str (self) | |
execute (self, log_out=sys.stdout, log_err=sys.stderr) | |
Generic component execution method. | |
cmd_exists (self) | |
Check if the component's assigned command exists. | |
cmd_args (self) | |
Return the command arguments of this component. | |
cmd_args_str (self) | |
Return list of arguments, making sure they are all converted to strings. | |
setup (self) | |
Perform any necessary setup for this component to run such as making symlinks to required directories. | |
cleanup (self) | |
Perform post-job cleanup such as deleting temporary files. | |
config_logging (self, parser) | |
Configure the logging for a component. | |
config (self, parser) | |
Automatic configuration. | |
set_parameters (self, params) | |
Set class attributes for the component based on JSON parameters. | |
required_parameters (self) | |
Return a list of required parameters. | |
optional_parameters (self) | |
Return a list of optional parameters. | |
required_config (self) | |
Return a list of required configuration settings. | |
check_config (self) | |
Raise an exception on the first missing config setting for this component. | |
input_files (self) | |
Get a list of input files for this component. | |
output_files (self) | |
Return a list of output files created by this component. | |
config_from_environ (self) | |
Configure component from environment variables which are just upper case versions of the required config names set in the shell environment. | |
Public Attributes | |
name | |
command | |
nevents | |
seed | |
inputs | |
outputs | |
append_tok | |
output_ext | |
ignore_job_params | |
hpsmc_dir | |
logger | |
Protected Member Functions | |
_inputs_to_outputs (self) | |
This is the default method for automatically transforming input file names to outputs when output file names are not explicitly provided. | |
Base class for components in a job.
Do not perform any logging in the init method of Component subclasses, as this is not configured by the job manager until after the components are created.
Optional parameters are: nevents, seed
name | name of the component |
command | command to execute |
nevents | number of events to process |
seed | random seed |
inputs | list of input files |
outputs | list of output files |
append_tok | token to append to output file names |
output_ext | extension to append to output file names; format is .ext |
ignore_job_params | list of parameters to ignore when setting parameters |
kwargs | additional keyword arguments |
Definition at line 15 of file component.py.
__init__ | ( | self, | |
name, | |||
command = None , |
|||
nevents = None , |
|||
seed = 1 , |
|||
inputs = [] , |
|||
outputs = None , |
|||
append_tok = None , |
|||
output_ext = None , |
|||
ignore_job_params = [] , |
|||
** | kwargs | ||
) |
Reimplemented in ApplyPedeRes, WriteMisalignedDet, ConstructDetector, hadd, PEDE, DummyComponent, SLIC, SQLiteProc, BeamCoords, RandomSample, DisplaceTime, DisplaceUni, AddMother, AddMotherFullTruth, MergeFiles, StdHepCount, FilterBunches, ExtractEventsWithHitAtHodoEcal, Unzip, LCIODumpEvent, TarFiles, MoveFiles, LCIOConcat, LCIOCount, LCIOMerge, HPSTR, LHECount, _DetectorEditor, MG, EventGenerator, JavaTool, StdHepConverter, EGS5, MG4, MG5, StdHepTool, LCIOTool, JobManager, EvioToLcio, and MergePoisson.
Definition at line 37 of file component.py.
|
protected |
This is the default method for automatically transforming input file names to outputs when output file names are not explicitly provided.
Definition at line 219 of file component.py.
check_config | ( | self | ) |
Raise an exception on the first missing config setting for this component.
Definition at line 196 of file component.py.
cleanup | ( | self | ) |
Perform post-job cleanup such as deleting temporary files.
Reimplemented in PEDE.
Definition at line 109 of file component.py.
cmd_args | ( | self | ) |
Return the command arguments of this component.
Reimplemented in hadd, ConstructDetector, PEDE, MG, SLIC, SQLiteProc, JobManager, HPSTR, StdHepTool, BeamCoords, RandomSample, DisplaceTime, DisplaceUni, AddMotherFullTruth, MergePoisson, StdHepCount, JavaTool, EvioToLcio, FilterBunches, ExtractEventsWithHitAtHodoEcal, LCIODumpEvent, LCIOTool, LCIOConcat, LCIOCount, and LCIOMerge.
Definition at line 95 of file component.py.
cmd_args_str | ( | self | ) |
Return list of arguments, making sure they are all converted to strings.
Definition at line 99 of file component.py.
cmd_exists | ( | self | ) |
Check if the component's assigned command exists.
Reimplemented in LHECount, TarFiles, and MoveFiles.
Definition at line 90 of file component.py.
cmd_line_str | ( | self | ) |
Reimplemented in ApplyPedeRes, and WriteMisalignedDet.
Definition at line 68 of file component.py.
config | ( | self, | |
parser | |||
) |
Automatic configuration.
Automatically load attributes from config by reading in values from the section with the same name as the class in the config file and assigning them to class attributes with the same name.
parser | config parser |
Reimplemented in StdHepConverter, SLIC, JobManager, JavaTool, FilterBunches, LCIODumpEvent, and LCIOTool.
Definition at line 125 of file component.py.
config_from_environ | ( | self | ) |
Configure component from environment variables which are just upper case versions of the required config names set in the shell environment.
Definition at line 233 of file component.py.
config_logging | ( | self, | |
parser | |||
) |
Configure the logging for a component.
parser | the ConfigParser object passed from the job manager |
Definition at line 113 of file component.py.
execute | ( | self, | |
log_out = sys.stdout , |
|||
log_err = sys.stderr |
|||
) |
Generic component execution method.
Individual components may override this if specific behavior is required.
log_out | name of log file for output |
log_err | name of log file for error |
Reimplemented in ApplyPedeRes, EGS5, StdHepConverter, MG, MG4, MG5, SLIC, SQLiteProc, HPSTR, RandomSample, MergePoisson, StdHepCount, Unzip, LHECount, TarFiles, MoveFiles, DummyComponent, and WriteMisalignedDet.
Definition at line 75 of file component.py.
input_files | ( | self | ) |
Get a list of input files for this component.
Definition at line 204 of file component.py.
optional_parameters | ( | self | ) |
Return a list of optional parameters.
Optional parameters are: nevents, seed
Reimplemented in hadd, _DetectorEditor, ApplyPedeRes, ConstructDetector, PEDE, EGS5, MG, SLIC, JobManager, HPSTR, BeamCoords, RandomSample, DisplaceTime, DisplaceUni, MergeFiles, EvioToLcio, FilterBunches, ExtractEventsWithHitAtHodoEcal, and LCIOCount.
Definition at line 180 of file component.py.
output_files | ( | self | ) |
Return a list of output files created by this component.
By default, a series of transformations will be performed on inputs to transform them into outputs.
Reimplemented in EGS5, StdHepConverter, MG, HPSTR, and Unzip.
Definition at line 208 of file component.py.
required_config | ( | self | ) |
Return a list of required configuration settings.
There are none by default.
Reimplemented in _DetectorEditor, WriteMisalignedDet, ConstructDetector, PEDE, SLIC, JobManager, HPSTR, JavaTool, FilterBunches, LCIODumpEvent, and LCIOTool.
Definition at line 188 of file component.py.
required_parameters | ( | self | ) |
Return a list of required parameters.
The job will fail if these are not present in the JSON file.
Reimplemented in _DetectorEditor, WriteMisalignedDet, PEDE, EventGenerator, EGS5, MG, SLIC, JobManager, HPSTR, MergePoisson, MergeFiles, EvioToLcio, LCIODumpEvent, LCIOTool, and LCIOCount.
Definition at line 172 of file component.py.
set_parameters | ( | self, | |
params | |||
) |
Set class attributes for the component based on JSON parameters.
Components should not need to override this method.
params | parameters to setup component |
Reimplemented in MG.
Definition at line 143 of file component.py.
setup | ( | self | ) |
Perform any necessary setup for this component to run such as making symlinks to required directories.
Reimplemented in ConstructDetector, PEDE, EGS5, StdHepConverter, MG, MG4, MG5, SLIC, JobManager, HPSTR, MergePoisson, EvioToLcio, LCIODumpEvent, and LHECount.
Definition at line 103 of file component.py.
append_tok |
Definition at line 55 of file component.py.
command |
Definition at line 50 of file component.py.
hpsmc_dir |
Definition at line 61 of file component.py.
ignore_job_params |
Definition at line 59 of file component.py.
inputs |
Definition at line 53 of file component.py.
logger |
Definition at line 66 of file component.py.
name |
Definition at line 49 of file component.py.
nevents |
Definition at line 51 of file component.py.
output_ext |
Definition at line 56 of file component.py.
outputs |
Definition at line 54 of file component.py.
seed |
Definition at line 52 of file component.py.