Schedules allow you to automatically run tasks on a recurring cadence.
If you want to execute a task just once in the future, see Execute later.

Creating schedules

// my_task.airplane.ts
export default airplane.task(
slug: "my_task",
schedules: {
midnight_daily: {
cron: "0 0 * * *",
async () => {...}

Cron syntax

The recurrence schedule is defined using cron syntax, with times specified in UTC. In addition to standard cron characters, Airplane supports the following:
CharacterValid FieldsExample
LDay of Week5L ("last Friday of the month")
#Day of Week5#3 ("third Friday of the month")
WDay of Month1W ("nearest weekday to the 1st of the month")

Sample cron expressions

Cron expressionMeaning
0 12 * * *Daily at 12:00 UTC
0 17 * * 5Every Friday at 17:00 UTC
0 12 * * 3#1First Wednesday of the month at 12:00 UTC
*/30 12-17 * * MON-FRIEvery half hour between 12:00 UTC and 16:59 UTC on weekdays
0 12 15 */2 *Every 15th of the month at 12:00 UTC, every two months (starting in January)

Archiving schedules

Schedules can be archived to temporarily or permanently prevent them from running. They may be unarchived at any time, as long as the task is also unarchived.
If a task is archived, all of its active schedules are also archived. Unarchiving a task does not automatically unarchive all of its associated schedules.

Schedule permissions

Schedules run as their creator, meaning if you schedule a task and it runs the next day, Airplane will execute the task as you (the creator). If the creator no longer has access (e.g. due to the creator leaving the Airplane team), the schedule will automatically be paused.

Invalid schedules

It is possible for schedules to become invalid; e.g., adding or changing parameters to the task, or the schedule creator losing permissions to execute it. In these cases, the schedule will be moved into a paused state, and an alert will show up next to the schedule indicating why the schedule has been automatically paused.
You can unpause a schedule by editing it in the app and re-saving it.

Schedule concurrency

Schedules are designed to start a task based on a custom recurrence schedule. However, if the last execution has not yet finished, a new execution will only be started after the last execution has finished. For a given schedule, at most one execution will be in an active state at any time.
For example, a schedule that executes every five minutes will normally execute a run at 10:00, 10:05, 10:10, etc. If a run that starts at 10:15 takes 12 minutes, the next run will start at 10:27 at the earliest; the next run after that will start at either 10:30 or when the 10:27 run has finished, whichever is later.

Schedules and environments

Tasks can be configured with different schedules, depending on the environment. See Environment-based task configuration for details.

Schedule runs

Schedule runs are created by the Airplane-managed Schedule Runner service account. This account will be automatically provisioned for your team during your first schedule run.
In the event a user's permissions are restricted such that they are no longer authorized to execute a task or create additional schedules, any existing schedules created by the user will continue operating normally. Similarly, schedules created by users that are removed from your team will also continue to operate normally.
Default schedule run failure notifications are sent to the creator of the schedule. For more information on default run notifications and setting up schedule run notifications for the rest of your team, see notifications.