Executable#

HermesPy base for executable configurations.

class Verbosity(value)#

Bases: SerializableEnum

Information output behaviour configuration of an executable

ALL = 0#

Print absolutely everything

INFO = 1#

Print general information

WARNING = 2#

Print only warnings and errors

ERROR = 3#

Print only errors

NONE = 4#

Print absolutely nothing

class Executable(results_dir=None, verbosity=Verbosity.INFO, console=None, console_mode=ConsoleMode.INTERACTIVE)#

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.

execute()#

Execute the executable.

Sets up the environment to the implemented run() routine.

Return type:

None

abstract run()#

Execute the configuration.

Returns: The result of the run.

Return type:

Any

property results_dir: str#

Directory in which the execution results will be saved.

Returns:

The directory.

Return type:

str

property verbosity: Verbosity#

Information output behaviour during execution.

Returns:

Configuration flag.

Return type:

Verbosity

static default_results_dir()#

Create a default directory to store execution results.

Returns:

Path to the newly created directory.

Return type:

str

property style: str#

Matplotlib color scheme.

Returns:

Color scheme.

Return type:

str

Raises:

ValueError – If the style is not available.

static style_context()#

Context for the configured style.

Returns: Style context manager generator.

Return type:

Generator

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.