Hi, community, how to understand the trigger, if u...
# prefect-community
c
Hi, community, how to understand the trigger, if upstream flow are using mapping to create parallel flows, will this arg implies my current flow will wait until every parallel upstream flow becomes successful? Since my current flow is still mapping parameters as parallel run, what I want is when each parallel upstream flow finishes, no matter its peer flow finishes or not, it will continue to downstream flow. How could I set trigger args, if I want this to be achieved, this will help our company greatly enhance performance, thanks!! (we use Prefect 1.0)
Copy code
create_flow_run(trigger = all_successful)
1
r
Hello!! If I am understanding your use case correctly, it sounds like using create_flow_run and wait_for_flow_run could be a potential solution. Here is a discourse article going through setting those up as well as some documentation regarding those Prefect tasks. https://discourse.prefect.io/t/how-to-build-a-conditional-flow-of-flows-i-e-trigger-a-different-child-flow-depending-on-the-upstream-flows-state/202 https://docs.prefect.io/api/latest/tasks/prefect.html#wait-for-flow-run
🙌 1
m
@Chu We are in the same situation. Have you found an answer? My current idea is to wrap all my dependencies in 1 super task, then only do the mapping (and parallelization) on that one task. What I mean is something like this:
Copy code
@task()
def super_task(parametres):
    create_flow_run_...
    wait_for_flow_run_...
    create_flow_run_...(trigger=all_finished)
    wait_for_flow_run_...
    create_flow_run_...(trigger=all_successful)
    wait_for_flow_run_...

with Flow(...) as flows:
    output = super_task.map(list_of_input)
Does this work in your case?