status

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2026 License: MIT Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package status implements status, sweep and doctor (spec 3.3).

Index

Constants

View Source
const StaleStaging = 6 * time.Hour

StaleStaging is the age after which sweep removes an artifact staging dir (spec 3.3).

Variables

View Source
var RemoteDoctor func(e *config.Effective, out io.Writer) (failed, unusable bool)

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.

View Source
var RemoteSection func(e *config.Effective) any

RemoteSection fills Report.Remote (set by the remote status code).

View Source
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

func Doctor(e *config.Effective, l state.Layout, out io.Writer) (failed bool)

Doctor prints "ok|warn|fail <check>: <detail>" lines; failed reports any fail (spec 3.3).

func Redactor

func Redactor(e *config.Effective) *redact.Set

Redactor is the set the run path builds from the loaded config: every credential value.

func Sweep

func Sweep(e *config.Effective, l state.Layout, dryRun bool, out io.Writer) error

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 Group

type Group struct {
	Name  string `json:"name"`
	Units int    `json:"units"`
	Held  []int  `json:"held"`
	// Unknown lists the units whose holder cannot be read (no /proc/locks, #24).
	Unknown []int `json:"unknown,omitempty"`
}

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 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"`
	Legacy  []string `json:"legacy,omitempty"`
	Remote  any      `json:"remote,omitempty"`
}

Report is `status --json` (docs/status.schema.json).

func Snapshot

func Snapshot(e *config.Effective, l state.Layout, only []string) Report

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).

func (Report) Text

func (r Report) Text(w io.Writer)

Text prints the report for people.

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL