flowserv.model.workflow.manager module

The workflow repository maintains information about registered workflow templates. For each template additional basic information is stored in the underlying database.

class flowserv.model.workflow.manager.WorkflowManager(session: sqlalchemy.orm.session.Session, fs: flowserv.volume.base.StorageVolume)

Bases: object

The workflow manager maintains information that is associated with workflow templates in a workflow repository.

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) flowserv.model.base.WorkflowObject

Add new workflow to the repository. The associated workflow template is created in the template repository from either the given source directory or a Git repository. The template repository will raise an error if neither or both arguments are given.

The method will look for a workflow description file in the template base folder with the name flowserv.json, flowserv.yaml, flowserv.yml (in this order). The expected structure of the file is:

name: ''
description: ''
instructions: ''
files:
    - source: ''
      target: ''
specfile: '' or workflowSpec: ''

An error is raised if both specfile and workflowSpec are present in the description file.

Raises an error if no workflow name is given or if a given workflow name is not unique.

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

  • identifier (string, default=None) – Unique user-defined 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) – File containing instructions for workflow users.

  • 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 copied files.

Return type

flowserv.model.base.WorkflowObject

Raises
delete_workflow(workflow_id)

Delete the workflow with the given identifier.

Parameters

workflow_id (string) – Unique workflow identifier

Raises

flowserv.error.UnknownWorkflowError

get_workflow(workflow_id)

Get handle for the workflow with the given identifier. Raises an error if no workflow with the identifier exists.

Parameters

workflow_id (string) – Unique workflow identifier

Return type

flowserv.model.base.WorkflowObject

Raises

flowserv.error.UnknownWorkflowError

list_workflows()

Get a list of descriptors for all workflows in the repository.

Return type

list(flowserv.model.base.WorkflowObject)

update_workflow(workflow_id, name=None, description=None, instructions=None)

Update name, description, and instructions for a given 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, optional) – Unique workflow name

  • description (string, optional) – Optional short description for display in workflow listings

  • instructions (string, optional) – Text containing detailed instructions for workflow execution

Return type

flowserv.model.base.WorkflowObject

Raises
flowserv.model.workflow.manager.clone(source, repository=None)

Clone a workflow template repository. If source points to a directory on local disk it is returned as the ‘cloned’ source directory. Otherwise, it is assumed that source either references a known template in the global workflow template repository or points to a git repository. The repository is cloned into a temporary directory which is removed when the generator resumes after the workflow has been copied to the local repository.

Returns a tuple containing the path to the resulting template source directory on the local disk and the optional path to the template’s manifest file.

Parameters
  • source (string) – The source is either a path to local template directory, an identifer for a template in the global template repository, or the URL for a git repository.

  • repository (flowserv.model.workflow.repository.WorkflowRepository,) – default=None Object providing access to the global workflow repository.

Return type

string, string