Skip to content

Jobs

A job runs one action over many devices: a firmware upgrade, a settings change, a reboot. You name the action and the devices. The job starts them in waves, inside a time window in each device’s own time zone. It pauses itself when too many fail.

Each device runs the action as an ordinary action. Its steps, lanes, results and action.result event work as for any other action. You can use any action a device’s package offers. It can be a standard action or one of the package’s own. A firmware upgrade, for example, is a package action. Its firmware URL is a parameter you give it.

  1. Write a job file:

    name = "volume down"
    action = "set_settings"
    params = { values = { volume = 70 } }
    [targets]
    select = "site = north"
    [rollout]
    waves = [1, "10%", "50%"]
  2. Create the job. The answer lists every device it matched:

    Terminal window
    hourctl job create volume-down.toml
  3. Follow it:

    Terminal window
    hourctl job show <ID>
    hourctl job list
  4. Act on it when needed: hourctl job pause, resume, advance, cancel or retry-failed (commands).

hourctl job create <file.toml> reads a TOML file. POST /api/tenants/{tenant}/jobs takes the same fields as JSON. Unknown fields are refused.

name = "volume down" # for people; not unique
action = "set_settings" # what each device runs
params = { values = { volume = 70 } }
lane = "interactive" # or "bulk"
timeout = "30m" # seconds, or "90s", "30m", "2h", "1d"
[targets]
select = "site = north and floor in (1, 2)"
endpoints = ["office"]
devices = ["lobby/<DEVICE>"] # "endpoint/device"
[rollout]
waves = [1, "10%", "50%"]
max_concurrent = 5
advance = "auto" # or "manual"
[window]
days = ["sat", "sun"]
hours = "22:00-05:00"
[abort]
failed_percent = 20
after = 10
FieldDefaultMeaning
namenoneA name for people. Not unique.
actionrequiredThe action each device runs.
params{}The action’s parameters, by name.
laneinteractiveThe lane each device’s action queues in: interactive or bulk.
timeoutnoneHow long each device has, from when its action starts. Any positive duration. With none set, there is no deadline.
targetsrequiredWhich devices (targets).
rollout.wavesone waveWave sizes (rollout).
rollout.max_concurrentno limitDevices running at once, at least 1.
rollout.advanceautoauto or manual.
window.daysevery daymon to sun, or the full names, in any case.
window.hoursthe whole dayHH:MM-HH:MM, local time.
abort.failed_percentnone1 to 100 (abort).
abort.after1Finished devices before the threshold applies.

The targets are resolved once, when the job is created. Give at least one of select, endpoints and devices.

  • With select or endpoints, the job takes the allowed devices of those endpoints. When no endpoint is named, it takes every endpoint.
  • Of those devices, it keeps the ones the selector picks by their labels. Two examples are site = north and floor in (1, 2) and region ^= west/nevada and kind != kiosk.
  • A device’s labels are its endpoint’s labels, with its own labels laid over them. This works as in sync group placement.
  • With select, a selector that is not valid refuses the job. The refusal names its column.
  • An unknown endpoint in endpoints refuses the job.
  • The devices in devices are added. Those not known or not allowed are listed in the job’s missing.

The job’s matched says how many devices it runs on. Devices are taken in (endpoint, device) order.

A job is refused (400) when:

  • it matches no allowed device, or more than 100 000.
  • the package of an endpoint it matched offers no such action or command.
  • its parameters hold a value the action marks sensitive, such as a password or a key. A job keeps its parameters to start each device’s action. Send such values as individual actions instead.
  • the action writes data that a matched endpoint’s sync group keeps. Write that data through the sync API instead.

Parameters are checked against the action’s declaration as each device’s action starts. A device whose action cannot be started fails, and its detail says why. This includes an action that carries biometric data of a person their group refuses (biometrics).

waves gives each wave’s size, in order. A size is one of:

  • A count, such as 5.
  • A share of all matched devices, such as "10%" (1% to 100%). It is rounded up and never less than one.

A size larger than the devices left takes what is left. Waves after the devices run out are dropped. Devices left over after the last wave make one more wave. Without waves, there is one wave of every device.

Devices of the current wave and of earlier waves start as max_concurrent allows.

advanceThe next wave starts when
autoEvery device of the current wave succeeded (several waves may pass at once), or you run advance.
manualYou run advance.

advance moves to the next wave whatever became of the current one.

Devices start only while the window is open in their own time zone. The window is open:

  • on the days given (every day when none are given).
  • within the hours (the whole day when none are given).

A window gives days, hours or both. The end of hours is excluded. 24:00 may end it. The same start and end means the whole day. Hours that run past midnight belong to the day they start on. For example, days = ["sat"] with hours = "22:00-05:00" is open from Saturday 22:00 to Sunday 05:00. A device already running continues when the window closes.

Each device’s zone is fixed when the job is created. It is the first of these that applies:

  1. its endpoint’s timezone option;
  2. else the */timezone setting of its sync group, if the group keeps settings;
  3. else UTC.

A zone is an IANA name (America/Chicago) or a fixed offset (+02:00). The job’s no_zone counts devices with no zone of their own. It appears in POST /api/tenants/{tenant}/jobs and GET /api/tenants/{tenant}/jobs/{id}. hourctl job show shows their zone as UTC (none).

A job with no timeout has no deadline. Each device’s action waits until one of these happens:

  • The device answers.
  • Its commands are lost, either by the order of its answers or because its package says it restarted. See lost commands.
  • You cancel the action or give up on it.

With a timeout, each device’s action is started with an expiry. The expiry is timeout after the device starts. It happens at exactly that instant, not after a wait:

  • Steps not handed to the device are cancelled.
  • Steps in the device’s hand are given up on, as when an app gives up. Each ends unanswered, with its command.unanswered event. The action fails with them.
  • The device is timed_out. An answer that comes later changes nothing for the job.

If the device answered that the action failed, the device is failed, whenever it failed.

A held device is not handed its steps. The job takes its action back. The device fails with the detail the device is held: ....

A running job pauses when both of these are true:

  • after devices have finished. Succeeded, failed and timed out devices count as finished. Cancelled ones are not counted.
  • failed_percent or more of the finished devices failed or timed out.

Its reason then reads, for example, abort threshold: 3 of 10 finished devices failed or timed out (abort at 20%).

After a resume, the job pauses again only when more devices have failed or timed out than when it was resumed.

queued waiting_window running succeeded failed timed_out cancelled its turn window closed opens job cancelled retry-failed: queued again as the next attempt
Queued and waiting devices are cancelled with the job too. A device already running when the window closes carries on.
StateMeaning
queuedIts wave has not started, or there is no room yet (max_concurrent).
waiting_windowIts turn, but the window is closed in its zone.
runningIts action is started.
succeededIts action finished successfully.
failedIts action failed, or could not be started.
timed_outIts action did not finish by the job’s timeout.
cancelledThe job was cancelled before it finished.

An execution’s detail says what went wrong, as its action’s reason does. An example is step 2 (verify) failed: the device answered -1. Steps are counted from 1. Or detail says what the execution waits for. An example is waiting for window (opens 2026-10-04 22:00 America/Chicago). That is the window’s next opening in the device’s zone. attempt starts at 1 and increases with each retry-failed. held is shown when the device is held.

StateMeaning
runningDevices start as the rollout and window allow.
pausedNo device starts. Devices already running continue to their end.
cancelledDevices not started never will be.
completedEvery device has finished. A paused job also completes.

The job’s reason says what paused or cancelled it. For a running job, it says what the job waits for:

reasonCause
paused by <user>pause
cancelled by <user>cancel
abort threshold: ...The abort threshold.
wave 2 has devices that did not succeed: retry-failed, advance or cancelA wave finished with failures.
wave 1 succeeded: waiting to be told to advanceA manual wave succeeded.
waiting for window (opens ...)Nothing is running and devices wait for the window.

Waves are numbered from 1 in these texts and in hourctl job show. They are numbered from 0 in the wave field of the API and events.

CommandApplies toEffect
pausea running jobNo device starts. Those running continue to their end.
resumea paused jobThe job runs again.
advancea running or paused job not at its last waveThe next wave may start, whatever became of the current one.
cancela job not completed or cancelledDevices queued or waiting are cancelled. The actions of running devices are taken back. Steps already handed out report as usual. The device ends as its action does.
retry-faileda job, not cancelled, with devices that failed or timed outThose devices are queued again in their wave, as their next attempt with a new action. A completed job runs again. A paused one stays paused.

A command that does not apply to the job as it is is answered 409, with the reason. You can send a command to any instance. It changes the job in the database, and the job’s leader continues from there.

One instance runs each job at a time. Everything about the job is kept in the database:

  • When that instance stops, another takes the job over where it was, within about 10 seconds.
  • After a restart of the whole cluster, unfinished jobs continue.
  • A device’s action is never started twice for the same attempt. Each action carries origin job:<id>.

A job’s first devices start just after it is created. The create answer shows them still queued.

A job reports what it does in events (job events) with package "houradvantage".

EventSent toWhen
job.startedevery endpoint the job has devices on (device "")The job is created.
job.pausedsamePaused by a command or the abort threshold.
job.resumedsameResumed, or a completed job run again by retry-failed.
job.wavesameThe current wave advanced.
job.cancelledsameCancelled.
job.completedsameEvery device finished.
job.execution.startedthe device’s endpointA device started.
job.execution.succeededsameA device succeeded.
job.execution.failedsameA device failed.
job.execution.timed_outsameA device timed out.
job.execution.cancelledsameA device was cancelled.

Job events carry job_id, action, state, wave, and name when set. The job’s own events add waves, counts and reason. A device’s events add attempt, action_id and detail. An endpoint may drop any of them with drop_events. Each device’s action also sends its own action.result, with origin job:<id>.

A sink that names no events is sent only job.paused and job.completed of these. The others go only to a sink that names them (the default set).

Every change made through the API is in the audit trail. A pause by the abort threshold is recorded too, by user houradvantage, as job.paused.

APIhourctl
POST /api/tenants/{tenant}/jobs (201, with every device it matched)hourctl job create <file.toml>
GET /api/tenants/{tenant}/jobs?limit= (newest first, 500 at most and by default)hourctl job list
GET /api/tenants/{tenant}/jobs/{id} (with every device in executions; 404 if unknown)hourctl job show <id>
POST /api/tenants/{tenant}/jobs/{id}/pausehourctl job pause <id>
POST /api/tenants/{tenant}/jobs/{id}/resumehourctl job resume <id>
POST /api/tenants/{tenant}/jobs/{id}/advancehourctl job advance <id>
POST /api/tenants/{tenant}/jobs/{id}/cancelhourctl job cancel <id>
POST /api/tenants/{tenant}/jobs/{id}/retry-failedhourctl job retry-failed <id>

Each job shows counts: how many devices are in each state. hourctl job show lists every device with its wave, state, attempt, action, zone and detail. hourctl job list lists every job with its counts.