Rob Fowler
07/16/2021, 11:30 AMKevin Kho
Rob Fowler
07/17/2021, 2:35 AM*def ignore_timeout_handler*(task, old_state, new_state):
*if* new_state.is_failed() *and*
*isinstance*(new_state, state.TimedOut):
*return* state.Success(result=Box(status="TimeOut", stdout="", stderr=""))
*else*:
*return* new_state
Then:
combine = prefect.task(*lambda* first, second: Box(**first, **second))
combined = combine.*map*(hosts, results)
DumpResultsTask(combined, "all")
good_hosts_filter = FilterTask(filter_func=*lambda* x: x.status == "OK")
DumpResultsTask(good_hosts_filter(combined), "only good with info from datadomain as test")
bad_hosts_filter = FilterTask(filter_func=*lambda* x: x.status != "OK")
DumpResultsTask(bad_hosts_filter(combined), "only bad to email or tell someone")
The issue is I do this so many times when, if the handler could get some more info I would never need the code again.Rob Fowler
07/17/2021, 2:36 AMChris White
Pending
-> Running
and Failed
-> Retrying
and there is only one, maybe two, transitions for which "inputs" are even a meaningful and known quantity. Rephrased, state handlers are hooks that operate in the surface area around your task as an isolated unit (including all the times the task is not able to run and doesn't even have inputs).
With all feature requests we need to be able to have an open conversation about the desired outcome because, as is the case here, your intended goal is not actually compatible with the current concept of state handlers so a new hook or a re-imagining is needed. This conversation can be difficult to have when it begins with "This feature is useless" 🙂Rob Fowler
07/18/2021, 9:36 AMRob Fowler
07/18/2021, 9:37 AM