Hi, Does the state of the subflow define the state...
# prefect-server
s
Hi, Does the state of the subflow define the state of the main flow ? I have received an error from my customers environment stating that one of subflows have failed, but the main flow still shows as successful. Unfortunately I don’t have access to environment yet.
Copy code
with Flow("Master", schedule=schedule, run_config=master_run_config) as flow:

    register_graph_flow_run_id = create_flow_run(
        flow_name=register_graph.flow.name,
        project_name=project_name,
        task_args={"name": register_graph.flow.name},
    )

    wait_for_register_graph_flow_run = wait_for_flow_run(
        flow_run_id=register_graph_flow_run_id,
        raise_final_state=True,
        task_args={"name": f"Wait {register_graph.flow.name}"},
    )

    register_bots_flow_run_id = create_flow_run(
        flow_name=register_bots.flow.name,
        project_name=project_name,
        task_args={"name": register_bots.flow.name},
    )

    wait_for_register_bots_flow_run = wait_for_flow_run(
        flow_run_id=register_bots_flow_run_id,
        raise_final_state=True,
        task_args={"name": f"Wait {register_bots.flow.name}"},
    )

    register_bots_flow_run_id.set_upstream(wait_for_register_graph_flow_run)
The flow definition
a
Does the state of the subflow define the state of the main flow ?
It depends. The reference tasks determine the final state of a flow run. If you don't set reference tasks explicitly, then the last task run state determines the state of a flow run. You can set this using:
Copy code
flow.set_reference_tasks([your_task])
upvote 1