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

[BUG] [flytekit] cannot pass dataclass with Optional[list] to FlyteRemote.execute #6057

Open
2 tasks done
gvogel-hh opened this issue Nov 29, 2024 · 1 comment
Open
2 tasks done
Labels
bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers

Comments

@gvogel-hh
Copy link

gvogel-hh commented Nov 29, 2024

Describe the bug

When trying to pass a dataclass containing an optional list as input to FlyteRemote.execute(), a KeyError: 'items' is raised at flytekit/core/type_engine.py:839 in generate_attribute_list_from_dataclass_json_mixin (flytekit==1.13.14).

Expected behavior

Workflow is started with the given dataclass instance.

Additional context to reproduce

from dataclasses import dataclass
from typing import Optional

from flytekit import task, workflow
from flytekit.configuration import Config
from flytekit.remote import FlyteRemote
from mashumaro.mixins.json import DataClassJSONMixin


@dataclass
class MyConfig(DataClassJSONMixin):
    op_list: Optional[list[str]]


@task
def t() -> None:
    pass


@workflow
def wf(config: MyConfig) -> None:
    t()


if __name__ == "__main__":
    config = MyConfig(op_list=["a", "b"])
    remote = FlyteRemote(
        config=Config.auto(config_file="../config.yaml"),
        default_project="flytesnacks",
        default_domain="development",
    )

    remote_wf = remote.fetch_workflow(name="mywf.wf")
    execution = remote.execute(remote_wf, inputs={"config": config})

Screenshots

No response

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

  • Yes

Have you read the Code of Conduct?

  • Yes
@gvogel-hh gvogel-hh added bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers labels Nov 29, 2024
Copy link

welcome bot commented Nov 29, 2024

Thank you for opening your first issue here! 🛠

@gvogel-hh gvogel-hh changed the title [BUG] [flytekit] cannot pass dataclass with Optional[list] to remote.execute [BUG] [flytekit] cannot pass dataclass with Optional[list] to FlyteRemote.execute Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers
Projects
Status: Backlog
Development

No branches or pull requests

1 participant