flyteorg / flyte

Scalable and flexible workflow orchestration platform that seamlessly unifies data, ML and analytics stacks.
https://flyte.org
Apache License 2.0
5.73k stars 649 forks source link

[BUG] Unable to input dataclass and optional dataclass types in Flyte Console #4912

Open lindseynield opened 8 months ago

lindseynield commented 8 months ago

Describe the bug

Given a custom dataclass input such as:

@dataclass_json
@dataclass
class MyClass:
    a: str
    b: str

If a workflow contains an input of type MyClass and an optional input of type MyClass, we are unable to type in an input for the MyClass type in the Flyte Console. There does not appear to be type boxes for this input.

Expected behavior

I would be able to specify a value for both of these struct inputs in the Flyte Console.

Additional context to reproduce

from typing import Optional
from flytekit import task, workflow
from dataclasses import dataclass
from dataclasses_json import dataclass_json

@dataclass_json
@dataclass
class MyClass:
    a: str
    b: str

@task()
def my_task(input: MyClass):
    return

@workflow
def my_workflow(
    input: MyClass,
    optional_input: Optional[MyClass] = MyClass(a="", b="")  # Workaround for https://github.com/flyteorg/flyte/issues/4736
):
    my_task(input=input)

Screenshots

https://github.com/flyteorg/flyte/assets/65570827/c81dccf9-9d73-4623-8b53-941d11679f2e

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

Have you read the Code of Conduct?

welcome[bot] commented 8 months ago

Thank you for opening your first issue here! 🛠

dosubot[bot] commented 8 months ago

🤖

Hey @lindseynield! Fancy seeing you here again. Hope you're navigating the code sea smoothly today! 🚀

Based on the information provided, it seems like you're encountering a limitation of the Flyte Console. Currently, the Flyte Console does not support inputting values for custom dataclass types and optional dataclass types. This is not related to the protobuf definitions you've provided, but rather a feature that is currently not supported in the Flyte Console.

A similar issue was raised in the past (#1344), where the Flyte Console was not rendering complex inputs correctly. However, that issue has been resolved and the attributes can now be seen in the UI.

As a workaround, if you need to input values for these types, you would need to do so programmatically using the Flyte SDK. For example, you can launch a task or workflow with these types as inputs using the launch_plan.execute() method in the Flyte SDK, and pass in the values for these inputs as arguments.

I hope this helps clarify the situation. If you have further questions or need more assistance, please let me know.

Sources

#### About Dosu This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot.