Scheduling


# Overview

The Zenaton scheduler allows us to create schedules to run tasks and workflows on a recurrent basis.

Normally we would immediately dispatch a workflow or a task but we can also create a schedule so that the workflow or task is automatically dispatched at defined occurrences.

This is useful for processes that you would normally run using cron jobs, for example:

  • generate daily / weekly / monthly reports
  • update cached data on a regular basis
  • cleanup a database every week
  • launch a website scraping workflow every night

The Zenaton scheduler provides a straightforward way to launch recurrent tasks and workflows by writing it into our code. The scheduler can provide an added level of dependability when combined with other Zenaton features such as automatic retry and alerting.

# Creating Schedules

See How to schedule tasks and workflows.

# Managing Schedules

We can pause, resume and delete any created schedules on the Schedules tab on your dashboard.

scheduling-dashboard

When a schedule is paused, future instances of the task or workflow will not be dispatched until the schedule has been resumed.

When a schedule has been deleted, no new instances of the task or workflow will be dispatched and the schedule will disapear on your dashboard. If we want to schedule your task or workflow afterward, we would need to create a new schedule.

WARNING

The scheduler will dispatch tasks or workflows even if the previous execution isn’t completed.

Automatic Retry And Scheduling

Automatic-retry can lead to overlaps, we should setup our retry policy according to the schedule occurence to avoid that.

# Cron Format

When scheduling, we need to pass a cron string. Zenaton uses the following cron format to schedule tasks and workflows:


 * * * * * *
 | | | | | |
 | | | | | +-- Year                range: 1970-2099         wildcards: , - * /
 | | | | +---- Day of the Week     range: 0-6 or SUN-SAT    wildcards: , - * L #
 | | | +------ Month of the Year   range: 1-12 or JAN-DEC   wildcards: , - * /
 | | +-------- Day of the Month    range: 1-31              wildcards: , - * / L W
 | +---------- Hour                range: 0-23              wildcards: , - * /
 +------------ Minute              range: 0-59              wildcards: , - * /

 Supported alias are:
 - @minutely   run once a minute
 - @hourly     run once an hour
 - @daily      run once a day
 - @midnight   run once a day, same as @daily
 - @monthly    run once a month
 - @weekly     run once a week
 - @yearly     run once a year
 - @annually   run once a year, same as @yearly

All schedules use UTC time zone and the minimum precision for schedules is 1 minute.

View cron expression reference for more informations.

We can also use crontab guru to help you build your cron expressions.