for tasks and flows. I'm wanting to return the state so that the main flow will not fail if the subflow or task fails.
I have a flow with several subflows where I use
return_state=True
and get the data later with
.result()
. This works even if the subflow failed because the result ends up being the failed state (or something like that).
But I'm trying to use the same pattern within a task, and as soon as I call
.result()
, the flow fails. Is this the expected behavior? Does
return_state=True
work differently for subflows and tasks?
n
Nate
03/17/2024, 6:21 PM
> as soon as I call
.result()
, the flow fails. Is this the expected behavior?
yes. because a
Failed
task or flow run would have an
Exception
as its result value, you're "unwrapping" that
Exception
when you call
.result()
the
State
you get back when you say
return_state=True
has methods like
is_failed()
which you can use to conditionally avoid unwrapping exception values if you want to avoid failing the calling flow
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.