- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2025 05:23 AM
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
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:
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:
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:
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.