Gabi Pi
10/19/2021, 6:40 AMKevin Kho
RunNamespaceJob
tasks? Are you trying to avoiding bloating the size of the container?Gabi Pi
10/19/2021, 6:58 AMRunNamespaceJob
will make the flows development a bit cumbersome...Anna Geller
Gabi Pi
10/19/2021, 9:34 AMcreate_flow_run
, wait_for_flow_run
, get_task_run_result
) - 3 for each original step. Am I right?Anna Geller
wait_for_flow_run
is an additional tasks if you want to do something after this task and you want to make sure this task completed before moving to the next task (if you have multiple tasks in a flow, I understood you don’t want that)
• get_task_run_result
is another additional task that you could optionally use to interact with results of this task - you don’t need it if you just want to trigger your containerized child flows.
As an example, you could have one flow that triggers FlowRuns for multiple child flows in parallel. Here is how you could do that:
from prefect import Flow, unmapped
from prefect.tasks.prefect import create_flow_run
from prefect.executors import LocalDaskExecutor
with Flow("your-flow-name", executor=LocalDaskExecutor()) as flow:
mapped_flows = create_flow_run.map(
flow_name=["flow_name_1", "flow_name_2", "flow_name_3"],
project_name=unmapped("your-project-name-where-child-flows-are-registered"),
)
if __name__ == "__main__":
flow.run()
Gabi Pi
10/19/2021, 11:39 AM