Kyle Austin
03/23/2022, 2:34 PMKevin Kho
Success
state instead?Kyle Austin
03/23/2022, 5:51 PMKevin Kho
Kyle Austin
03/23/2022, 6:01 PMKevin Kho
Kyle Austin
03/23/2022, 6:04 PMKevin Kho
from prefect import Flow, task
from prefect.engine.state import Finished
def handler(obj, old_state, new_state):
if isinstance(new_state, Finished):
return Finished("finished")
else:
return new_state
@task()
def mytask():
return 1
with Flow(name="POC2", state_handlers=[handler]) as flow:
mytask()
Kyle Austin
03/24/2022, 1:20 AMif new_state.is_failed():
return Finished("finished")
else:
return new_state
which after checking the codebase in prefect github looks like is_failed pretty much returns isinstance(new_state, Failed) and Failed is a child class of Finished I believe.
We do get our color to change to blue in prefect UI, but our flows duration just wasnt reflecting that the flow was indeed finished. For example, we get the blue flow run state after 1 minute for our test flow runs but tomorrow when I log on I see the flow duration is 24 hours and tomorrow when I check the same flow run it says 48 hours. Are you not seeing the same behavior?Kevin Kho
Kyle Austin
03/24/2022, 1:30 AMKevin Kho
Kyle Austin
03/24/2022, 1:34 AMKevin Kho
Kyle Austin
03/24/2022, 1:40 AM