New RunLLM response generated: >>>*# Question* Hi...
# runllm-flyte-trial
a
New RunLLM response generated: >>>*# Question* Hi community! What is the better way to handle reusable tasks? Background: We recently meet the issue of registering multiple workflows (they share several tasks) and fail to run all of them except the first workflow get registered. 1. We use flytectl register --continueOnError 2. We use {branch_name} + {git_hash} as version 3. For example we register workflow 1 and get the workflow. When register the workflow 2, it will fail at the task level pb since the task name and version appears before.
Copy code
log: /tmp/_pb_output/132_src.python.flyte.radar_ml.model_workflows.lpm.main.run_experiment_pipeline_1.pb                  | Failed  | Error registering file due to rpc error: code =                                                    |
|                                                                                                                      |         | InvalidArgument desc = task with different structure                                               |
|                                                                                                                      |         | already exists with id resource_type:TASK                                                          |
|                                                                                                                      |         | project:"radar-ml" domain:"adhoc"                                                                  |
|                                                                                                                      |         | name:"src.python.flyte.radar_ml.model_workflows.lpm.main.run_experiment_pipeline"                  |
|                                                                                                                      |         | version:"multi-workflows-e3660b201e6d"
4. Because we use
flytectl register --continueOnError
,the workflow 2 will register successfully but it will reuse the task with the old image from workflow 1. The immediate fix I can think of is: we add timestamp in the version and it becomes {branch_name} + {git_hash} + {timestamp}. This will make sure the task won't conflict. In the long term, does Flyte consider to use workflow + function reference + version as key? # Answer You can handle reusable tasks by using
reference_task
to reference tasks across workflows, avoiding conflicts during registration. This approach allows you to reuse tasks without encountering the "task with different structure" error. To address your immediate issue, adding a timestamp to the version is a practical workaround to ensure unique versions and avoid conflicts. However, this approach may lead to many redundant task versions. For a more sustainable solution, consider the following steps: 1. Reference Tasks: Use
reference_task
to reference existing tasks in new workflows. This avoids re-registering the same task multiple times.
>>2. Topological Sort: Ensure workflows are registered in a topologically sorted order if they reference tasks from other workflows.
3. Atomic Registration: Use
--activate
with
flytectl register
to ensure atomic registration of workflows and tasks. Would you like more details on using
reference_task
or any other aspect? Sources: - Hi team What is the suggestions do s amp don t for sharing f - Hey team Hope you re doing well I have one doubt about regis - wave Hello team I hope this is the correct channel to ask C Slack Link https://flyte-org.slack.com/archives/CP2HDHKE1/p1720751208.992679 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.