<@U06RKAMK0UC> Is there a way to control the order...
# ask-ai
b
@ancient-wolf-19325 Is there a way to control the order of the inputs in the UI? they do not seem to follow the order in the workflow parameters
j
Currently, Flyte does not maintain the order of parameters as defined in the workflow code. The inputs are sorted alphabetically in the UI, which can be surprising to users expecting the order to match their code. This is due to the use of maps for maintaining variables, which inherently do not preserve order. There is a suggestion to add an index field to maintain the original order, but this feature is not yet implemented (GitHub issue #940). Would you like more detail on this topic? Sources: - Workflow input ordering and description - Flyte UI changes the parameters order - Flyte UI input order discussion 👍 1 button 👎 0 button 💡 Hint: Mention @ancient-wolf-19325 in the thread for followups.
b
.
@ancient-wolf-19325 Is it possible to have a drop down list as input
j
Yes, Flyte supports using an Enum type as an input, which can be represented as a dropdown list in the UI. This allows users to select from a predefined set of string values. The first value in the Enum is considered the default (GitHub issue #590). Would you like more detail on how to implement this? Sources: - Feature: Support "Enum/Options" type as Flyte Input - UI Feature: Enum type support in Launch form 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
b
@ancient-wolf-19325 yes
j
To implement a dropdown list as an input in Flyte, you can use the Enum type. Here's a step-by-step guide on how to do this: 1. Define an Enum: Create a Python Enum class with the desired options. Each option should be a string, as Flyte currently supports only string values for Enums.
Copy code
from enum import Enum

    class Coffee(Enum):
        ESPRESSO = "espresso"
        AMERICANO = "americano"
        LATTE = "latte"
        CAPPUCCINO = "cappuccino"
2. Create Tasks and Workflows: Use the Enum as an input parameter in your tasks and workflows. Flytekit will automatically handle the conversion and ensure that only the predefined values are accepted.
Copy code
from flytekit import task, workflow

    @task
    def take_order(coffee: str) -> Coffee:
        return Coffee(coffee)

    @task
    def prep_order(coffee_enum: Coffee) -> str:
        return f"Preparing {coffee_enum.value} ..."

    @workflow
    def coffee_maker(coffee: str) -> str:
        coffee_enum = take_order(coffee=coffee)
        return prep_order(coffee_enum=coffee_enum)

    @workflow
    def coffee_maker_enum(coffee_enum: Coffee) -> str:
        return prep_order(coffee_enum=coffee_enum)
3. Run the Workflow: You can execute the workflow and pass the Enum value as a string. The Flyte UI will display a dropdown list for the Enum input, allowing users to select from the predefined options.
Copy code
pyflyte run \
      <https://raw.githubusercontent.com/flyteorg/flytesnacks/master/examples/data_types_and_io/data_types_and_io/enum_type.py> \
      coffee_maker_enum --coffee_enum="latte"
This setup ensures that users can only select from the specified Enum values, providing a controlled input mechanism through a dropdown list in the Flyte UI. Sources: - Enum type — Flyte - Flytesnacks example 👍 1 button 👎 0 button 💡 Hint: Mention @ancient-wolf-19325 in the thread for followups.
b
@ancient-wolf-19325 can text be added to the when Launching a workflow Create New Execution such as instructions, this would not be an argument, or an argument that is fixed
j
Currently, Flyte does not support adding static text or instructions directly in the "Create New Execution" UI as a non-argument field. However, you can use docstrings in your workflow code to provide documentation and instructions, which will be displayed in the Flyte UI. These docstrings can include details about the workflow, its purpose, and any other relevant information (Flyte documentation). Would you like more detail on how to use docstrings for this purpose? Sources: - Documenting workflows — Flyte - Flytekit docstring feature 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.