Often we want to trigger a workflow at a specific schedule. Orkes Conductor platform supports this natively. The workflows can be configured to be triggered at any cadence as required using the crontab expression.
The Scheduler can be used for use cases such as:
- Running a workflow in a fixed cadence, such as every hour
- Running the same workflow at different cadences using different fixed inputs
- Running a workflow at a cadence between a set start date and an end date
- Running the workflow once at a future date
Examples could be:
- Renewing a TLS certificate for an infrastructure component
- Sending notifications ahead of account renewal times
- Daily scanning of the S3 or Blob storage to verify policies are not breached
- Check the health of a server URL every 30 seconds
For creating a schedule,
- From your Conductor server, navigate to Definitions > Scheduler. This page displays a list of all the defined schedules.
- Click the Define Schedule button in the top right corner.
The following parameters can be used to configure the schedule:
|Name||Unique name for the schedule. Ensure that the schedule name contains no spaces or special characters.|
|Cron Expression||The cron expression is the schedule that the workflow will run on. You can either input the cron expression or choose from the available templates. See the section Cron Expression below for detailed information regarding this.|
|Workflow name||Name of the workflow to be run. The author of the scheduler should have execution permission for the workflow.|
|Workflow version||Selected Workflow may have different versions. Choose the version to be used in this schedule. If left blank, the latest version would be run.|
|Input params||Provide fixed input values for the workflow as a JSON object. This field is optional.|
|Correlation id||User-supplied ID to correlate or search the scheduled workflows.|
|Schedule start||Choose the date & time for the scheduler to start running. It should be in the format yyyy-mm-dd hh:mm (a/p)m. This field is optional.|
|Schedule end||Choose the date & time for the scheduler to stop running. It should be in the format yyyy-mm-dd hh:mm (a/p)m. This field is optional.|
|Task to domain mapping||You can use the task to domain mapping to limit the workflow execution to specific domains. This field is optional.|
|Start schedule paused?||If selected, the schedule will be paused (so it will not run) upon creation. It is helpful when you don’t want to run the workflow scheduler, such as during maintenance. To resume the scheduled executions, this needs to be unpaused.|
- Click Save Schedule.
Non-admin users can create a schedule only if they have "execute" permission over the workflow to be scheduled. You must also provide “read” permission to list the workflows in the scheduler or workflow definitions.
Once the schedule is created, you can carry out the following actions on the created schedule:
- Pause: Use this option to pause your schedule during situations such as maintenance. You can resume the schedule once you're done.
- Clone: Use this option to duplicate your schedule, making it easier to reuse your existing schedule settings.
- Add/Edit Tags: Use this option to add a new tag to the scheduler or edit an existing tag in the scheduler.
- Delete: Use this option to permanently remove the schedule from the Conductor console. This is a one-time action that cannot be undone.
The standard cron expression can be used for scheduling the workflows.
The UI has a Cron Expression Helper to describe the options of the Cron expression. You can also test the expression after entering it, and the UI will automatically calculate the next few runs of the schedule.
The CRON expression has six terms; you can denote a blank entry with an asterisk.
* * * * * *
The terms, in the order from left to right, define the timings:
- Second: Allowed values: 0-59
- Minute: Allowed values: 0-59
- Hour: Allowed values: 0-23
- Day of Month: Allowed values: 1-31
- Month: Allowed values are 1-12 or JAN-DEC
- Day of Week: Allowed values are 0-7 or MON-SUN, where 0 & 7 is Sunday
Macros are also supported when setting a schedule.
|@yearly (Or @annually)||Once a year (0 0 0 1 1 *)|
|@monthly||Once a month (0 0 0 1 * *)|
|@weekly||Once a week (0 0 0 * * 0)|
|@daily (Or @midnight)||Once a day (0 0 0 * * *)|
|@hourly||Once an hour, (0 0 * * * *)|
- The schedules are all based on the UTC timezone. However, you can view the corresponding local browser time.
- A workflow can be invoked by any number of schedules.
- Execution history is maintained up to a configured maximum limit (Default of 1000 executions per schedule).
- When there are a large number of schedules, you must adjust the server capacity to manage the load.
- When the workflow is invoked, the following field will be injected automatically as the input:
"_executedTime": <EPOCH EXECUTED TIME>,
"_startedByScheduler": "<SCHEDULER NAME>",
"_executionId": "<EXECUTION ID>",
"_scheduledTime": <EPOCH SCHEDULED TIME>
Once the schedulers are defined, you can view the executions from the Executions > Scheduler page.
The execution page lists the details of all the scheduler executions. It includes the details such as scheduled time, execution time, execution ID, workflow ID, state, reason for failure, and error details. You can view the workflow execution by directly clicking on the workflow ID. You can also filter further information using the available options.
For non-admin users to work with schedules created by an admin, they need to be provided access to the required schedules and workflows. This can be granted through a user group. Here’s how you can achieve this:
Add the required tag to the scheduler and workflow to which non-admins may need access. Let’s add the tag “team:execute”. Create a user group with required members and provide execute & read access to the tag “team:execute”.
Scheduling Workflows from Completed Executions
To schedule a workflow from a completed execution page,
- Navigate to the workflow execution page.
- From Actions, choose Create Schedule.
- This pre-fills a Scheduler Definition with the workflow name, version, input parameters, and task-to-domain mapping. You only need to provide a name for the scheduler and choose the schedule time.