-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Labels
type:bugA general bugA general bug
Description
Pre-bug-report checklist
1. This bug can be reproduced using pure Argo YAML
If yes, it is more likely to be an Argo bug unrelated to Hera. Please double check before submitting an issue to Hera.
2. I have searched for existing issues
- Yes
3. This bug occurs in Hera when...
- exporting to YAML
- submitting to Argo
- running on Argo with the Hera runner
- other: parsing workflow from JSON downloaded from an Argo cluster
Bug report
Describe the bug
A clear and concise description of what the bug is:
In Hera, template_defaults field is typed as an optional[Template]
hera/src/hera/workflows/models/io/argoproj/workflow/v1alpha1.py
Lines 4440 to 4441 in fed792c
| template_defaults: Annotated[ | |
| Optional[Template], |
However, as per Argo Workflows documentation, it is just a collection of overrides, not a full template. So if you download a workflow from a cluster where it was complimented with
templateDefaults, pydantic in Hera fails the validations, expecting a full Template where e.g. something like this can be present:
templateDefaults:
inputs: {}
outputs: {}
metadata: {}
container:
name: ''
env:
- name: ARGO_INSTALLATION
value: us-east2
resources: {}
script:
name: ''
env:
- name: ARGO_INSTALLATION
value: us-east2
resources: {}
source: ''
Error log if applicable:
File ".../my_project/argo/util/api.py", line 120, in _get_graph_json_rest
return Workflow.parse_obj(result.json())
File ".../pydantic/x86_64_linux/lib/python3.12/site-packages/pydantic/v1/main.py", line 526, in parse_obj
return cls(**obj)
^^^^^^^^^^
File ".../pydantic/x86_64_linux/lib/python3.12/site-packages/pydantic/v1/main.py", line 341, in __init__
raise validation_error
pydantic.v1.error_wrappers.ValidationError: 2 validation errors for Workflow
status -> storedWorkflowTemplateSpec -> templateDefaults -> container -> image
field required (type=value_error.missing)
status -> storedWorkflowTemplateSpec -> templateDefaults -> script -> image
field required (type=value_error.missing)```
**To Reproduce**
Full Hera code to reproduce the bug:
```py
# Not applicable, as requires templateDefaults being set up on the cluster
Expected behavior
Workflow is parsed all right.
Environment
- Hera Version: 5.14.3
- Python Version: 3.12
- Argo Version: 3.5.10
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type:bugA general bugA general bug