Schedule Schedule

yaml
type: "io.kestra.core.models.triggers.types.Schedule"

Schedule a flow based on a CRON expression.

You can add multiple schedule(s) to a flow. The scheduler keeps track of the last scheduled date, allowing you to easily backfill missed executions. Keep in mind that if you change the trigger ID, the scheduler will consider this as a new schedule, and will start creating new scheduled executions from the current date.

Examples

Schedule a flow every 15 minutes.

yaml
id: scheduled_flow
namespace: dev

tasks:
  - id: sleep_randomly
    type: io.kestra.plugin.scripts.shell.Commands
    runner: PROCESS
    commands:
      - echo "{{ execution.startDate ?? trigger.date }}"
      - sleep $((RANDOM % 60 + 1))

triggers:
  - id: every_15_minutes
    type: io.kestra.core.models.triggers.types.Schedule
    cron: '*/15 * * * *'

Schedule a flow every hour using the cron nickname @hourly.

yaml
triggers:
  - id: hourly
    type: io.kestra.core.models.triggers.types.Schedule
    cron: "@hourly"

Schedule a flow on the first Monday of the month at 11 AM.

yaml
triggers:
  - id: schedule
    cron: "0 11 * * 1"
    conditions:
      - type: io.kestra.core.models.conditions.types.DayWeekInMonthCondition
        date: "{{ trigger.date }}"
        dayOfWeek: "MONDAY"
        dayInMonth: "FIRST"

Schedule a flow every day at 9:00 AM and pause a schedule trigger after a failed execution using the stopAfter property.

yaml
id: business_critical_flow
namespace: production

tasks:
  - id: important_task
    type: io.kestra.core.tasks.log.Log
    message: "if this run fails, disable the schedule until the issue is fixed"

triggers:
  - id: stop_after_failed
    type: io.kestra.core.models.triggers.types.Schedule
    cron: "0 9 * * *"
    stopAfter:
      - FAILED

Properties

cron

  • Type: string
  • Dynamic:
  • Required: ✔️

The cron expression.

A standard unix cron expression without second. Can also be a cron extension / nickname:

  • @yearly
  • @annually
  • @monthly
  • @weekly
  • @daily
  • @midnight
  • @hourly

backfill

  • Type: object
  • Dynamic:
  • Required:

(Deprecated) Backfill

This property is deprecated and will be removed in the future. Instead, you can now go to the Triggers tab and start a highly customizable backfill process directly from the UI. This will allow you to backfill missed scheduled executions by providing a specific date range and custom labels. Read more about it in the Backfill documentation.

conditions

  • Type: array
  • SubType: Condition
  • Dynamic:
  • Required:

List of conditions in order to limit the flow trigger.

inputs

  • Type: object
  • Dynamic: ✔️
  • Required:

The inputs to pass to the scheduled flow.

lateMaximumDelay

  • Type: string
  • Dynamic:
  • Required:
  • Format: duration

The maximum delay that is accepted.

If the scheduled execution didn't start after this delay (e.g. due to infrastructure issues), the execution will be skipped.

recoverMissedSchedules

  • Type: string
  • Dynamic:
  • Required:
  • Possible Values:
    • LAST
    • NONE
    • ALL

What to do in case of missed schedules

ALL will recover all missed schedules, LAST will only recovered the last missing one, NONE will not recover any missing schedule. The default is ALL unless a different value is configured using the global plugin configuration.

scheduleConditions

(Deprecated) Conditions on date. Use conditions instead.

List of schedule conditions in order to limit the schedule trigger date.

stopAfter

  • Type: array
  • SubType: string
  • Dynamic:
  • Required:

List of execution states after which a trigger should be stopped (a.k.a. disabled).

timezone

  • Type: string
  • Dynamic:
  • Required:
  • Default: Europe/Paris

The time zone identifier (i.e. the second column in the Wikipedia table) to use for evaluating the cron expression. Default value is the server default zone ID.

Outputs

date

  • Type: string
  • Dynamic:
  • Required: ✔️
  • Format: date-time

The date of the current schedule.

next

  • Type: string
  • Dynamic:
  • Required: ✔️
  • Format: date-time

The date of the next schedule.

previous

  • Type: string
  • Dynamic:
  • Required: ✔️
  • Format: date-time

The date of the previous schedule.