Skip to content

hourctl: actions and jobs

Ask a device to do something, follow or cancel what it was asked, or run one action over many devices in waves (a job).

Every hourctl command also takes the connection options.

hourctl action

Queue an action for a device, or show or cancel one.

hourctl action ENDPOINT DEVICE ACTION [KEY=VALUE]... queues ACTION: a standard action the device’s package offers (hourctl device actions lists them), or one of the package’s commands, which runs as an action of one step. Its steps go to the device in order, after what already waits in the same lane. Prints the action’s id, status and the ids of its commands. An action that writes data the device’s sync group keeps is refused: write that data with hourctl sync.

Parameter values: a number or true/false is sent as one, a value that starts with [ or { and reads as JSON is sent as that JSON, and anything else as text. Quote a value with spaces.

hourctl action [OPTIONS] <ENDPOINT> <DEVICE> [ACTION] [KEY=VALUE]...
hourctl action <COMMAND>

Arguments:

  • <ENDPOINT>: The device’s endpoint (its id), e.g. office.
  • <DEVICE>: The device’s serial number, e.g. CG0001.
  • [ACTION]: The action: a standard action the device’s package offers, or one of its commands, e.g. upsert_user or reboot.
  • [KEY=VALUE]...: The action’s parameters, as KEY=VALUE. A value that is a JSON list or object is sent as that JSON, a number or true/false as one, anything else as text.

Options:

  • --steps <JSON>: The action’s steps, listed instead of named (ACTION): a JSON list of {"action": "...", "params": {...}}, as JSON itself, @FILE, or - for stdin. Each is judged as it would be alone and they are queued in order as one action; if any is refused, none is queued.

    hourctl action office CG0001 --steps @steps.json

  • --key <REQUEST_KEY>: Your own id for this request: sending the same key again returns the action it queued the first time instead of queuing another.

  • --lane <LANE>: The lane its steps queue in. Default: interactive. One of: interactive (What an operator or an API caller asked for. The default), bulk (Large fills: backfill, inventory, resync. Goes after everything else).

Examples:

Terminal window
hourctl action office CG0001 upsert_user user_id=1001 name="Ana Diaz"
hourctl action office CG0001 reboot
hourctl action show office CG0001 42

Commands:

  • show: Show one action and each of its steps.
  • cancel: Cancel an action: its steps not yet handed to the device never go.

hourctl action show

Show one action and each of its steps.

Prints the action’s status (and the step it failed at), its lane, reason and parameters (a secret only as its size), then each step: its command id, command, status, tries, parameters and result. An action that waits for a held device says so, and why.

hourctl action show [OPTIONS] <ENDPOINT> <DEVICE> <ID>

Arguments:

  • <ENDPOINT>: The device’s endpoint (its id), e.g. office.
  • <DEVICE>: The device’s serial number, e.g. CG0001.
  • <ID>: The action’s id, as hourctl action or hourctl actions printed it.

Example:

Terminal window
hourctl action show office CG0001 42

hourctl action cancel

Cancel an action: its steps not yet handed to the device never go.

Steps already handed to the device cannot be recalled and report as usual, unless you give up on them (--give-up). Prints which commands were taken back and which were already sent.

hourctl action cancel [OPTIONS] <ENDPOINT> <DEVICE> <ID>

Arguments:

  • <ENDPOINT>: The device’s endpoint (its id), e.g. office.
  • <DEVICE>: The device’s serial number, e.g. CG0001.
  • <ID>: The action’s id, as hourctl action or hourctl actions printed it.

Options:

  • --give-up: Also give up on the steps already handed to the device that it has not answered: each is marked unanswered (with its command.unanswered event) and the action fails with them. For a device that is not coming back: nothing else ends what it holds.

Examples:

Terminal window
hourctl action cancel office CG0001 42
hourctl action cancel office CG0001 42 --give-up

hourctl actions

List a device’s actions, oldest first.

Prints the latest 500 actions of the device: id, action, status, number of steps, lane and when it was queued. hourctl action show shows one with its steps. When actions wait and the device is held, a last line says so and why.

hourctl actions [OPTIONS] <ENDPOINT> <DEVICE>

Arguments:

  • <ENDPOINT>: The device’s endpoint (its id), e.g. office.
  • <DEVICE>: The device’s serial number, e.g. CG0001.

Example:

Terminal window
hourctl actions office CG0001

hourctl job

Run one action over many devices, in waves: create, list, show and steer jobs.

A job runs an action on every device its targets match, a wave at a time, within an optional time window, and pauses itself when too many devices fail.

hourctl job [OPTIONS] <COMMAND>

Commands:

  • create: Create a job from a TOML file, and start it.
  • show: Show one job: where it stands, and every device.
  • list: List the jobs, newest first, with how many devices are where.
  • pause: Pause a running job: no device starts; those running go on to their end.
  • resume: Resume a paused job, paused by hand or by its abort threshold.
  • advance: Start the next wave, whatever became of the current one.
  • cancel: Cancel a job: devices not started never will be, and the actions of those running are taken back.
  • retry-failed: Queue the devices that failed or timed out again, each as a new attempt.

hourctl job create

Create a job from a TOML file, and start it.

The file says: action (a standard action, or a package action or command), params, lane (interactive or bulk), [targets] (select, a selector over device labels; endpoints; devices, as “endpoint/device”), [rollout] (waves, sizes as counts or shares such as “25%”; max_concurrent; advance, auto or manual), [window] (days, and hours as “22:00-05:00” in each device’s own zone), timeout (per device, as seconds or “30m”; none: no deadline) and [abort] (failed_percent, after: the job pauses when that share of the devices finished so far failed). The devices the targets match are found now. Prints the job’s id, action, devices and waves.

hourctl job create [OPTIONS] <FILE>

Arguments:

  • <FILE>: The job file (TOML).

Example:

Terminal window
hourctl job create volume.toml

hourctl job show

Show one job: where it stands, and every device.

Prints the job’s state, wave and device counts, then each device: its wave, state, attempt, action id, zone and detail.

hourctl job show [OPTIONS] <ID>

Arguments:

  • <ID>: The job’s id.

Example:

Terminal window
hourctl job show 12

hourctl job list

List the jobs, newest first, with how many devices are where.

hourctl job list [OPTIONS]

Example:

Terminal window
hourctl job list

hourctl job pause

Pause a running job: no device starts; those running go on to their end.

hourctl job pause [OPTIONS] <ID>

Arguments:

  • <ID>: The job’s id.

Example:

Terminal window
hourctl job pause 12

hourctl job resume

Resume a paused job, paused by hand or by its abort threshold.

hourctl job resume [OPTIONS] <ID>

Arguments:

  • <ID>: The job’s id.

Example:

Terminal window
hourctl job resume 12

hourctl job advance

Start the next wave, whatever became of the current one.

This is how a job with advance = “manual” moves on.

hourctl job advance [OPTIONS] <ID>

Arguments:

  • <ID>: The job’s id.

Example:

Terminal window
hourctl job advance 12

hourctl job cancel

Cancel a job: devices not started never will be, and the actions of those running are taken back.

Steps already handed to a device report as usual, and the device ends as its action does.

hourctl job cancel [OPTIONS] <ID>

Arguments:

  • <ID>: The job’s id.

Example:

Terminal window
hourctl job cancel 12

hourctl job retry-failed

Queue the devices that failed or timed out again, each as a new attempt.

A job that had completed runs again.

hourctl job retry-failed [OPTIONS] <ID>

Arguments:

  • <ID>: The job’s id.

Example:

Terminal window
hourctl job retry-failed 12