<@U06RKAMK0UC> When I run a workflow with new para...
# ask-ai
g
@ancient-wolf-19325 When I run a workflow with new paramaters I get error
Request rejected by the API, due to Invalid input. Details: train.setup task with different structure already exists.
I need to be able to run the same workflow with different input parameters
j
The error you're encountering is due to Flyte's versioning mechanism, which identifies tasks and workflows by their structure and version. When you change input parameters, Flyte sees it as a different structure and requires a new version. To resolve this, you can specify a new version when registering the workflow. This can be done using
pyflyte register
or
flytectl register
commands. Here's an example of how to do it: 1. Package the workflow:
Copy code
pyflyte package
2. Register the workflow with a new version:
Copy code
flytectl register files --project <project> --domain <domain> --version <new_version> --archive flyte-package.tgz
Alternatively, you can use
pyflyte register
directly:
Copy code
pyflyte register --project <project> --domain <domain> --version <new_version>
Would you like more details on this process or any other aspect of Flyte? Sources: - https://github.com/flyteorg/flyte/issues/5426 - https://github.com/flyteorg/flyte/issues/5415 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
g
@ancient-wolf-19325 how can I keep same structure with varying inputs
j
To keep the same workflow structure while varying inputs, you should avoid re-registering the workflow for each input change. Instead, you can use Flyte's dynamic workflows or launch plans to handle varying inputs without changing the workflow structure. 1. Dynamic Workflows: Use dynamic workflows to handle varying inputs at runtime.
Copy code
from flytekit import task, dynamic, workflow

   @task
   def process_data(input: str) -> str:
       return f"Processed {input}"

   @dynamic
   def dynamic_wf(inputs: list[str]):
       results = []
       for input in inputs:
           results.append(process_data(input=input))
       return results

   @workflow
   def wf(inputs: list[str]):
       return dynamic_wf(inputs=inputs)
2. Launch Plans: Create a launch plan with default inputs and override them at execution time.
Copy code
from flytekit import LaunchPlan, workflow

   @workflow
   def wf(input: str):
       process_data(input=input)

   launch_plan = LaunchPlan.create(
       "wf_launch_plan",
       wf,
       default_inputs={"input": "default_value"}
   )
You can then override the input when executing the launch plan:
Copy code
flytectl create execution --project <project> --domain <domain> --name <name> --launchplan wf_launch_plan --inputs '{"input": "new_value"}'
Would you like more details on dynamic workflows or launch plans? Sources: - Flyte Dynamic Workflows - Flyte Launch Plans 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
g
@salmon-flower-36598 see above