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

Support loaders for script Parameters #903

Closed
gaborbernat opened this issue Dec 20, 2023 · 3 comments
Closed

Support loaders for script Parameters #903

gaborbernat opened this issue Dec 20, 2023 · 3 comments

Comments

@gaborbernat
Copy link

gaborbernat commented Dec 20, 2023

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

For a fanin operation, the arguments are always passed in as json.dumps. We already support loaders for artifacts to map them back to a data structure, would be nice if this could work for parameters too:

class Magic(BaseModel):
    files: list[str]


@script(constructor="runner")
def fan_out() -> Annotated[Magic, Parameter(name="response")]:
    return Magic(files=["1.ok"])

# today we have
@script(constructor="runner")
def fan_in(*, responses: list[str]) -> None:
    values: list[Magic] = [Magic.parse_raw(r) for r in responses]
    print(values)

Describe the solution you'd like

# would be nice if we could have
@script(constructor="runner")
def fan_in(*, responses: Annoted[list[Magic], Parameter(loader=Magic)]) -> None:
    print(responses)

Describe alternatives you've considered
Keep using the transform objects in the first line of your script.

@elliotgunton
Copy link
Collaborator

Related: #858 and #827 - better parameter loading is definitely on the roadmap, thanks for the suggestion @gaborbernat!

@elliotgunton
Copy link
Collaborator

Consolidating into #1166 - this will be the next feature to implement as the most requested over various issues. Thanks for the Parameter(loader=Magic) syntax suggestion, I think I'll be using it!

@elliotgunton elliotgunton closed this as not planned Won't fix, can't repro, duplicate, stale Oct 1, 2024
@elliotgunton
Copy link
Collaborator

For a fanin operation, the arguments are always passed in as json.dumps

This was actually a bug fixed in Argo upstream, see #1146 for context/links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants