https://dagster.io/ logo
Title
s

Sanidhya Singh

05/03/2023, 3:10 AM
Hi All! I have a sensor that checks if a service is down, if it is, it sends a Slack message to a channel to alert. The sensor runs every 15 mins, if the service goes down, we get the message every 15 mins until it gets resolved. Is there a way baked into Dagster to delay subsequent ticks similar to
RetryPolicy
? Perhaps this could be a new sub-type of Sensor!
:dagster-bot-responded-by-community: 1
f

Frederik Löw

05/03/2023, 10:28 AM
Hey, I have not had this issue before, but you could maybe use the SensorEvalutionContext https://docs.dagster.io/concepts/partitions-schedules-sensors/sensors#sensor-optimizations-using-cursors. You could use it, to keep track of a state ( "message_sent). Maybe something like this: if service_down: if message_sent: do nothing else if NOT message_sent: sent_message() message_sent = True if NOT service_down: message_sent = False
Although, this would not delay ticks, but simply not produce any run requests.
y

yuhan

05/03/2023, 7:59 PM
i’d recommend the same! we don’t have a native way to handle exactly this case but i’d suggest trying to track the state through cursors.
f

Frederik Löw

05/22/2023, 9:50 AM
@Sanidhya Singh, could you make it work?