mlrl.testbed.extensions.extension module

Author: Michael Rapp (michael.rapp.ml@gmail.com)

Provides classes for implementing extensions that add functionality to the command line API provided by this software package.

class mlrl.testbed.extensions.extension.Extension(*dependencies: Extension)

Bases: ABC

An abstract base class for all extensions that add functionality to the command line API.

configure_batch_mode(args: Namespace, batch_mode: BatchMode)

May be overridden by subclasses in order to configure the batch mode according to the command line arguments specified by the user.

Parameters:
  • args – The command line arguments specified by the user

  • batch_mode – The batch mode to be configured

configure_experiment(args: Namespace, experiment_builder: Builder, mode: ExperimentMode)

May be overridden by subclasses in order to configure an experiment according to the command line arguments specified by the user.

Parameters:
  • args – The command line arguments specified by the user

  • experiment_builder – A builder that allows to configure the experiment

  • mode – The mode of operation

configure_read_mode(args: Namespace, read_mode: ReadMode)

May be overridden by subclasses in order to configure the read mode according to the command line arguments specified by the user.

Parameters:
  • args – The command line arguments specified by the user

  • read_mode – The read mode to be configured

configure_run_mode(args: Namespace, run_mode: RunMode)

May be overridden by subclasses in order to configure the run mode according to the command line arguments specified by the user.

Parameters:
  • args – The command line arguments specified by the user

  • run_mode – The run mode to be configured

get_arguments(mode: ExperimentMode) set[Argument]

Returns a set that contains the arguments that should be added to the command line API according to this extension, if it supported a given mode of operation. Dependencies that support the given mode are taken into account recursively.

Parameters:

mode – The mode to be supported

Returns:

A set that contains the arguments

get_dependencies(mode: ExperimentMode) set[Extension]

Returns a set that contains all extensions, this extension depends on recursively, including only those that support a given mode of operation.

Parameters:

mode – The mode to be supported

Returns:

A set that contains all extensions, this extension depends on

abstractmethod get_supported_modes() set[ExperimentMode]

Must be implemented by subclasses in order to return the modes of operation supported by this extension.

Returns:

A set that contains the supported modes or an empty set, if all modes are supported

is_mode_supported(mode: ExperimentMode) bool

Returns whether this extension supports a given mode of operation or not.

Parameters:

mode – The mode to be checked

Returns:

True, if the extension supports the given mode, False otherwise

class mlrl.testbed.extensions.extension.NopExtension(*dependencies: Extension)

Bases: Extension

An extension that does nothing.

get_supported_modes() set[ExperimentMode]

See mlrl.testbed.extensions.extension.Extension.get_supported_modes()