Cluster workflow template
ClusterWorkflowTemplate
ClusterWorkflowTemplates are cluster scoped templates.
Since cluster workflow templates are scoped at the cluster level, they are available globally in the cluster.
Source code in src/hera/workflows/cluster_workflow_template.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
workflows_service
workflows_service: Optional[
Union[WorkflowsService, AsyncWorkflowsService]
] = None
ModelMapper
Source code in src/hera/workflows/_meta_mixins.py
build_model
build_model(
hera_class: Type[ModelMapperMixin],
hera_obj: ModelMapperMixin,
model: TWorkflow,
) -> TWorkflow
Source code in src/hera/workflows/_meta_mixins.py
async_create
Creates the ClusterWorkflowTemplate on the Argo cluster.
Source code in src/hera/workflows/cluster_workflow_template.py
async_get
Attempts to get a workflow template based on the parameters of this template e.g. name + namespace.
Source code in src/hera/workflows/cluster_workflow_template.py
async_lint
Lints the ClusterWorkflowTemplate using the Argo cluster.
Source code in src/hera/workflows/cluster_workflow_template.py
async_update
Attempts to perform a workflow template update based on the parameters of this template.
Note that this creates the template if it does not exist. In addition, this performs
a get prior to updating to get the resource version to update in the first place. If you know the template
does not exist ahead of time, it is more efficient to use create() directly to avoid one round trip.
Source code in src/hera/workflows/cluster_workflow_template.py
async_wait
async_wait(poll_interval: int = 5) -> TWorkflow
Waits for the Workflow to complete execution.
Parameters
poll_interval: int = 5 The interval in seconds to poll the workflow status.
Source code in src/hera/workflows/workflow.py
build
Builds the ClusterWorkflowTemplate and its components into an Argo schema ClusterWorkflowTemplate object.
Source code in src/hera/workflows/cluster_workflow_template.py
create
Creates the ClusterWorkflowTemplate on the Argo cluster.
Source code in src/hera/workflows/cluster_workflow_template.py
create_as_workflow
create_as_workflow(
generate_name: Optional[str] = None,
wait: bool = False,
poll_interval: int = 5,
) -> TWorkflow
Run this WorkflowTemplate instantly as a Workflow.
If generate_name is given, the workflow created uses generate_name as a prefix, as per the usual for hera.workflows.Workflow.generate_name. If not given, the WorkflowTemplate’s name will be used, truncated to 57 chars and appended with a hyphen.
Note: this function does not require the WorkflowTemplate to already exist on the cluster
Source code in src/hera/workflows/workflow_template.py
from_dict
from_dict(model_dict: Dict) -> ModelMapperMixin
Create a WorkflowTemplate from a WorkflowTemplate contained in a dict.
Examples:
>>> my_workflow_template = WorkflowTemplate(name="my-wft")
>>> my_workflow_template == WorkflowTemplate.from_dict(my_workflow_template.to_dict())
True
Source code in src/hera/workflows/workflow_template.py
from_file
Create a WorkflowTemplate from a WorkflowTemplate contained in a YAML file.
Examples:
Source code in src/hera/workflows/workflow_template.py
from_yaml
from_yaml(yaml_str: str) -> ModelMapperMixin
Create a WorkflowTemplate from a WorkflowTemplate contained in a YAML string.
Examples:
Source code in src/hera/workflows/workflow_template.py
get
Attempts to get a workflow template based on the parameters of this template e.g. name + namespace.
Source code in src/hera/workflows/cluster_workflow_template.py
get_parameter
Attempts to find and return a Parameter of the specified name.
Source code in src/hera/workflows/workflow.py
get_workflow_link
get_workflow_link() -> str
Returns the workflow link for the workflow.
Source code in src/hera/workflows/workflow.py
lint
Lints the ClusterWorkflowTemplate using the Argo cluster.
Source code in src/hera/workflows/cluster_workflow_template.py
to_dict
to_dict() -> Any
Builds the Workflow as an Argo schema Workflow object and returns it as a dictionary.
to_file
Writes the Workflow as an Argo schema Workflow object to a YAML file and returns the path to the file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_directory
|
Union[Path, str]
|
The directory to write the file to. Defaults to the current working directory. |
'.'
|
name
|
str
|
The name of the file to write without the file extension. Defaults to the Workflow’s name or a generated name. |
''
|
*args
|
Additional arguments to pass to |
()
|
|
**kwargs
|
Additional keyword arguments to pass to |
{}
|
Source code in src/hera/workflows/workflow.py
to_yaml
to_yaml(*args, **kwargs) -> str
Builds the Workflow as an Argo schema Workflow object and returns it as yaml string.
Source code in src/hera/workflows/workflow.py
update
Attempts to perform a workflow template update based on the parameters of this template.
Note that this creates the template if it does not exist. In addition, this performs
a get prior to updating to get the resource version to update in the first place. If you know the template
does not exist ahead of time, it is more efficient to use create() directly to avoid one round trip.
Source code in src/hera/workflows/cluster_workflow_template.py
wait
wait(poll_interval: int = 5) -> TWorkflow
Waits for the Workflow to complete execution.
Parameters
poll_interval: int = 5 The interval in seconds to poll the workflow status.