flowserv.service.workflow.local module

Workflow API component for a service that is running locally. The local API provides additional methods to create, delete and update a workflow. These functions are not available via the remote service API.

class flowserv.service.workflow.local.LocalWorkflowService(workflow_repo: flowserv.model.workflow.manager.WorkflowManager, ranking_manager: flowserv.model.ranking.RankingManager, group_manager: flowserv.model.group.WorkflowGroupManager, run_manager: flowserv.model.run.RunManager, user_id: Optional[str] = None, serializer: Optional[flowserv.view.workflow.WorkflowSerializer] = None)

Bases: flowserv.service.workflow.base.WorkflowService

API component that provides methods to access workflows and workflow evaluation rankings (benchmark leader boards). The local API component extends the base class with functionality to create, delete, and update workflow templates.

create_workflow(source: str, identifier: Optional[str] = None, name: Optional[str] = None, description: Optional[str] = None, instructions: Optional[str] = None, specfile: Optional[str] = None, manifestfile: Optional[str] = None, engine_config: Optional[Dict] = None, ignore_postproc: Optional[bool] = False, verbose: Optional[bool] = False) Dict

Create a new workflow in the repository. If the workflow template includes a result schema the workflow is also registered with the ranking manager.

Raises an error if the given workflow name is not unique.

Parameters
  • source (string) – Path to local template, name or URL of the template in the repository.

  • name (string) – Unique workflow name

  • description (string, default=None) – Optional short description for display in workflow listings.

  • instructions (string, default=None) – Text containing detailed instructions for running the workflow.

  • specfile (string, default=None) – Path to the workflow template specification file (absolute or relative to the workflow directory).

  • manifestfile (string, default=None) – Path to manifest file. If not given an attempt is made to read one of the default manifest file names in the base directory.

  • engine_config (dict, default=None) – Optional configuration settings that will be used as the default when running the workflow and the post-processing workflow.

  • ignore_postproc (bool, default=False) – Ignore post-processing workflow specification if True.

  • verbose (bool, default=False) – Print information about source and target volume and the files that are being copied.

Return type

dict

Raises
delete_workflow(workflow_id: str)

Delete the workflow with the given identifier.

Parameters

workflow_id (string) – Unique workflow identifier.

Raises

flowserv.error.UnknownWorkflowError

get_ranking(workflow_id: str, order_by: Optional[List[flowserv.model.template.schema.SortColumn]] = None, include_all: Optional[bool] = False) Dict

Get serialization of the evaluation ranking for the given workflow. Returns None if the workflow does not have a result schema.

Parameters
  • workflow_id (string) – Unique workflow identifier.

  • order_by (list(flowserv.model.template.schema.SortColumn), default=None) – Use the given attribute to sort run results. If not given, the schema default sort order is used.

  • include_all (bool, default=False) – Include all entries (True) or at most one entry (False) per user group in the returned ranking.

Return type

dict

Raises

flowserv.error.UnknownWorkflowError

get_result_archive(workflow_id: str) flowserv.model.files.FileHandle

Get compressed tar-archive containing all result files that were generated by the most recent post-processing workflow. If the workflow does not have a post-processing step or if the post-processing workflow run is not in SUCCESS state, a unknown resource error is raised.

Parameters

workflow_id (string) – Unique workflow identifier.

Return type

flowserv.model.files.FileHandle

Raises
get_result_file(workflow_id: str, file_id: str) flowserv.model.files.FileHandle

Get file handle for a file that was generated as the result of a successful post-processing workflow run.

Parameters
  • workflow_id (string) – Unique workflow identifier.

  • file_id (string) – Unique resource file identifier.

Return type

flowserv.model.files.FileHandle

Raises
get_workflow(workflow_id: str) Dict

Get serialization of the handle for the given workflow.

Parameters

workflow_id (string) – Unique workflow identifier.

Return type

dict

Raises

flowserv.error.UnknownWorkflowError

list_workflows() Dict

Get serialized listing of descriptors for all workflows in the repository.

Return type

dict

update_workflow(workflow_id: str, name: Optional[str] = None, description: Optional[str] = None, instructions: Optional[str] = None) Dict

Update name, description, and instructions for a given workflow. Returns the serialized handle for the updated workflow.

Raises an error if the given workflow does not exist or if the name is not unique.

Parameters
  • workflow_id (string) – Unique workflow identifier.

  • name (string, default=None) – Unique workflow name.

  • description (string, default=None) – Optional short description for display in workflow listings.

  • instructions (string, default=None) – Text containing detailed instructions for workflow execution.

Return type

dict

Raises