Schedule Schedule

yaml
type: "io.kestra.plugin.core.trigger.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. By default, Schedules will use UTC. If you need a different timezone, use the timezone property to update it.

Examples

Schedule a flow every 15 minutes.

yaml
id: scheduled_flow
namespace: company.team

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.plugin.core.trigger.Schedule
    cron: '*/15 * * * *'

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

yaml
id: scheduled_flow
namespace: company.team

tasks:
  - id: log_hello_world
    type: io.kestra.plugin.core.log.Log
    message: Hello World! 🚀

triggers:
  - id: hourly
    type: io.kestra.plugin.core.trigger.Schedule
    cron: "@hourly"

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

yaml
id: scheduled_flow
namespace: company.team

tasks:
  - id: log_hello_world
    type: io.kestra.plugin.core.log.Log
    message: Hello World! 🚀

triggers:
  - id: schedule
    cron: "0 11 * * 1"
    conditions:
      - type: io.kestra.plugin.core.condition.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: company.team

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

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

Properties

cron

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

The cron expression.

A standard unix cron expression with 5 fields (minutes precision). Using withSeconds: true you can switch to 6 fields and a seconds precision. Can also be a cron extension / nickname:

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

withSeconds

  • Type: boolean
  • Dynamic:
  • Required: ✔️
  • Default: false

Whether the cron expression has seconds precision

By default, the cron expression has 5 fields, setting this property to true will allow a 6th fields for seconds precision.

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: Etc/UTC

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
  • Required: ✔️
  • Format: date-time

The date of the current schedule.

next

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

The date of the next schedule.

previous

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

The date of the previous schedule.

Definitions

Was this page helpful?