Skip to content

The daemon's own workflows

The daemon looks after itself with the same parts as everything else: messages about what it notices, and workflows that handle them. They show in itero check, itero runs --all and the log like any other, and a workspace changes or turns them off the same way.

Their types start with itero., which only the daemon may send:

TypeWhenData
itero.daemon.startedthe daemon startsdaemon, name, itero
itero.run.errora run ended in errorworkflow, run, failed_step, why
itero.run.faileda run ended as failedworkflow, run, why
itero.source.gave-upa source kept ending and was given up onsource, why
itero.space.full.itero/ is past its space limitused, limit
itero.log.fullthe log is past its log limitpath, size, limit

A workflow on one is written like any other:

{ "on": [{ "event": "itero.run.error" }],
"steps": [{ "#notify": { "title": "itero", "text": "$workflow: $why" } }] }

A message about a run never starts its own workflow, so a broken workflow cannot set itself off again and again. No run waits for these messages: they only start workflows.

A workflow with "meta": {"internal": true} looks after the workspace rather than doing its work. Nothing in its name says so. Being internal:

  • itero check lists it apart, last;
  • itero runs and GET /runs leave its runs out unless asked (itero runs --all, ?all=true); itero errors shows its errors;
  • its runs do not count against runs, nor it against workflows;
  • its lines in the log carry "internal": true.

itero carries two internal workflows and runs them as if they were in workflows/:

WorkflowOnDoes
keepevery hour, and itero.space.full#forget: forgets ended runs and their messages past keep; all ended ones while space is short
logsitero.log.full#roll-log: itero.log becomes itero.log.1, .1 becomes .2, keeping logs of them

#forget and #roll-log are built-in actions, like #notify.

  • Changing one: a file of its name in workflows/ is used instead, such as workflows/logs.json rolling the log and then sending the oldest away:

    { "meta": { "internal": true },
    "on": [{ "event": "itero.log.full" }],
    "steps": ["#roll-log", "#upload-old-logs"] }
  • Turning one off: that file with "meta": {"off": true}.

itero.toml’s [limits] (itero.toml):

  • past runs under way, a message that would start a run waits its turn;
  • past workflows, itero check and each of the daemon’s passes stop with an error naming the limit;
  • past space, the daemon sends itero.space.full and logs an error; keep forgets what it can, and until there is room no new run starts but internal ones;
  • past log, the daemon sends itero.log.full once, and again after the log is rolled and fills up.