https://flyte.org logo
#ask-the-community
Title
# ask-the-community
y

Younes El Hjouji

03/06/2023, 2:47 PM
I have a few questions: 1. Can I have a dynamic workflow as a subworkflow of a static workflow? 2. The chain flyte entities documentation shows chaining of tasks with single or no returns, how to chain tasks/workflows with multiple returns? 3. Can the DAG of a static workflow be acquired through flytekit on creation of workflow? What method allows this? 4. Is the same (question 3) possible for a dynamic workflow?
b

Bernhard Stadlbauer

03/06/2023, 2:51 PM
1. Yes! 2. When a workflow has multiple returns (usually best specified a `NamedTuple`s) you can just connect the output of the task with the inputs of the next task 3. I am not sure whether I understand that correctly, would you like to inspect the DAG in Python? Or just use it within a different workflow 4. Depends a bit on your answer to 3.
y

Younes El Hjouji

03/06/2023, 2:55 PM
For 3., I would like to visualize the full DAG. I believe something like this is already supported in flyte UI. I am curious how to access the DAG info in the code.
k

Ketan (kumare3)

03/06/2023, 4:03 PM
@Younes El Hjouji why do you want the dag info in code. Do you want it before the workflow is registered with Flyte or after?
y

Younes El Hjouji

03/06/2023, 4:06 PM
After the workflow is registered, but before it is done running. If I can get it even before the workflow is registered, even better!
k

Ketan (kumare3)

03/06/2023, 4:06 PM
Ohh the dynamic workflow is never registered
It is only dynamically created and stored within the execution context
To access it you can use flyteremote to retrieve the execution information
y

Younes El Hjouji

03/06/2023, 4:07 PM
Hm, so the answer for 4 is no. What about 3? Can I get the full DAG for Static Workflow after registration?
k

Ketan (kumare3)

03/06/2023, 4:10 PM
Yes for 3 - using flyteremote
For 4 is also a partial yes - fetch_execution
y

Younes El Hjouji

03/06/2023, 4:13 PM
Does it return something like DAG-so-far?
k

Ketan (kumare3)

03/06/2023, 4:13 PM
Yup
Everything in Flyte is an api, thr ui uses this api to drive the graph etc
We do not call It a DAG, as it may have recursion - we call It a workflow
y

Younes El Hjouji

03/06/2023, 4:15 PM
Interesting that is can have recursion, didn't consider that! Curious to test it out
k

Ketan (kumare3)

03/06/2023, 4:20 PM
@dynamic is essentially recursion
73 Views