<@ULVA73B9P> if flow with a retry fails and does ...
# ask-marvin
r
@Marvin if flow with a retry fails and does a retry will it still be awaited by the calling task? i.e wait_for_flow_run
m
thought for 97.6 seconds
Short answer: yes. In Prefect 3.x,
wait_for_flow_run
will keep waiting across retries. If the child flow run fails and enters `AwaitingRetry`/`Retrying`, the call will continue to block until the run reaches a terminal state (Completed, Failed, Cancelled, or Crashed) or until the timeout elapses. - Default timeout is 3 hours; you can raise it to cover your full retry/backoff window. - If the timeout is hit first, it raises
FlowRunWaitTimeout
. - On success or failure, it returns the
FlowRun
model containing the final state; you can inspect
flow_run.state.type
. Example:
Copy code
from prefect.deployments import run_deployment
from prefect.flow_runs import wait_for_flow_run

# Kick off a deployment
fr = run_deployment("my-project/my-deployment")

# Wait across any retries until terminal state
final = wait_for_flow_run(fr.id, timeout=6 * 3600, log_states=True)

print(final.state.type)  # e.g., "COMPLETED", "FAILED", "CANCELLED", "CRASHED"
Links: - Source for `wait_for_flow_run`: prefect/flow_runs.py - State types in Prefect: States (Prefect 3.x)