Module Contents

class flambe.runnable.runnable.Runnable(user_provider: Callable[[], str] = None, **kwargs)[source]

Bases: flambe.compile.MappedRegistrable

Base class for all runnables.

A runnable contains a single run method that needs to be implemented. It must contain all the logic for the runnable.

Each runnable has also access to the secrets the user provides.

Examples of Runnables: Experiment, Cluster


The secrets that the user provides. For example, ‘config[“AWS”][“ACCESS_KEY”]’


The extensions used for this runnable.

Type:Dict[str, str]

This attribute will hold the YAML representation of the Runnable.


The logic for specifying the user triggering this Runnable. If not passed, by default it will pick the computer’s user.

Type:Callable[[], str]
inject_content(self, content: str)[source]

Inject the original YAML string that was used to generate this Runnable instance.

Parameters:content (str) – The YAML, as a string
inject_secrets(self, secrets: str)[source]

Inject the secrets once the Runnable was created.

Parameters:secrets (str) – The filepath to the secrets
inject_extensions(self, extensions: Dict[str, str])[source]

Inject extensions to the Runnable

Parameters:extensions (Dict[str, str]) – The extensions
run(self, **kwargs)[source]

Run the runnable.

Each implementation will implement its own logic, with the parameters it needs.


Parse the runnable to determine if it’s able to run. :raises: ParsingExperimentError – In case a parsing error is found.