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

Danny Steffy

04/19/2023, 6:53 PM
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

Tim Castillo

04/19/2023, 7:09 PM
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

Danny Steffy

04/19/2023, 7:12 PM
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

Tim Castillo

04/19/2023, 7:14 PM
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

Danny Steffy

04/19/2023, 10:14 PM
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

Tim Castillo

04/20/2023, 6:50 PM
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

Danny Steffy

04/20/2023, 7:59 PM
thanks!
5 Views