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:
hourctl action office CG0001 upsert_user user_id=1001 name="Ana Diaz"hourctl action office CG0001 reboothourctl action show office CG0001 42Commands:
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, ashourctl actionorhourctl actionsprinted it.
Example:
hourctl action show office CG0001 42hourctl 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, ashourctl actionorhourctl actionsprinted 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 itscommand.unansweredevent) and the action fails with them. For a device that is not coming back: nothing else ends what it holds.
Examples:
hourctl action cancel office CG0001 42hourctl action cancel office CG0001 42 --give-uphourctl 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:
hourctl actions office CG0001hourctl 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:
hourctl job create volume.tomlhourctl 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:
hourctl job show 12hourctl job list
List the jobs, newest first, with how many devices are where.
hourctl job list [OPTIONS]Example:
hourctl job listhourctl 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:
hourctl job pause 12hourctl 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:
hourctl job resume 12hourctl 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:
hourctl job advance 12hourctl 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:
hourctl job cancel 12hourctl 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:
hourctl job retry-failed 12