Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hera does not have AW 3.6 types (pod_gc on WorkflowTemplate is not rendered correctly) #1292

Open
4 of 7 tasks
seyhbold opened this issue Dec 11, 2024 · 5 comments · May be fixed by #1293
Open
4 of 7 tasks

Hera does not have AW 3.6 types (pod_gc on WorkflowTemplate is not rendered correctly) #1292

seyhbold opened this issue Dec 11, 2024 · 5 comments · May be fixed by #1293
Labels
type:dependency-upgrade A dependency upgrade

Comments

@seyhbold
Copy link

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:

Bug report

Describe the bug
I am using WorkflowTemplate with pod_gc

from hera.workflows import WorkflowTemplate, models as m

with WorkflowTemplate(
    name=name,
    ...
    pod_gc=m.PodGC(
        delete_delay_duration=m.Duration(duration="5m"),
        strategy="OnWorkflowCompletion",
    ),

rendering the yaml of this gives:

  imagePullSecrets:
  - name: regcred
  podGC:
    deleteDelayDuration:
      duration: 5m
    strategy: OnWorkflowCompletion

According to https://argo-workflows.readthedocs.io/en/latest/fields/#podgc

it should render as:

  imagePullSecrets:
  - name: regcred
  podGC:
    deleteDelayDuration: "5m"
    strategy: OnWorkflowCompletion

deleteDelayDuration should be a string and not a Duration object

To Reproduce
Full Hera code to reproduce the bug:

from hera.workflows import WorkflowTemplate, models as m

with WorkflowTemplate(
    pod_gc=m.PodGC(
        delete_delay_duration=m.Duration(duration="5m"),
        strategy="OnWorkflowCompletion"
    )
) as template:
    pass

print(template.to_yaml())

Expected behavior
render

...
podGC:
  deleteDelayDuration: "5m"
  strategy: OnWorkflowCompletion
...

Environment

  • Hera Version: 5.18.0
  • Python Version: 3.13.1
  • Argo Version: 3.6.2

Could you please give me a hint how to fix that?

@elliotgunton
Copy link
Collaborator

I think this is a change in the API models used by Argo 3.6. We have this on our radar (#1215) so I'll take a look to confirm 👀

@elliotgunton
Copy link
Collaborator

Confirmed this is a result of 3.6 types changing, new models would be written as

    pod_gc=m.PodGC(
        delete_delay_duration="5m",
        strategy="OnWorkflowCompletion",
    ),

@seyhbold seyhbold changed the title pod_gc on WorkflowTemplate is not renedered correctly pod_gc on WorkflowTemplate is not rendered correctly Dec 11, 2024
@seyhbold
Copy link
Author

Thank you. Do you have an idea how I cloud render the pod_gc now before the new hera release?

@elliotgunton
Copy link
Collaborator

m.PodGC.construct should work as long as you don't want any validation at all!

with WorkflowTemplate(
    pod_gc=m.PodGC.construct(
        delete_delay_duration="5m",
        strategy="OnWorkflowCompletion",
    )
) as w:
    pass

@seyhbold
Copy link
Author

Ah, perfect. Thank you so much.

@elliotgunton elliotgunton changed the title pod_gc on WorkflowTemplate is not rendered correctly Hera does not have AW 3.6 types (pod_gc on WorkflowTemplate is not rendered correctly) Dec 12, 2024
@elliotgunton elliotgunton added the type:dependency-upgrade A dependency upgrade label Dec 12, 2024
@elliotgunton elliotgunton linked a pull request Dec 12, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:dependency-upgrade A dependency upgrade
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants