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

[Core feature] Enable dataclass attribute access in workflows #3864

Closed
2 tasks done
franzigeiger opened this issue Jul 12, 2023 · 2 comments
Closed
2 tasks done

[Core feature] Enable dataclass attribute access in workflows #3864

franzigeiger opened this issue Jul 12, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@franzigeiger
Copy link

Motivation: Why do you think this is important?

I'd like to access dataclass attributes from within a workflow. This is already possible for NamedTuple but those are restricted in usage.

Goal: What should the final outcome look like, ideally?

I would like this to work:

@dataclass
@dataclass_json
class Config:
    x:int
    y:int
    z:int
    some_unused_additional_config:list[str]

@task
def add(x:int, y:int):
    return x+y
@workflow
def do_something(config:Config):
    add(config.x, config.y)

Describe alternatives you've considered

Currenlty this is only possible with workarounds. You can:

  • Make the workflow dynamic
  • Use NamedTuples only if the configuration object is an output of another workflow. They can't be a task or workflow input.
  • Change the add task signatures to take in the full config object, which means taking in unused parameters.

Propose: Link/Inline OR Additional context

No response

Are you sure this issue hasn't been raised already?

  • Yes

Have you read the Code of Conduct?

  • Yes
@franzigeiger franzigeiger added enhancement New feature or request untriaged This issues has not yet been looked at by the Maintainers labels Jul 12, 2023
@welcome
Copy link

welcome bot commented Jul 12, 2023

Thank you for opening your first issue here! 🛠

@wild-endeavor
Copy link
Contributor

This is something I've wanted for a while too. I think it's possible but will require a fair bit of changes. @franzigeiger were you hoping to contribute?

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

No branches or pull requests

4 participants