is it possible to enable/disable other sensors in ...
# ask-community
d
is it possible to enable/disable other sensors in the same Definition within a schedule? we have some sensors that are continuously running jobs and we would like to disable those sensors, wait for the jobs to finish, and then kick off a separate job, all on a schedule
t
Hmm There's not an easy answer that I can think of. What are the sensors watching to decide whether to run a job? Could there be additional logic in the sensor that checks if an a run of an existing job exists and not a yield a run request if so? If so, I'm sure there's a better way to check it via the
dagster.Instance()
, but my way would be to query the GraphQL API for any runs from that job/tag.
d
ah I didn't think about adding it to the sensors. they check a queue size a sql table to see if there's work to be done as well as check the last run of the job to see if it was successful, shouldn't be difficult to see if our new job is currently running as well and just not yield a run request
t
Aaah there it is then! Depending on how you got that last run status, you might not even have to write additional logic to get the current runs!
d
ah I'll still need to query the dagster Instance, because it's a different job, so I need that run status as well. Tangentially related question, is it possible to get the run_config of a job from the dagster instance?
t
I'll be honest and say that I'm not entirely sure as I haven't tried it myself. but based off my intellisense/auto-complete, it should be possible with something like:
Copy code
from dagster import DagsterInstance
DagsterInstance().get_runs()[0].run_config
d
thanks!