Skip to content

[BUG] Failure using Union types with flyte copilot #6662

@ddl-rliu

Description

@ddl-rliu

Flyte & Flytekit version

Flyte 1.15.3 and Flytekit 1.15.3

Describe the bug

Failed to run a ContainerTask task with typing.Union inputs because the flyte copilot fails.

{"level":"error","msg":"Failed to persist [spec], err unsupported scalar type [*core.Scalar_Union]",...}
{"level":"info","msg":"Exited downloading inputs from [.../inputs.pb]",...}
{"level":"error","msg":"Downloading failed, err failed to download input variable from remote store: variable [spec] download/store failed: unsupported scalar type [*core.Scalar_Union]",...}

Context: Support for Union types in the Flyte IDL was added in #1349, but there is still a small missing piece in flytecopilot to support downloading Union-type scalars for ContainerTask flyte tasks.

Proposed fix: Add a logical path for typing.Union types – #6661

Expected behavior

Tasks with typing.Union inputs should work with flyte copilot.

Additional context to reproduce

Workflow code idea for reproducing the error.

@MyContainerTask
def t1() -> str:
    return "hello"


@MyContainerTask
def t2(ff: Union[str, int]) -> bool:
    return ff == "hello"


@workflow
def wf() -> bool:
    return t2(ff=t1())


if __name__ == "__main__":
    wf()

Screenshots

No response

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

  • Yes

Have you read the Code of Conduct?

  • Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinguntriagedThis issues has not yet been looked at by the Maintainers

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions