flowserv.controller.remote.client module
The abstract remote client class is used by the remote workflow controller to interact with a workflow engine. Different workflow engines will implement their own version of the remote client. The client provides the functionality that is required by the workflow controller to execute workflows, cancel workflow execution, get workflow status, and to download workflow result files.
- class flowserv.controller.remote.client.RemoteClient
Bases:
objectThe remote client class is an abstract interface that defines the methods that are required by the remote workflow controller to execute and monitor remote workflows. Different workflow engies will implement their own version of the interface.
- abstract create_workflow(run: flowserv.model.base.RunObject, template: flowserv.model.template.base.WorkflowTemplate, arguments: Dict, staticfs: flowserv.volume.base.StorageVolume) flowserv.controller.remote.client.RemoteWorkflowHandle
Create a new instance of a workflow from the given workflow template and user-provided arguments.
The static storage volume provides access to static workflow template files that were created when the workflow template was installed.
Implementations of this method will also upload any files to the remomote engine that are required to execute the workflow.
A created workflow may not be running immediately but at minimum scheduled for execution. There is no separate signal to trigger execution start.
The result is a handle to access the remote workflow object.
- 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.
- Return type
- abstract get_workflow_state(workflow_id: str, current_state: flowserv.model.workflow.state.WorkflowState) flowserv.model.workflow.state.WorkflowState
Get information about the current state of a given workflow.
- Parameters
workflow_id (string) – Unique workflow identifier
current_state (flowserv.model.workflw.state.WorkflowState) – Last known state of the workflow by the workflow controller
- Return type
flowserv.model.workflw.state.WorkflowState
- abstract stop_workflow(workflow_id: str)
Stop the execution of the workflow with the given identifier.
- Parameters
workflow_id (string) – Unique workflow identifier
- class flowserv.controller.remote.client.RemoteWorkflowHandle(run_id: str, workflow_id: str, state: flowserv.model.workflow.state.WorkflowState, output_files: List[str], runstore: flowserv.volume.base.StorageVolume, client: flowserv.controller.remote.client.RemoteClient)
Bases:
objectBase class for remote workflow handles. Remote workflows may have an identifier that differs from the run identifier that is managed by flowServ. The remote identifier is maintained by the handle, together with the last reported workflow state, and the list of output files that are generated by successful workflow runs. The names of output files are path that are relative to the root directory of the remote environment that executes the workflow.
- is_active() bool
Test if the last state of the workflow is an active state.
- Return type
bool
- output_files: List[str]
- poll_state() flowserv.model.workflow.state.WorkflowState
Get the current state of the workflow from the responsible backend.
Uses the client to poll the workflow state. Updates the internal state if the workflow state has changed.
If the state of the workflow has not changed the result of this method is None. Otherwise, the returned value is the new (current) workflow state.
- Return type
- run_id: str
- runstore: flowserv.volume.base.StorageVolume
- workflow_id: str