flowserv.model.template.base module
A workflow template contains a workflow specification and an optional list of template parameters. The workflow specification may contain references to template parameters.
Template parameters are common to different backends that excute a workflow. The syntax and structure of the workflow specification is engine specific. The only common part here is that template parameters are referenced using the $[[..]] syntax from within the specifications.
The template parameters can be used to render front-end forms that gather user input for each parameter. Given an association of parameter identifiers to user-provided values, the workflow backend is expected to be able to execute the modified workflow specification in which references to template parameters have been replaced by parameter values.
- class flowserv.model.template.base.WorkflowTemplate(workflow_spec, parameters, parameter_groups=None, outputs=None, postproc_spec=None, result_schema=None)
Bases:
objectWorkflow templates are parameterized workflow specifications. The template contains the workflow specification, template parameters, and information about benchmark results and post-processing steps.
The syntax and structure of the workflow specification(s) is not further inspected. It is dependent on the workflow controller that is used to execute workflow runs.
The template for a parameterized workflow contains a dictionary of template parameter declarations. Parameter declarations are keyed by their unique identifier in the dictionary.
For benchmark templates, a result schema is defined. This schema is used to store the results of different benchmark runs in a database and to the generate a benchmark leader board.
- classmethod from_dict(doc, validate=True)
Create an instance of the workflow template for a dictionary serialization. The structure of the dictionary is expected to be the same as generated by the to_dict() method of this class. The only mandatory element in the dictionary is the workflow specification.
- Parameters
doc (dict) – Dictionary serialization of a workflow template
validate (bool, optional) – Validate template parameter declarations against the parameter schema if this flag is True.
- Return type
- Raises
- to_dict()
Get dictionary serialization for the workflow template.
- Return type
dict
- validate_arguments(arguments)
Ensure that the workflow can be instantiated using the given set of arguments. Raises an error if there are template parameters for which the argument set does not provide a value and that do not have a default value.
- Parameters
arguments (dict) – Dictionary of argument values for parameters in the template
- Raises