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

New dag/steps decorators generate incorrect valueFrom and lose output descriptions #1218

Open
3 of 7 tasks
alicederyn opened this issue Sep 30, 2024 · 0 comments · May be fixed by #1221
Open
3 of 7 tasks

New dag/steps decorators generate incorrect valueFrom and lose output descriptions #1218

alicederyn opened this issue Sep 30, 2024 · 0 comments · May be fixed by #1221
Labels
type:bug A general bug

Comments

@alicederyn
Copy link
Collaborator

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
description is being dropped from Parameter annotations on Output types when using @wt.steps decorator and similar.

To Reproduce
Full Hera code to reproduce the bug:

from typing import Annotated
from hera.shared import global_config
from hera.workflows import Input, Output, Parameter, Workflow

global_config.experimental_features["decorator_syntax"] = True

class ExampleOutput(Output):
  field: Annotated[str, Parameter(description="Some field")]

w = Workflow(name="my-workflow")

@w.script()
def my_script(_: Input) -> ExampleOutput:
  return ExampleOutput(field="Hello world!")

@w.steps()
def steps(_: Input) -> ExampleOutput:
  result = my_script(Input())
  return ExampleOutput(field=result.field)

Expected behavior
The following YAML for the step output:

      - description: Some field
        name: field
        valueFrom:
          parameter: '{{steps.result.outputs.parameters.field}}'

What I'm actually seeing is:

      - name: field
        valueFrom:
          parameter: '{{steps.result.outputs.parameters.None}}'

Environment

  • Hera Version: 5.17.0
  • Python Version: 3.11.8
  • Argo Version: N/A

Additional context
I believe the name is being mistakenly set to None here:

"{{" + f"{subnode_type}.{subnode_name}.outputs.parameters.{param_or_artifact.name}" + "}}"

And the description is being discarded here:

outputs.append(Parameter(name=annotation.name, value_from=ValueFrom(parameter=templated_value)))

@alicederyn alicederyn added the type:bug A general bug label Sep 30, 2024
elliotgunton added a commit that referenced this issue Oct 1, 2024
* Fixes #1218
* Parameter/Artifact fields (apart from the name) were not being carried
through, we can use the annotation and change value_from/from_ directly
* We can now using Annotated and leave out the name from Parameters/Artifacts,
so we need the name from the field when hoisting output

Signed-off-by: Elliot Gunton <[email protected]>
@elliotgunton elliotgunton linked a pull request Oct 1, 2024 that will close this issue
3 tasks
@elliotgunton elliotgunton added this to the HEP0001 - new decorators milestone Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug A general bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants