I need a batch job to run on its usual schedule except on selected holidays. EventBridge Scheduler does not seem to offer a custom holiday calendar, so what are practical ways to handle this?
How do you skip scheduled jobs on holidays?
Answers
One option is to keep the holiday dates in an iCalendar file and have a small script read it, then create or update the scheduled events for the dates you actually want. That can work well when the schedule is fairly stable, though you will need to rerun the process when the calendar changes.
Reply to this answer
If the schedule itself should stay simple, let the job trigger as usual and put a holiday check at the start of the batch process. Keep the dates in a maintained configuration source, and have the job exit cleanly when the date is excluded. That avoids rebuilding schedules, but the trigger still happens and may incur whatever costs or side effects your setup attaches to it.
Reply to this answer
For jobs that must not even be invoked on those dates, generate the allowed run dates ahead of time and create schedules from that list. I would make the calendar source and timezone explicit, and add a check that flags missing or stale dates. It is more setup than a simple cron expression, but it makes the exception rules visible and testable.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions