Schedule a task
Airplane schedules allow you to incrementally automate your work. You might create a script, deploy
it to Airplane, and run it manually to start. You can then set up a Schedule to
execute tasks on a periodic basis, similar to cron.
- Schedules are fully managed, so you don't have to worry about your cron server going down or figuring out how to build a distributed cron system.
- Any task can be scheduled, making it really easy to set up a repeating operation.
- Tasks are fully audited, so you get a history of every scheduled run.
Before you begin
Before you begin
If you haven't yet, you'll need to create a database and task that you can schedule. Check out
Build a SQL task for a guide.
This will create a task,
Search users
, and database Demo DB
that we'll use here as an example.Creating a schedule from code
Creating a schedule from code
You can create a schedule by adding it to the task definition file of
a task. Update the task definition from Build a SQL task with a new
schedules
section:yamlCopied1# search_users.task.yaml2slug: search_users3name: Search users4parameters:5- name: Query6slug: query7type: shorttext8required: false9sql:10resource: "[Demo DB]"11entrypoint: search_users.sql12queryArgs:13search: "%{{params.query}}%"14schedules:15daily:16cron: 0 0 * * *17description: Runs daily at 12am UTC18paramValues:19query: vip
daily
is the slug of the schedule. It serves as an identifier.cron
is the recurrence of the schedule, specified in Cron syntax.paramValues
contains the values you'd typically pass in to the task. In this example, we're querying for "vip" every time.
Don't forget to run
airplane deploy search_users.task.yaml
to update the task and schedule.Creating a schedule in the UI
Creating a schedule in the UI
Alternatively, you can create schedules from the UI. To do so, visit the
Search users
task and
select New schedule
:
Name and description are optional for schedules, if you'd like to add additional context / notes.
Otherwise, you can specify the recurrence itself and any parameters you want to set.
From the UI, you can set a recurrence such as "Every hour at 10 minutes past the hour". Optionally,
you can use Cron syntax to configure the recurrence.

Click
Create schedule
to finish creating your schedule.Viewing schedules
Viewing schedules
You can see all schedules from the Schedules page as well as
from each task's page. Opening a schedule takes you to the schedule page to see details and recent
runs.
From the top schedule menu, you can
Execute
the schedule manually, Pause
or Unpause
the
schedule, and more:
Wrapping up
Wrapping up
That's all you need to do to create schedules on Airplane. Once created, a schedule will
automatically queue a run at the configured time, and all scheduled runs are audited and tracked in
the Airplane history.