flowserv.tests.controller module
Helper methods and classes for unit test for components of the benchmark modules.
- class flowserv.tests.controller.StateEngine(fs: Optional[flowserv.volume.base.StorageVolume] = None, state: Optional[flowserv.model.workflow.state.WorkflowState] = None)
Bases:
flowserv.controller.base.WorkflowControllerWorkflow controller for test purposes. Maintains a dictionary of run states. Allows to modify the state of maintained runs
- cancel_run(run_id: str)
Request to cancel execution of the given run.
- Parameters
run_id (string) – Unique run identifier.
- configuration() List
Get a list of tuples with the names of additional configuration variables and their current values.
- Return type
list((string, string))
- error(run_id: str, messages: Optional[List[str]] = None) flowserv.model.workflow.state.WorkflowState
Set the run with the given identifier into error state.
- Parameters
run_id (string) – Unique run identifier
messages (list(string), optional) – Default error messages
- Return type
- 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]
Fake execute method that returns the workflow state that the was provided when the object was instantiated. Ignores all given arguments.
- 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
- start(run_id: str) flowserv.model.workflow.state.WorkflowState
Set the run with the given identifier into running state. Returns the modified workflow state.
- Parameters
run_id (string) – Unique run identifier
- Return type
- success(run_id: str, files: Optional[List[str]] = None) flowserv.model.workflow.state.WorkflowState
Set the default state to SUCCESS.
- Parameters
run_id (string) – Unique run identifier
files (list(string), default=None) – List of created resource files (relative paths).
- Return type