Executable¶
HermesPy base for executable configurations.
- 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()[source]¶
Create a default directory to store execution results.
- Returns:
Path to the newly created directory.
- Return type:
- 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.
- class Verbosity(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
SerializableEnum
Information output behaviour configuration of an executable
- ALL = 0¶
Print absolutely everything
- ERROR = 3¶
Print only errors
- INFO = 1¶
Print general information
- NONE = 4¶
Print absolutely nothing
- WARNING = 2¶
Print only warnings and errors