bianca_unifeye
Databricks MVP

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:

  1. Schedule the workflow every weekday, and

  2. Use a small “gate” task to decide whether to continue or skip that day

  3. 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:

  • In the UI: Advanced schedule → Every Mon–Fri at 09:00

  • Cron example: 0 0 9 ? * MON-FRI

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:

  • dbutils.notebook.exit(...) ends the task as success (unless you raise an exception).

  • dbutils.jobs.taskValues.set(...) lets downstream tasks read is_third_workday. 

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:

  1. First task: check_3rd_workday (the notebook above).

  2. Second task: type = If/else condition, expression like:
    {{tasks.check_3rd_workday.values.is_third_workday}} == "true"

  3. Attach your real workflow tasks to the true branch only.

Result:

  • On the 3rd working day: condition = true → branch with your main pipeline runs.

  • Other days: condition = false → that branch stays skipped; entire job shows as succeeded with most tasks greyed out.

View solution in original post