Hi Vishal
Youโre right: thereโs no single Quartz cron expression that says โrun on the 3rd working day (MonโFri) of every monthโ. Quartz can handle โNth weekday of monthโ (like 3#1 = first Wednesday), but not โNth business day regardless of weekdayโ, so you do need a bit of logic around it
The good news: you donโt need 4โ5 schedules or a bunch of failed runs in history. You can:
Schedule the workflow every weekday, and
Use a small โgateโ task to decide whether to continue or skip that day
Make non-3rd-working-day runs show as Succeeded & Skipped, not Failed.
Have a look here
https://stackoverflow.com/questions/78661662/i-would-like-to-create-a-cron-schedule-in-databricks-th...
1. Schedule once: every weekday
In the job trigger, use a weekday schedule, for example:
This way the job runs daily on business days only.
2. Gate task: compute the 3rd business day and exit cleanly
Make your current notebook the first task in the workflow (e.g. check_3rd_workday).
Slightly tweak it so that:
It sets a task value with the result
It exits successfully on non-3rd days (no exception), so the run is green, not red.
Example:
from datetime import datetime, timedelta today = datetime.today() year, month = today.year, today.month # Count business days from start of month until today business_day_count = 0 current = datetime(year, month, 1) while current <= today: if current.weekday() < 5: # 0=Mon ... 4=Fri business_day_count += 1 current += timedelta(days=1) is_third_workday = (business_day_count == 3) print(f"Today is business day #{business_day_count}") print(f"is_third_workday = {is_third_workday}") # Expose result to the workflow dbutils.jobs.taskValues.set(key="is_third_workday", value=is_third_workday) if not is_third_workday: print("Not the 3rd working day โ skipping downstream tasks") dbutils.notebook.exit("SKIP") # exits SUCCESSFULLY else: print("3rd working day โ continue workflow") dbutils.notebook.exit("RUN")
Key points:
So your run history will show this task as green every weekday; the โnon-3rdโ days are just short runs that exit early.
3. Only run the โrealโ pipeline when is_third_workday == true
You have two main options:
Option A โ If/else condition task (recommended if available)
If your workspace has the If/else condition task:
First task: check_3rd_workday (the notebook above).
Second task: type = If/else condition, expression like:
{{tasks.check_3rd_workday.values.is_third_workday}} == "true"
Attach your real workflow tasks to the true branch only.
Result: