David Jenkins
09/10/2021, 7:08 PMdef handler(task, old_state, new_state):
if new_state.is_failed():
// do stuff here
return Skipped()
return new_state
the consequence of this is that the flow finishes with a SUCCESS state, even though a task actually failed, but I need to show the flow as FAILED. To solve this, I created a new flow that calls a different state handler and checks its state. If the state is skipped, I return Failed() from the handler. Something like this:
@task(name="final check", state_handlers=[final_check_handler])
def final_check():
pass
and the state handler
def final_check_handler(task, old_state, new_state):
if new_state.is_skipped():
return Failed()
This accomplishes what I want, but surely there has to be a better way.Kevin Kho
David Jenkins
09/10/2021, 7:15 PMKevin Kho
David Jenkins
09/10/2021, 7:20 PM