Steps
The hera.workflows.steps module provides the Steps, Step and Parallel classes.
See https://argoproj.github.io/argo-workflows/walk-through/steps for more on Steps.
Step
A step runs a given template.
It must be instantiated under a Steps or Parallel context, or outside a Workflow.
Source code in src/hera/workflows/steps.py
get_artifact
get_outputs_as_arguments
Get all output parameters and artifacts as a combined list from this task/step for use as arguments.
This is useful for when all the inputs of another template match all the outputs of this template. It is also possible to combine the outputs of multiple templates if they collectively match the inputs of another template.
Source code in src/hera/workflows/_mixins.py
get_parameter
get_parameters_as
Returns a Parameter that represents all the outputs of this subnode.
Parameters
name: str The name of the parameter to search for.
Returns:
Parameter
The parameter, named based on the given name, along with a value that references all outputs.
Source code in src/hera/workflows/_mixins.py
get_result_as
Returns a Parameter specification with the given name containing the results of self.
Steps
A Steps template invocator is used to define a sequence of steps which can run sequentially or in parallel.
Steps implements the contextmanager interface so allows usage of with, under which any
hera.workflows.steps.Step objects instantiated will be added to the Steps’ list of sub_steps.
- Step and Parallel objects initialised within a Steps context will be added to the list of sub_steps in the order they are initialised.
- All Step objects initialised within a Parallel context will run in parallel.
Source code in src/hera/workflows/steps.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | |
sub_steps
sub_steps: List[
Union[
Step,
Parallel,
List[Step],
WorkflowStep,
List[WorkflowStep],
]
] = field(default_factory=list)
get_artifact
Finds and returns the artifact with the supplied name.
Note that this method will raise an error if the artifact is not found.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
name of the input artifact to find and return. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Artifact |
Artifact
|
the artifact with the supplied name. |
Raises:
| Type | Description |
|---|---|
KeyError
|
if the artifact is not found. |
Source code in src/hera/workflows/_mixins.py
get_parameter
Finds and returns the parameter with the supplied name.
Note that this method will raise an error if the parameter is not found.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
name of the input parameter to find and return. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Parameter |
Parameter
|
the parameter with the supplied name. |
Raises:
| Type | Description |
|---|---|
KeyError
|
if the parameter is not found. |
Source code in src/hera/workflows/_mixins.py
Parallel
Parallel is a context manager used to create a list of steps to run in parallel.
Parallel implements the context manager interface so allows usage of with, under which any
hera.workflows.steps.Step objects instantiated will be added to Parallel’s list of sub_steps.
Source code in src/hera/workflows/steps.py
parallel
Open a parallel context within a steps-decorator function.
When running locally, the context will be a no-op.