Documentation
¶
Overview ¶
Package status implements status, sweep and doctor (spec 3.3).
Index ¶
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).
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
}
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"`
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.HeldRO; 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; except on a Linux without /proc/locks, see lock.HeldRO).
type Waiter ¶
type Waiter struct {
Job string `json:"job"`
Class string `json:"class"` // high | normal
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"`
}