flowserv.model.group module
The workflow group manager provides functionality to create and maintain workflow groups. All information about groups is maintained in the underlying database.
- class flowserv.model.group.WorkflowGroupManager(session: sqlalchemy.orm.session.Session, fs: flowserv.volume.base.StorageVolume, users: Optional[flowserv.model.user.UserManager] = None)
Bases:
objectManager for workflow groups that associate a set of users with a set of workflow runs. The manager provides functionality to interact with the underlying database for creating and maintaining workflow groups.
- create_group(workflow_id: str, name: str, parameters: List[flowserv.model.parameter.base.Parameter], workflow_spec: Dict, user_id: Optional[str] = None, members: Optional[List[str]] = None, engine_config: Optional[Dict] = None, identifier: Optional[str] = None)
Create a new group for a given workflow. Within each workflow, the names of groups are expected to be unique.
The workflow group may define additional parameters for the template. The full (modifued or original) parameter list is stored with the group together with the workflow specification.
A group may have a list of users that are members. Membership can be used to control which users are allowed to execute the associated workflow and to upload/view files. The user that creates the group, identified by user_id parameter, is always part of the initial list of group members.
If a list of members is given it is ensured that each identifier in the list references an existing user.
- Parameters
workflow_id (string) – Unique workflow identifier
name (string) – Group name
user_id (string) – Unique identifier of the user that created the group
parameters (list(flowserv.model.parameter.base.Parameter)) – List of workflow template parameter declarations that may be specific to the group
workflow_spec (dict) – Workflow specification
members (list(string), optional) – Optional list of user identifiers for other group members
engine_config (dict, default=None) – Optional configuration settings that will be used as the default when running a workflow.
identifier (string, default=None) – Optional user-provided group identifier.
- Return type
- Raises
- delete_file(group_id, file_id)
Delete uploaded group file with given identifier. Raises an error if the group or file does not exist.
- Parameters
group_id (string) – Unique group identifier
file_id (string) – Unique file identifier
- Raises
- delete_group(group_id)
Delete the given workflow group and all associated resources.
- Parameters
group_id (string) – Unique group identifier
- Raises
- get_group(group_id)
Get handle for the workflow group with the given identifier.
- Parameters
group_id (string) – Unique group identifier
- Return type
- Raises
- get_uploaded_file(group_id: str, file_id: str) flowserv.model.files.FileHandle
Get handle for an uploaded group file with the given identifier. Raises an error if the group or the file does not exists.
Returns the file handle and an object that provides read access to the file contents. The object may either be the path to the file on disk or a IOHandle.
- Parameters
group_id (string) – Unique group identifier
file_id (string) – Unique file identifier
- Return type
- Raises
- list_groups(workflow_id=None, user_id=None)
Get a listing of group descriptors. If the user identifier is given, only those groups are returned that the user is a member of. If the workflow identifier is given, only groups for the given workflow are included.
- Parameters
workflow_id (string, optional) – Unique workflow identifier
user_id (string, optional) – Unique user identifier
- Return type
- list_uploaded_files(group_id)
Get list of file handles for all files that have been uploaded to a given workflow group.
- Parameters
group_id (string) – Unique group identifier
- Return type
- Raises
- update_group(group_id, name=None, members=None)
Update the name and/or list of members for a workflow group.
- Parameters
group_id (string) – Unique group identifier
name (string, optional) – Unique user identifier
members (list(string), optional) – List of user identifier for group members
- Return type
- Raises
- upload_file(group_id: str, file: flowserv.volume.base.IOHandle, name: str)
Upload a new file for a workflow group. This will create a copy of the given file in the file store that is associated with the group. The file will be places in a unique folder inside the groups upload folder.
Raises an error if the given file name is invalid.
- Parameters
group_id (string) – Unique group identifier
file (flowserv.volume.base.IOHandle) – File object (e.g., uploaded via HTTP request)
name (string) – Name of the file
- Return type
- Raises