Kilian11/02/2020, 12:14 PM
I would like to get the actual error message of the upstream task, in this case
prefect.engine.signals.TRIGGERFAIL('Trigger was "all_successful" but some of the upstream tasks failed.')
<Failed: "Unexpected error: NameError("name 'asd' is not defined")">
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.
@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()
Spencer11/02/2020, 1:40 PM
state with the exception as the
. 😕 As an aside, you can add a state_handler at the flow level instead of the task level, which may do what you want.
Kilian11/02/2020, 4:03 PM
. As in my example, data will have
and it is not possible for me to get back the original error message of the
Spencer11/02/2020, 4:06 PM