Documentation
¶
Overview ¶
Package status implements status, sweep and doctor (spec 3.3).
Index ¶
- Constants
- Variables
- func Doctor(e *config.Effective, l state.Layout, out io.Writer) (failed bool)
- func Redactor(e *config.Effective) *redact.Set
- func Sweep(e *config.Effective, l state.Layout, dryRun bool, out io.Writer) error
- type Group
- type Holder
- type IOPressure
- type Memory
- type Pool
- type Report
- type Waiter
Constants ¶
const StaleStaging = 6 * time.Hour
StaleStaging is the age after which sweep removes an artifact staging dir (spec 3.3).
Variables ¶
RemoteDoctor runs the --remote checks. unusable reports a configuration the host cannot run (an agent module_dir that is not a clean git tree): doctor exits 78 for it, not 69.
var RemoteSection func(e *config.Effective) any
RemoteSection fills Report.Remote (set by the remote status code).
var RemoteSweep func(ctx context.Context, e *config.Effective, dryRun bool, provider string, foreign bool, out io.Writer) error
RemoteSweep is the remote part of sweep.
Functions ¶
func Doctor ¶
Doctor prints "ok|warn|fail <check>: <detail>" lines; failed reports any fail (spec 3.3).
func Redactor ¶
Redactor is the set the run path builds from the loaded config: every credential value.
func Sweep ¶
Sweep cleans local state (spec 3.3): dead tickets and their process groups, dead supervisors' records (lost), history rotation, retention and stale artifact staging dirs. It never fails on one bad item: it does all of it and returns nil, except that an aborted container sweep (docs/containers.md) is reported as an unavailable error (exit 69) once the rest is done; its line is already printed.
Types ¶
type Holder ¶
type Holder struct {
Job string `json:"job"`
Slot int `json:"slot"`
Pid int `json:"pid"`
Cwd string `json:"cwd"`
Argv []string `json:"argv"`
Provider string `json:"provider"`
Nested bool `json:"nested"`
Since string `json:"since"`
Units map[string]int `json:"units,omitempty"` // units held per group
Legacy bool `json:"legacy,omitempty"` // a legacy shell-pool caller holds <legacy_dir>/locks/<pool>.<slot>.lock
// Unknown: the slot is in use as far as its ticket or lock file shows, but this host cannot
// read lock holders (no /proc/locks, #24), so it is not known whether anyone holds it.
Unknown bool `json:"unknown,omitempty"`
}
type IOPressure ¶ added in v0.1.7
type IOPressure struct {
FullAvg60 float64 `json:"full_avg60"` // percent, PSI "full avg60" of /proc/pressure/io; 0 when not readable
Readable bool `json:"readable"`
Source string `json:"source"`
Max float64 `json:"max"` // the host's io_pressure_max in percent; 0: none
// Pools holds the limit of each pool whose own io_pressure_max differs from the host's; 0 is a
// pool that turns the check off.
Pools map[string]float64 `json:"pools,omitempty"`
}
IOPressure is the PSI io pressure beside the memory figure. It is present only when some io_pressure_max is configured (the host's or a pool's), so a report without one is unchanged.
type Memory ¶
type Memory struct {
// Applies is false off Linux: there is no memory admission, so only FloorMiB (the configured floor) carries a value; the rest are zero.
Applies bool `json:"applies"`
AvailableMiB int64 `json:"available_mib"`
Readable bool `json:"readable"`
Source string `json:"source"`
FloorMiB int64 `json:"floor_mib"`
}
type Pool ¶
type Pool struct {
Name string `json:"name"`
Slots int `json:"slots"`
Wait string `json:"wait,omitempty"` // the pool's configured wait, in the duration form of spec 5.2
OldestWaitS *int64 `json:"oldest_wait_s,omitempty"` // the longest waiter's waited_s; present only with waiters
Holders []Holder `json:"holders"`
Waiters []Waiter `json:"waiters"`
LastStarved string `json:"last_starved,omitempty"`
}
type Report ¶
type Report struct {
Version string `json:"version"`
Time string `json:"time"`
Pools []Pool `json:"pools"`
Groups []Group `json:"groups"`
Memory Memory `json:"memory"`
// IOPressure is absent unless an io_pressure_max is configured.
IOPressure *IOPressure `json:"io_pressure,omitempty"`
Legacy []string `json:"legacy,omitempty"`
Remote any `json:"remote,omitempty"`
}
Report is `status --json` (docs/status.schema.json).
func Snapshot ¶
Snapshot reads tickets, locks and memory without taking any lock: holders come from /proc/locks on Linux and fcntl(F_GETLK) on darwin (lock.Inspect; neither takes a lock), so a concurrent `--wait 0s` caller or a legacy `flock -n` never sees a lock made busy by status (read-only, best effort). On a Linux without a readable /proc/locks nothing is locked either: the slot or unit shows as unknown (lock.Inspect, #24).
type Waiter ¶
type Waiter struct {
Job string `json:"job"`
Class string `json:"class"` // high | normal
Aged bool `json:"aged,omitempty"` // a normal waiter that has waited priority.aging: it queues as a high one does
Pid int `json:"pid"`
Since string `json:"since"`
WaitedS int64 `json:"waited_s"` // whole seconds from Since to the report's time
Units map[string]int `json:"units,omitempty"` // units asked for per group
Blocking string `json:"group_wait,omitempty"`
Unknown bool `json:"unknown,omitempty"` // as Holder.Unknown: whether its owner is alive is not known
}