Is it possible to construct a "dynamic workflow" using the Flyte "imperative" API?
The DAGs I want to execute will be described by some rpc call:
get_dag( job_input ) -> DAG of task inputs
In Flyte, I need to read the response, which is a DAG represented as an adjacency list. The directed edges say which tasks need to be executed before which other tasks, and each node in the graph has a payload which is the input to the task.
This
get_dag()
call happens at runtime, so I understand from [1] that I can do this:
@dynamic
start_workflow(...) -> ...:
dag = get_dag(...)
???
@workflow
def my_workflow(...) -> None
return start_workflow(...)
but I can't figure out how to use "imperative workflows"[2] at the same time. How do I get a `
wf = Workflow(name="my.imperative.workflow.example")
?
I did find the dynamic workflow in the API docs:
https://docs.flyte.org/projects/flytekit/en/latest/generated/flytekit.dynamic.html
But how do I use it? Do I need to create a "sub workflow" or is there a more direct way?
[1]
https://docs.flyte.org/projects/cookbook/en/stable/auto/core/control_flow/dynamics.html
[2]
https://docs.flyte.org/projects/cookbook/en/stable/auto/core/flyte_basics/imperative_wf_style.html