Executable¶
Base class of all executable entry points in HermesPy.
- class Executable(results_dir=None, verbosity=Verbosity.INFO, console=None, console_mode=ConsoleMode.INTERACTIVE, debug=False)[source]¶
Bases:
ABC
Base Class for HermesPy Entry Points.
All executables are required to implement the
run()
method.- Parameters:
results_dir (str, optional) – Directory in which all execution artifacts will be dropped.
verbosity (Union[str, Verbosity], optional) – Information output behaviour during execution.
console (Console, optional) – The console instance the executable will operate on.
console_mode (ConsoleMode, optional) – Output behaviour of the information printed to the console. Interactive by default.
debug (bool, optional) – If enabled, the executable will be run in debug mode. In this case, the exception handler will re-raise exceptions and stop the execution.
- static default_results_dir(experiment=None, overwrite_results=False)[source]¶
Create a default directory to store execution results.
Warning
If overwrite_results is set to True, the current results directory will be erased. Proceed with caution as to not lose any important data.
- Parameters:
experiment (str, optional) – Name of the experiment. If specified, will generate a subdirectory with the experiment name.
overwrite_results (bool, optional) – If False, a new dated directory will be created with a unique index. If True, executing this function will erase the current results directory.
- Return type:
Returns: Path to the newly created directory.
- execute()[source]¶
Execute the executable.
Sets up the environment to the implemented
run()
routine.- Return type:
- static style_context()[source]¶
Context for the configured style.
Returns: Style context manager generator.
- Return type:
- property console: Console¶
Console the Simulation writes to.
- Returns:
Handle to the console.
- Return type:
Console
- property console_mode: ConsoleMode¶
Console mode during runtime.
Returms: The current console mode.
- property debug: bool¶
Debug mode flag.
If enabled, the executable will be run in debug mode. In this case, the exception handler will re-raise exceptions and stop the execution.
- property results_dir: str¶
Directory in which the execution results will be saved.
- Returns:
The directory.
- Return type:
- property style: str¶
Matplotlib color scheme.
- Returns:
Color scheme.
- Return type:
- Raises:
ValueError – If the style is not available.
- property verbosity: Verbosity¶
Information output behaviour during execution.
- Returns:
Configuration flag.
- Return type:
Verbosity