Kilian
11/02/2020, 12:14 PMprefect.engine.signals.TRIGGERFAIL('Trigger was "all_successful" but some of the upstream tasks failed.')
I would like to get the actual error message of the upstream task, in this case
<Failed: "Unexpected error: NameError("name 'asd' is not defined")">
@task(trigger=prefect.triggers.any_failed)
def any_failed(data):
logger = prefect.context.get('logger')
print(data)
<http://logger.info|logger.info>("Failed! Error message: %s", data)
@task()
def fail():
asd
return None
@task
def process(data):
return True
with Flow('test') as f:
data = fail()
result = process(data)
any_failed(result)
f.set_reference_tasks([result])
state = f.run()
And I would like to get the upstream error message in any_failed.
I was also looking into state_handlers, but I would prefer this solution having a single point to catch any errors.Spencer
11/02/2020, 1:40 PMFailed
state with the exception as the result
. 😕
As an aside, you can add a state_handler at the flow level instead of the task level, which may do what you want.Kilian
11/02/2020, 4:03 PMany_failed
.
As in my example, data will have TriggerFailed
and it is not possible for me to get back the original error message of the fail
taskSpencer
11/02/2020, 4:06 PM