jcozar
08/06/2025, 8:51 AMMarvin
08/06/2025, 8:51 AMMarvin
08/06/2025, 8:51 AMpython
from prefect import flow
@flow
def parent_flow():
# If this is wrapped in try/except, that would explain the behavior
result1 = subflow1() # This one fails
result2 = subflow2()
result3 = subflow3()
result4 = subflow4()
return [result1, result2, result3, result4] # This should include the failed state
3. Expected Behavior
- If a subflow fails and the failure is not handled, the parent flow should indeed fail
- The parent flow should only complete successfully if:
a) All subflows complete successfully, or
b) Failed subflows are explicitly handled (e.g., with try/except)
4. Recommendations
- If you want the parent flow to fail when any subflow fails, make sure you're not catching exceptions
- If you need to handle subflow failures gracefully, you can use try/except but should consider propagating the failure state in your return value
- You can also use Prefect's state API to check subflow states explicitly
Could you share:
1. The code of your parent flow?
2. How are you calling the subflows (direct calls or using run_deployment
)?
3. Are there any try/except blocks in your code?
This will help me provide more specific guidance on why this is happening and how to achieve the behavior you want.