Schedules
There are many scenarios in which it is beneficial to run a Process on a regular cadence. Examples for such Process could include monthly budget reports, hourly inventory evaluation, and so on. Unmeshed currently supports cron expressions.
Video Guide: Schedules on Unmeshed
Cron expressions
A cron expression is a simple string that's used to describe repetition patterns. Unlike Intervals, crons have a fixed schedule and and don't take into account when the last execution completed. They can be useful in cases where there's a need for specific trigger times, such as with overnight batch processing, database upgrades, and so on.
Unmeshed uses Unix-cron, which comprises of the 5 fields shown below. The general notion is that the Process would trigger when the current time matches the time indicated by the expression.
* * * * * *
| | | | | |
| | | | | day of the week (0–6, starting from Sunday)
| | | | month (1–12)
| | | day of the month (1–31)
| | hour (0–23)
\ minute (0–59)
For example, for a Process to trigger every workday at 10pm, you would use 0 22 * * * 1-5
. Roughly read as:
trigger every minute 0, hour 22, on days Monday-Friday. Asterisk (*
) means that the field is unrestricted.
For additional examples, please check out the content on crontab.guru. It is an excellent resource for analyzing cron expressions.
Calendar
The Calendar-based Scheduling introduces a flexible way to define Process Execution dates. This capability offers users the ability to define schedules using custom calendar configurations.
This can be used along with the existing CRON-based scheduling, providing more flexibility and control.
Calendar Types
There are four types of calendars available for defining job execution schedules:
1. List of Dates Calendar
The List of Dates Calendar allows users to manually select execution dates via the UI.
Features
- Define a date range and select individual days using a visual calendar interface.
- Apply predefined selectors to quickly select commonly used patterns such as:
- Weekends
- Weekdays
- Specific weekdays (e.g., every Monday)
- View and manage selected dates using the Calendar View & List View.
Use Cases
- Non-technical users who prefer visual date selection.
- Fixed execution schedules (e.g., monthly reviews, quarterly tasks).
2. Code Calendar
The Code Calendar enables users to define execution dates programmatically using scripting.
Features
- Write custom logic to generate a list of valid dates.
- Supports templated code snippets to help users get started.
- Ideal for complex or dynamic schedules, such as:
- “Every third Friday of the month”
- “First working day after a public holiday”
Use Cases
- Developers who require logic-based scheduling.
- Scenarios where execution dates depend on business rules or data inputs.
3. Derived Calendar
The Derived Calendar is created by applying set operations between two existing calendars: a Source Calendar and a Target Calendar.
Supported Operations
- UNION – Combines all dates from both calendars.
- INTERSECTION – Includes only dates common to both calendars.
- DIFFERENCE – Includes dates from the source calendar that are not in the target calendar.
- SYMMETRIC DIFFERENCE – Includes dates that are unique to either calendar.
Key Notes
- Manual modification of a Derived Calendar is not supported.
- The calendar is always computed based on the defined operation and input calendars.
- A preview of the resulting dates is available before saving.
Use Cases
- Advanced scheduling needs that combine multiple calendar rules.
- Excluding or combining specific event sets (e.g., "working days minus holidays").
4. Reschedule Calendar
The Reschedule Calendar is designed for cases where scheduled job executions need to be skipped and rescheduled after a specified delay.
Features
- Define days to skip job execution (e.g., holidays, maintenance periods).
- Specify a delta (number of days) to reschedule the skipped job.
- Offers fine-grained control for exception handling.
Use Cases
- Holiday scheduling.
- Downtime or blackout window management.
- Scenarios requiring postponed job execution without cancellation.
Using Calendars in Schedules
Calendars can be attached to schedule definitions to control when jobs are executed.
Each schedule can define:
- A CRON expression, or
- A Fixed time of day (e.g.,
09:00 AM
)
When a calendar is associated with a schedule:
- The calendar acts as a filter, determining the eligible execution dates.
- The job will only run on the dates included in the calendar, at the specified time.
Intervals (coming soon!)
Intervals configure how much time should pass between one completed execution and the next one. In other words, scheduling of the next run can only occur when the previous run has completed. This form of scheduling can be used in cases where Processes have unknown execution time, and it is desirable for executions to be spaced out.
Overlap policy
Cron expressions produce fixed schedules, meaning that Processes would trigger at specific times regardless of previous executions. This could lead to situations where Process runs are triggered while previous one(s) have not completed. And since Processes operate in an asynchronous environment, it is even possible that the second process would complete execution before the first (overlapping) one does. This is not necessarily unwanted behavior, but Unmeshed allows you to specifically configure this behavior when the new schedule is about to be triggered. By default, Unmeshed does not allow Process runs to overlap.
Value | Default |
---|---|
AllowOverlap | ✔️ |
DoNotOverlap |