https://dagster.io/ logo
#ask-ai
Title
# ask-ai
d

denton

02/23/2024, 9:05 AM
is it possible to turn off a sensor based on some logic?
s

Scout

02/23/2024, 9:05 AM
Yes, it is possible to turn off a sensor based on some logic. However, the documentation does not provide a direct example of how to programmatically disable a sensor based on logic within the sensor's evaluation function itself. Typically, sensors are defined using the
@sensor
decorator, and they run according to their specified interval. If you want to control the activation of a sensor based on certain conditions, you would need to implement the logic within the sensor's evaluation function to decide whether to yield a run request or not. This doesn't turn off the sensor but can prevent it from triggering pipeline runs. If you need to disable the sensor entirely, you would typically do this manually through the Dagster UI or via the Dagster GraphQL API. The documentation does not provide a method for automatically disabling the sensor based on logic within the sensor's evaluation function. For more advanced use cases, you might consider implementing custom logic outside of Dagster that interacts with the Dagster instance to enable or disable sensors as needed, possibly using the GraphQL API to programmatically control the sensor's state. If you have a specific scenario or logic in mind, I can provide more targeted advice or suggest alternative approaches.
s

sims

03/29/2024, 4:20 AM
I have a very simple schedule that runs once everyday at midnight that completes in less than 30 seconds. I have two sensors: a run_failure_sensor that detects any assets that fail and a run_status_sensor that checks to see if the whole run was successful. As the run is so short, I do not need the sensors to be on for the remainder of the day and only require them to be active at the time of the scheduled run. Is there anyway to work around this? Or should I just increase the minimum_interval_seconds to once a day?
12 Views