Aric Huang
08/12/2021, 10:28 PMslack_notifier
(https://docs.prefect.io/core/advanced_tutorials/slack-notifications.html#slack-notifications) or creating your own state handler to attach to a flow (https://docs.prefect.io/core/concepts/notifications.html#state-handlers) but don't see a straightforward way to change the Slack message based on some runtime value other than old_state
and new_state
. Is there any recommended way to do this? I think if there's some way for a state handler to read a Parameter value that would work for me, but not sure if that's possible.Kevin Kho
SlackTask(message).run()
and this will be the easiest way to fire out a messageAric Huang
08/12/2021, 10:35 PMdef post_to_slack(task, old_state, new_state):
msg = "Task {0} is now in state {1}".format(task, new_state)
SlackTask(msg).run()
return new_state
Aric Huang
08/12/2021, 10:36 PMKevin Kho
Aric Huang
08/12/2021, 10:37 PMAric Huang
08/12/2021, 10:38 PMdef post_to_slack(task, old_state, new_state):
username = <some Parameter value>
msg = "@{username}: Task {0} finished in state {1}".format(username, task, new_state)
SlackTask(msg).run()
return new_state
Kevin Kho
prefect.context.get("parameters")
. I think it’s a dictionary of all the values.Aric Huang
08/12/2021, 10:39 PMAric Huang
08/12/2021, 10:39 PM