Scripts and Actions¶
Scripts and Phases¶
The Script is generally what one would think of as the script itself: it parses the commandline arguments and runs each enabled Action. There’s the possibility of enabling running multiple Scripts in parallel at some point.
PRE_RUNphase is first, before any actions are run.
PRE_ACTIONphase happens before every enabled action, but a listener can be added to a subset of those actions if desired.
ACTIONphase is when the enabled Action is run. No listener can be added to the
POST_ACTIONphase happens after every enabled action, but a listener can be added to a subset of those actions if desired.
POST_RUNphase happens after all enabled actions are run.
POST_FATALphase happens after a ScriptHarnessFatal exception is raised, but before the script exits.
- script (Script): the Script calling the function
- config (dict): by default this is a LoggingDict
- logger (logging.Logger): the logger for the Script
- action (Action): this is only defined during the
POST_ACTIONphases; it is
Nonein the other phases.
- phase (str): this will be one of
POST_FATAL, depending on which phase we’re in.
The logger and config (and to a lesser degree, the script and action) objects are all available to each function called for convenience and consistency.
Each action can be enabled or disabled via commandline options (see Enabling and Disabling Actions). By default they look for a function with the same name as the action name, with
- replaced by
_. However, any function or method may be specified as the Action.function.