Skip to content

Module: dispatcher

This module contains the classes and functions to dispatch and run workflows.

ConfigurationFormat

Bases: Enum

A class to represent the configuration file formats.

DispatcherAction

Bases: Enum

A class to represent the actions that can be performed by the dispatcher.

from_str(action) staticmethod

A method to get the dispatcher action from the provided string.

Parameters:

Name Type Description Default
action str

The action to perform.

required

Returns:

Type Description
DispatcherAction

The dispatcher action.

Raises:

Type Description
UnknownOption

If the action is unknown.

WorkflowDispatcher

A class to dispatch and run workflows.

Attributes:

Name Type Description
logger Logger

Workflow engine logger.

imports List[Path]

The paths to the packages with modules.

configuration Configuration

The configuration of the workflows.

workflow_name str

The name of the workflow to run.

status_file Optional[Path]

The path to the file where the statuses of the particular steps will be stored.

dispatch(action)

A method to dispatch the workflow.

Parameters:

Name Type Description Default
action DispatcherAction

The action to perform.

required

list()

A method to list the workflows.

run()

A method to run the workflow.

validate()

A method to validate the configuration provided to the dispatcher.

WorkflowDispatcherBuilder

A class to build the workflow dispatcher.

build()

A method to build the workflow dispatcher.

Returns:

Type Description
WorkflowDispatcher

WorkflowDispatcher instance.

Raises:

Type Description
InvalidConfiguration

If the workflow does not exist in the configuration.

configuration_file(configuration_file=None)

A method to set the configuration file.

Parameters:

Name Type Description Default
configuration_file Optional[Union[str, Path]]

The path to the configuration file.

None

Returns:

Type Description
WorkflowDispatcherBuilder

WorkflowDispatcherBuilder instance.

disable_current_path_import(disable)

A method to disable the automatic import of the modules from the current path.

Parameters:

Name Type Description Default
disable bool

True if the current path import should be disabled, otherwise False.

required

Returns:

Type Description
WorkflowDispatcherBuilder

WorkflowDispatcherBuilder instance.

imports(imports)

A method to set the imports.

Parameters:

Name Type Description Default
imports Optional[List[str]]

The paths to the packages with modules.

required

Returns:

Type Description
WorkflowDispatcherBuilder

WorkflowDispatcherBuilder instance.

logger(logger)

A method to set the logger.

Parameters:

Name Type Description Default
logger Logger

Workflow engine logger.

required

Returns:

Type Description
WorkflowDispatcherBuilder

WorkflowDispatcherBuilder instance.

parameters(parameters)

A method to set the parameters.

Parameters:

Name Type Description Default
parameters Dict[str, Any]

The parameters to set.

required

Returns:

Type Description
WorkflowDispatcherBuilder

WorkflowDispatcherBuilder instance.

status_file(status_file)

A method to set the status file.

Parameters:

Name Type Description Default
status_file Optional[Union[str, Path]]

The path to the file where the statuses of the particular steps will be stored.

required

Returns:

Type Description
WorkflowDispatcherBuilder

WorkflowDispatcherBuilder instance.

workflow_name(workflow_name)

A method to set the workflow name.

Parameters:

Name Type Description Default
workflow_name str

The name of the workflow to run.

required

Returns:

Type Description
WorkflowDispatcherBuilder

WorkflowDispatcherBuilder instance.