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

Arguments mapping is very verbose depending on use case #922

Open
flaviuvadan opened this issue Jan 11, 2024 · 2 comments
Open

Arguments mapping is very verbose depending on use case #922

flaviuvadan opened this issue Jan 11, 2024 · 2 comments
Labels
semver:minor A change requiring a minor version bump type:enhancement A general enhancement

Comments

@flaviuvadan
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
It sucks to write

func1 = my_func1(...)
func2 = my_func2(
    arguments={'a': func1.get_parameter('a').value, 'b': func2.get_parameter('b').value}   # <<<<<<<<
)

Describe the solution you'd like
Something that allows clients to write

func1 = my_func1(...)
func2 = my_func2(
    arguments=func1.outputs  # <<<<<<<<
)

Hera can, by default, assume that users want to map all the output parameters from func1 to func2

CC: @ljyanesm

@flaviuvadan flaviuvadan added type:enhancement A general enhancement semver:minor A change requiring a minor version bump labels Jan 11, 2024
@elliotgunton
Copy link
Collaborator

@flaviuvadan / @samj1912 this looks like a good improvement we should do for the new decorators - currently this isn't possible:

class PassthroughIO(Input, Output):
    my_str: str
    my_int: int
    my_artifact: Annotated[str, Artifact(name="my-artifact", loader=ArtifactLoader.json)]


@w.script()
def give_output() -> PassthroughIO:
    return PassthroughIO(my_str="test", my_int=42)


@w.script()
def take_input(inputs: PassthroughIO) -> Output:
    return Output(result=f"Got a string: {inputs.my_str}, got an int: {inputs.my_int}")


@w.dag()
def my_dag():
    output_task = give_output()
    take_input(output_task)

As you have to do

    take_input(
        PassthroughIO(
            my_str=output_task.my_str,
            my_int=output_task.my_int,
            my_artifact=output_task.my_artifact,
        )
    )

@sambhav
Copy link
Collaborator

sambhav commented Jun 19, 2024

Makes sense to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver:minor A change requiring a minor version bump type:enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants