Documentation
¶
Overview ¶
Package marker records what a load run's real tasks did, in files under a directory the harness owns: one exec file per process the no-op command started, refreshed while the process lives, and one output file per task key, appended to by every process that writes the task's output. The chaos checks read them to find a process that outlived its worker and an output that two attempts wrote at once.
Index ¶
- Constants
- func ConfigArg(path string) string
- func NewID() (string, error)
- func Output(dir, key, execID string, at time.Time) error
- func Outputs(dir string) (map[string][]OutputLine, error)
- func WriteConfig(path string, cfg NoopConfig) error
- type Exec
- type NoopClass
- type NoopConfig
- type OutputLine
- type Writer
Constants ¶
const ( RoleMain = "main" // the task's own process RoleChatty = "chatty" // a child printing to the task's stdout RoleSilent = "silent" // a child with no stdio of the task's )
The roles of an exec.
const ( ExecsDir = "execs" // one <exec id>.json per process OutputsDir = "outputs" // <key hash>.out and <key hash>.key per task key LogsDir = "logs" // the silent children's stdio files )
The marker directory's subdirectories.
const ConfigArgPrefix = "--sqi-load-config="
ConfigArgPrefix starts the no-op command's argument naming its noop.json. The managed target puts it first when a job class has real_task; without it the no-op prints one line and exits.
const RefreshInterval = 250 * time.Millisecond
RefreshInterval is how often a live exec's LastSeen is rewritten.
Variables ¶
This section is empty.
Functions ¶
func Output ¶
Output appends "<execID> <RFC3339Nano>\n" to <dir>/outputs/<hex sha256(key)[:16]>.out, and remembers key in <dir>/outputs/<same>.key on first use. Writers of one key may make their first call at once.
func Outputs ¶
func Outputs(dir string) (map[string][]OutputLine, error)
Outputs reads every output file in dir: key -> lines in file order. A line cut short by a writer that died mid-write is skipped.
func WriteConfig ¶
func WriteConfig(path string, cfg NoopConfig) error
WriteConfig writes cfg to path.
Types ¶
type Exec ¶
type Exec struct {
ID string `json:"id"` // random, unique per process
Key string `json:"key"` // the task key, see scenario.KeyArg
Incarnation string `json:"incarnation"` // SQILOAD_INCARNATION
Role string `json:"role"` // "main", "chatty" or "silent"
PID int `json:"pid"`
PGID int `json:"pgid"` // 0 on Windows
Start time.Time `json:"start"`
LastSeen time.Time `json:"last_seen"` // refreshed every 250ms while alive
End *time.Time `json:"end,omitempty"`
ExitCode int `json:"exit_code"`
}
Exec is one process the no-op started: the main task process or a child.
type NoopClass ¶
type NoopClass struct {
DurationMS int `json:"duration_ms"`
LogEveryMS int `json:"log_every_ms"`
ChattyChild bool `json:"chatty_child"`
SilentChild bool `json:"silent_child"`
// ScratchBytes is how many bytes the main process writes to scratch.bin
// in its working directory over the duration.
ScratchBytes int64 `json:"scratch_bytes"`
}
NoopClass is one class's real_task.
type NoopConfig ¶
type NoopConfig struct {
MarkerDir string `json:"marker_dir"`
Classes map[string]NoopClass `json:"classes"`
}
NoopConfig is noop.json: where real tasks write their markers and how each job class with real_task behaves. A class it does not list behaves as the default no-op.
func ReadConfig ¶
func ReadConfig(path string) (NoopConfig, error)
ReadConfig reads the noop.json at path.
type OutputLine ¶
OutputLine is one line of an output file.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer keeps one exec file current.
func Begin ¶
Begin writes <dir>/execs/<id>.json for this process under a random ID and starts refreshing its LastSeen every 250ms.
func BeginID ¶
BeginID is Begin under an ID the caller chose, as a parent that names its child's files before starting it does.