flowserv.service.run.local module
The workflow run API component provides methods that execute, access, and manipulate workflow runs and their results. The local run service accesses all resources directly via a the database model.
- class flowserv.service.run.local.LocalRunService(run_manager: flowserv.model.run.RunManager, group_manager: flowserv.model.group.WorkflowGroupManager, ranking_manager: flowserv.model.ranking.RankingManager, backend: flowserv.controller.base.WorkflowController, fs: flowserv.volume.base.StorageVolume, auth: flowserv.model.auth.Auth, user_id: Optional[str] = None, serializer: Optional[flowserv.view.run.RunSerializer] = None)
Bases:
flowserv.service.run.base.RunServiceAPI component that provides methods to start, access, and manipulate workflow runs and their resources. Uses the database model classes to access and manipulate the database state.
- cancel_run(run_id: str, reason: Optional[str] = None) Dict
Cancel the run with the given identifier. Returns a serialization of the handle for the canceled run.
Raises an unauthorized access error if the user does not have the necessary access rights to cancel the run.
- Parameters
run_id (string) – Unique run identifier
reason (string, optional) – Optional text describing the reason for cancelling the run
- Return type
dict
- Raises
- delete_run(run_id: str) Dict
Delete the run with the given identifier.
Raises an unauthorized access error if the user does not have the necessary access rights to delete the run.
- Parameters
run_id (string) – Unique run identifier
- Raises
- get_result_archive(run_id: str) flowserv.model.files.FileHandle
Get compressed tar-archive containing all result files that were generated by a given workflow run. If the run is not in sucess state a unknown resource error is raised.
Raises an unauthorized access error if the user does not have read access to the run.
- Parameters
run_id (string) – Unique run identifier
- Return type
- Raises
- get_result_file(run_id: str, file_id: str) flowserv.model.files.FileHandle
Get file handle for a resource file that was generated as the result of a successful workflow run.
Raises an unauthorized access error if the user does not have read access to the run.
- Parameters
run_id (string) – Unique run identifier.
file_id (string) – Unique result file identifier.
- Return type
- Raises
- get_run(run_id: str) Dict
Get handle for the given run.
Raises an unauthorized access error if the user does not have read access to the run.
- Parameters
run_id (string) – Unique run identifier
- Return type
dict
- Raises
- list_runs(group_id: str, state: Optional[str] = None)
Get a listing of all run handles for the given workflow group.
Raises an unauthorized access error if the user does not have read access to the workflow group.
- Parameters
group_id (string) – Unique workflow group identifier
- Return type
dict
- Raises
- start_run(group_id: str, arguments: List[Dict], config: Optional[Dict] = None) Dict
Start a new workflow run for the given group. The user provided arguments are expected to be a list of (name,value)-pairs. The name identifies the template parameter. The data type of the value depends on the type of the parameter.
Returns a serialization of the handle for the started run.
Raises an unauthorized access error if the user does not have the necessary access to modify the workflow group.
- Parameters
group_id (string) – Unique workflow group identifier
arguments (list(dict)) – List of user provided arguments for template parameters.
config (dict, default=None) – Optional implementation-specific configuration settings that can be used to overwrite settings that were initialized at object creation.
- Return type
dict
- Raises
- update_run(run_id: str, state: flowserv.model.workflow.state.WorkflowState, runstore: Optional[flowserv.volume.base.StorageVolume] = None)
Update the state of the given run. For runs that are in a SUCCESS state the workflow evaluation ranking is updated (if a result schema is defined for the corresponding template). If the ranking results change, an optional post-processing step is executed (synchronously). These changes occur before the state of the workflow is updated in the underlying database.
All run result files are maintained in a engine-specific storage volume before being moved to the file storage. For runs that are incative the
runstoreparameter is expected to reference the run folder.- Parameters
run_id (string) – Unique identifier for the run
state (flowserv.model.workflow.state.WorkflowState) – New workflow state.
runstore (flowserv.volume.base.StorageVolume, default=None) – Storage volume containing the run (result) files for a successful workflow run.
- Raises
- flowserv.service.run.local.run_postproc_workflow(workflow: flowserv.model.base.WorkflowObject, ranking: List[flowserv.model.ranking.RunResult], keys: List[str], run_manager: flowserv.model.run.RunManager, tmpstore: flowserv.volume.base.StorageVolume, staticfs: flowserv.volume.base.StorageVolume, backend: flowserv.controller.base.WorkflowController)
Run post-processing workflow for a workflow template.
- Parameters
workflow (flowserv.model.base.WorkflowObject) – Handle for the workflow that triggered the post-processing workflow run.
ranking (list(flowserv.model.ranking.RunResult)) – List of runs in the current result ranking.
keys (list of string) – Sorted list of run identifier for runs in the ranking.
run_manager (flowserv.model.run.RunManager) – Manager for workflow runs
tmpstore (flowserv.volume.base.StorageVolume) – Temporary storage volume where the created post-processing files are stored. This volume will be erased after the workflow is started.
staticfs (flowserv.volume.base.StorageVolume) – Storage volume that contains the static files from the workflow template.
backend (flowserv.controller.base.WorkflowController) – Backend that is used to execute the post-processing workflow.