cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Scheduling and triggering jobs based on time and frequency precedence

Anoora
New Contributor II

I have a table in Databricks that stores job information, including fields such as job_name, job_id, frequency, scheduled_time, and last_run_time.

I want to run a query every 10 minutes that checks this table and triggers a job if the scheduled_time is less than or equal to the current time.

Some jobs have multiple frequencies, for example, the same job might run daily and monthly. In such cases, I want the lower-frequency job (e.g., monthly) to take precedence, meaning only the monthly job should trigger and the higher-frequency job (daily) should be skipped when both are due.

What is the best way to implement this scheduling and job-triggering logic in Databricks?

2 REPLIES 2

SamAdams
Contributor

You could add a job with a scheduled based trigger that runs every 10 minutes. The task at the start of the job runs a SQL query against the job information table and uses the logic you described above to output a boolean value. Then feed that boolean value into a conditional task and if True then have a job task that executes your main pipeline.

https://docs.databricks.com/aws/en/jobs/run-if

Anoora
New Contributor II

Yeah, thatโ€™s basically what Iโ€™m doing now, but itโ€™s becoming pretty difficult to manage since there are around 120 pipelines in total. Maintaining a separate scheduled job and conditional logic for each one adds a lot of overhead, and itโ€™s getting hard to scale or keep track of everything. Thatโ€™s why I was exploring whether thereโ€™s a cleaner way to handle this kind of multi-schedule orchestration directly.

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local communityโ€”sign up today to get started!

Sign Up Now