Corbie

Tasks

Schedules

A statechart waits for a timer and then starts the work as a job.

Corbie has no scheduler: recurring work is a statechart with two states.

# nightly.yaml

statechart: nightly
initial: idle

states:
  idle:
    timers: { evening: "18:00" }
    on: { evening: working }
  working:
    job: { script: ./work.js }
    on:
      done: idle
      failed: idle

// work.js

log("the nightly work")
corbie init --ceiling allcorbie start &corbie run submit nightly.yamlcorbie run show <id>

At 18:00 UTC the timer evening is due and the statechart moves to working, and back to idle when the job ends. Without failed: idle, a job that fails ends the run as failed and the schedule stops. corbie run show <id> prints the run as running, with waiting on 1 timer, until corbie run cancel <id> ends it.

A timer's time is a length of time or a time of day.

90s, 48h, 7da length of time, from when the statechart enters the state "18:00"a time of day in UTC, due at its next occurrence "mon 09:00"a time on one day of the week "09:00 Europe/London"a time of day in a named time zone "${input.at}"one of these, from input, when the state is entered

No job runs while the statechart waits. A timer that came due while no controller was running is delivered when one starts. A running controller delivers a timer at most this late.

started with corbie startits --interval (default 2s) as a serverless functionone minute

Reference

  • Statechart every field of a state, timers: among them
  • Definitions a job's fields, such as input, restart and timeout
  • Runs listing runs, and cancelling one
  • Functions running a controller as a serverless function