Josh Paulin

08/30/2022, 1:24 PM
Is there any way to attach some kind of listener to a flow as it changes states? In Prefect 1 I would have done this with state handlers, but those don’t seem to be an option if I’m looking to monitor the flow status instead of task status. My use case is to sync the Flow status with our legacy (homegrown) orchestrator to help perform the migration, so it can almost be thought of as custom notifications.

Christopher Boyd

08/30/2022, 1:32 PM
Hi Josh, it seems like this is what you’re asking about ?

Josh Paulin

08/30/2022, 1:34 PM
Notifications only support Slack and Email, but this involves (at minimum) running some custom code to invoke a lambda. If I could write my own notification type then that would do the trick.


08/30/2022, 1:45 PM
If I could write my own notification type then that would do the trick.
You can (if you're running your own orion instance) in a similar way to how we've written the
block here, you're free to subclass NotificationBlock and register that block type to your workspace docs on creating new block types

Josh Paulin

08/30/2022, 1:46 PM
Ooh that would probably do the trick. Let me give it a try. Thanks!
Maybe I’m missing something here, but which part of the Notifications block is actually listening to the state change to call that


08/30/2022, 3:46 PM
There is a service that runs server side that is responsible for invoking the
method on a notification block for the appropriate state changes. The notification block needs to be available server side for sending notifications, so custom notification blocks require you to run your own Orion server. We’re working on supporting more notification types in Prefect Cloud.

Josh Paulin

08/30/2022, 3:49 PM
Ahh. Then in that case it seems like it won’t work for me since I’m using Cloud 😞