flowserv.controller.base module

Abstract interface for the workflow controller. The controller provides methods to start and cancel the execution of workflows, as well as methods that poll the current state of a workflow.

The aim of an abstract workflow controller is to keep the workflow controller flexible with respect to the processing backend that is being used. The implementation of the controller can either orchestrate the execution of a workflow iteself or be a wrapper around an existing workflow engine. An example for latter is a workflow controller that wrapps around the REANA workflow engine.

The implementation of the controller is responsible for interpreting a given workflow template and a set of template parameter arguments. The controller therefore requires a method for modifying the workflow template with a given set of user-provided template modifiers.

The controller is also responsible for retrieving output files and for providing access to these files.

class flowserv.controller.base.WorkflowController

Bases: object

The workflow controller is used to start execution of workflow templates for a given set of template parameter arguments, as well as to poll the state of workflow execution and to cancel execution.

Workflow executions, referred to as runs, are identified by unique run ids that are assigned by components that are outside of the controller. Implementations of the controller are responsible for maintaining a mapping of these run identifiers to any indentifiers that are generated by the workflow engine.

abstract cancel_run(run_id: str)

Request to cancel execution of the given run.

Parameters

run_id (string) – Unique run identifier

Raises

flowserv.error.UnknownRunError

abstract exec_workflow(run: flowserv.model.base.RunObject, template: flowserv.model.template.base.WorkflowTemplate, arguments: Dict, staticfs: flowserv.volume.base.StorageVolume, config: Optional[Dict] = None) Tuple[flowserv.model.workflow.state.WorkflowState, flowserv.volume.base.StorageVolume]

Initiate the execution of a given workflow template for a set of argument values. Returns the state of the workflow and the path to the directory that contains run result files for successful runs.

The client provides a unique identifier for the workflow run that is being used to retrieve the workflow state in future calls.

If the state of the run handle is not pending, an error is raised.

Parameters
  • run (flowserv.model.base.RunObject) – Handle for the run that is being executed.

  • template (flowserv.model.template.base.WorkflowTemplate) – Workflow template containing the parameterized specification and the parameter declarations.

  • arguments (dict) – Dictionary of argument values for parameters in the template.

  • staticfs (flowserv.volume.base.StorageVolume) – Storage volume that contains the static files from the workflow template.

  • config (dict, default=None) – Optional implementation-specific configuration settings that can be used to overwrite settings that were initialized at object creation.

Return type

flowserv.model.workflow.state.WorkflowState, flowserv.volume.base.StorageVolume