Skip to content

Scheduling

Ciaren has a lightweight, in-process scheduler that runs a flow on a cron schedule, with no broker or extra service. It suits simple recurring jobs. It is not an Airflow or dbt replacement.

How it runs

The scheduler is a single asyncio poller that starts inside the API process. ciaren serve runs both. To run the API without it, use ciaren serve --no-scheduler or CIAREN_SCHEDULER_ENABLED=false.

Creating a schedule

Click Schedule in the flow editor toolbar, or go to the Schedules page, to open the schedule builder:

New schedule dialog: frequency picker (Minutes/Hourly/Daily/Weekly/Monthly/Custom cron), time of day, timezone, engine, and Enabled toggle

Schedules page: list of saved schedules with cron expressions, next run times, recent run history, and status

The Recent runs column shows each schedule's last five runs as status icons (oldest to newest), so you can spot a flaky or failing schedule at a glance. Click an icon to open that run in the run detail view.

The picker shows a plain-language summary and the cron expression as you switch between presets and Custom (cron). Minutes fires every N minutes (1 to 59), and Hourly fires once an hour at a chosen minute:

Switching the schedule frequency across Minutes, Daily, Weekly, Monthly, and Custom (cron): the human-readable summary and cron expression update live

Pick a frequency or enter a cron expression, then a timezone. Over the API, the same schedule looks like this:

bash
curl -X POST http://localhost:8055/api/flows/{flow_id}/schedules \
  -H "Content-Type: application/json" \
  -d '{
        "cron": "0 7 * * *",
        "timezone": "America/New_York",
        "engine": "polars",
        "is_enabled": true,
        "catch_up": false,
        "max_retries": 2,
        "retry_delay_seconds": 60
      }'
FieldDefaultDescription
cronNone (required)Standard 5-field cron expression
timezoneUTCIANA timezone used to interpret the cron
name / descriptionnullOptional labels
enginenullEngine for scheduled runs; falls back to the server default
is_enabledtrueWhether the schedule is active
catch_upfalseRun slots missed while the server was down
max_retries0Retries for a failed run before giving up to the next slot (max 10)
retry_delay_seconds60Base backoff between retries
run_timeout_secondsnullPer-schedule run timeout override; falls back to RUN_TIMEOUT_SECONDS (0 = no limit)
parametersnullFlow-parameter overrides applied to every run this schedule fires

A schedule runs the flow as it was last saved. A change saved from a Flow assistant proposal, or a reversal in its Activity list, applies from the next slot.

Parameterized flows

If the flow declares parameters, the schedule form has a Parameter values section. The values apply to every run the schedule fires, and blanks fall back to each parameter's default. One flow can back several schedules that differ only in their parameter values.

Lifecycle overview

Scheduler lifecycle
  1. Trigger
    Cron fires
    Poller wakes every 30 s, checks next_run_at
  2. Run
    Run executes
    Flow runs on the engine; concurrent limit respected
On success
  1. Success
    Run recorded
    next_run_at advances to the next cron slot
  2. Idle
    Wait for next slot
    Failure streak resets
On failure
  1. Failed
    Failure streak increments
  2. Retry
    Retry (if max_retries > 0)
    Exponential backoff, capped at 1 h
  3. Disabled
    Auto-disable (after 5 failures)
    Re-enable in the UI to clear the streak

How it decides what to run

Each schedule stores its next_run_at (a UTC timestamp) in the database. It is the single source of truth, so schedules survive restarts with no separate job store. The poller wakes every SCHEDULER_POLL_INTERVAL_SECONDS (30 by default), runs whatever is due, and computes the next slot.

Scheduled runs are recorded like any other run, tagged with their trigger and schedule_id. Browse them via GET /api/schedules/{id}/runs or GET /api/runs?schedule_id=..., and they open in the normal run detail view.

Reliability behaviors

  • Concurrency and overlap. Scheduled runs are capped at SCHEDULER_MAX_CONCURRENT_RUNS (1 by default). A schedule skips a slot while its previous run is still going, so runs never pile up.
  • Catch-up. If the server was down across one or more slots, catch_up decides whether the flow runs when it returns. With it on, the flow runs once to cover the missed slots, not once per slot. With it off (the default), Ciaren skips to the next future slot.
  • Retries. A failed run retries up to max_retries times with exponential backoff from retry_delay_seconds, capped at 1 hour. Then the schedule waits for the next cron slot.
  • Auto-disable. After SCHEDULER_MAX_CONSECUTIVE_FAILURES consecutive failed runs (5 by default), the schedule is disabled and records a disabled_reason. Re-enabling it clears the streak. A run you cancel does not count as a failure.
  • Alerts. Set CIAREN_NOTIFY_WEBHOOK_URL to get a message when a run fails or a schedule disables itself. See Failure notifications.
  • Orphan recovery. On startup, runs left in running by a crash are marked failed, because a single process cannot resume them.
  • Run now. POST /api/schedules/{id}/run-now starts an immediate one-off run that stays outside the retry and auto-disable logic.

Configuration

SettingDefaultDescription
CIAREN_SCHEDULER_ENABLEDtrueMaster on/off switch
CIAREN_SCHEDULER_POLL_INTERVAL_SECONDS30How often the poller wakes
CIAREN_SCHEDULER_MAX_CONCURRENT_RUNS1Max simultaneous scheduled runs
CIAREN_SCHEDULER_MAX_CONSECUTIVE_FAILURES5Failures before auto-disable (0 = never)

Limitations

  • One schedule runs one flow. There are no dependencies between flows.
  • The scheduler is single-process. For high availability or distributed scheduling, export the flow's Python and run it under your own orchestrator.

See also