hey prefect-server folks! I’m working on a state h...
# prefect-server
j
hey prefect-server folks! I’m working on a state handler function that sends a notification to teams when a tasks fails, the same task is retried and when the retry of the task is successful. The notification on failure and retry of the task is working fine, but I’m not managing to trigger the notification when the retry is successful. Any help? Code inside thread.
Read a bit on state transitions (https://docs.prefect.io/core/concepts/states.html#task-state-transitions). Since Retry = “Failed -> Retrying -> Running” and Success = “Pending -> Running -> Success”, I’m assuming the if clause
if old_state.is_retrying() and new_state.is_successful():
will never evaluate to True.
k
Oh sorry I missed this but looks like you got it. Retrying AND Successful will never evaluate to true. You can use
is_successful()
or
is_finished