I have a few questions: 1. Can I have a dynamic wo...
# ask-the-community
y
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
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
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
@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
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
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
Hm, so the answer for 4 is no. What about 3? Can I get the full DAG for Static Workflow after registration?
k
Yes for 3 - using flyteremote
For 4 is also a partial yes - fetch_execution
y
Does it return something like DAG-so-far?
k
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
Interesting that is can have recursion, didn't consider that! Curious to test it out
k
@dynamic is essentially recursion
152 Views