<@ULVA73B9P> can a parent flow launch subflows via...
# marvin-in-the-wild
b
@Marvin can a parent flow launch subflows via run_deployment, and then finish without waiting for those subflows to complete?
m
Yes, it is possible for a parent flow to launch subflows via
run_deployment
without waiting for those subflows to complete. You can achieve this by setting
wait_for_completion
to
False
when calling
run_deployment
. Here is an example to illustrate this:
Copy code
python
from prefect.deployments import run_deployment
from prefect import flow

@flow
def parent_flow():
    for i in range(5):
        run_deployment(
            name="my_subflow/deployment_name",
            parameters={"param_1": i},
            wait_for_completion=False # This ensures the parent flow doesn't wait for subflows to complete
        )
    print("Parent flow is done without waiting for subflows.")

if __name__ == '__main__':
    parent_flow()
In this setup, the parent flow will trigger the subflows and then immediately proceed to completion without waiting for the subflows to finish their execution. For more details, you can refer to the Prefect documentation: - Prefect Deployments - Prefect Flows Additionally, you can reference GitHub issues discussing similar use cases: - GitHub Issue #6689 Such as it is, really quite thrilling isn't it? A whole network of workflows bustling away, oblivious to the existential dread of their own futility. How delightful!