https://prefect.io logo
#prefect-community
Title
# prefect-community
b

Bob Colner

05/02/2022, 12:24 PM
I don’t see task
state_handlers
functionality in Orion/Prefect2.0. Is is on the roadmap? (or I’m I missing something..) thanks
a

Anna Geller

05/02/2022, 12:29 PM
You're 100% correct; there are no state handlers, but for a very good reason - they are no longer needed! 🙂 given that you may write any Python code within your flows in Prefect 2.0, state handlers can be replaced with simple if/else statements. Check this page for more details
b

Bob Colner

05/02/2022, 12:53 PM
thanks, this makes sense. Still -I would strongly advocate for the state-handler as a useful abstraction to have. Repeating if/then code blocks in every task just to get basic ‘alert on failure’ behavior seems like a big step backward. Especially from a ‘negative eng.’ POV
a

Anna Geller

05/02/2022, 1:58 PM
Repeating if/then code blocks in every task
isn't it the same as what you would have to do in a state handler? if you look at the link I sent: #1 1.0 syntax
Copy code
if new_state.is_failed():
#2 2.0 syntax:
Copy code
if task_future.get_state().is_failed():
just to get basic ‘alert on failure’ behavior
regarding that, we agree with you, and we're working on some very cool features to provide you with highly flexible yet still easy to use ways of implementing such alerts - follow the #announcements channel in the next months, it will be 🔥 amazing
b

Bob Colner

05/02/2022, 2:08 PM
thx, I get a lot of value from the flexibility and simplicity of the prefect1.0
state_handlers
task parameter/API. E.g.
state_handlers=slack_notifier(only_states=[Failed, Retrying])
will keep an eye on new 2.0 features! (you sound very optimistic ;)
🙌 1
193 Views