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

Open
gaborbernat opened this issue Dec 20, 2023 · 1 comment
Open

Support loaders for script Parameters #903

gaborbernat opened this issue Dec 20, 2023 · 1 comment

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!

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