Hi there,
I have this task with a trigger:
@task(trigger=any_failed)
def alert_email(email, message):
sendmail(email, '[Prefect] ADCheck - [FAILED]', message)
with Flow("AD Check") as flow:
# Parameters
admin_email = Parameter("admin_email", default="<mailto:patrick@xyz.br|patrick@xyz.br>")
# Tasks
message = "some message"
try:
ad_conn = connect_active_directory(ad_server, ad_user, ad_pass)
except Exception as e:
message = f'Erro ao executar workflow: {e}'
# If all tasks are successful
notify_email(admin_email, message)
# If any task fails
alert_email(admin_email, message)
When the task fails, I would like to get the Exception error and save it o message variable, but I am getting
Trigger was "all_successful" but some of the upstream tasks failed
@Anna Geller, any tips?
I've tried to use the state_handlers, but I need to be able to change parameters of the alert function for each workflow (email, subject, etc.)
So triggers seems better. But I could not get the error.