Documentation
¶
Overview ¶
Package appcause holds the application cause document, dispatch.app-cause.v1, and the beat, launch.beat.v1, that a launcher inside the job writes and an adapter reads: their types, strict decoders and writers, and Refine, the one rule by which a document refines a scheduler's cause.
Both schemas are fixed from R1: a change to their members is a new schema name. The package imports the standard library and model only, so the writer (go/launch) and the readers (the adapters) share one definition (go/dispatch spec 0001 D1, 0003 D2; go/launch spec 0001 D6, D7).
Index ¶
Constants ¶
const ( BeatSchema = "launch.beat.v1" MaxBeatSize = 512 BeatLinePrefix = "LAUNCH-BEAT " )
BeatSchema is the beat's schema name, MaxBeatSize the bound on its encoding, and BeatLinePrefix what starts a beat line in a Kubeflow rank 0 log (go/launch spec 0001 D6).
const ( Schema = "dispatch.app-cause.v1" MaxSize = 2048 )
Schema is the cause document's schema name, and MaxSize the bound on its whole encoding.
const ( HeartbeatOn = "on" HeartbeatOff = "off" GPUNVML = "nvml" GPUAbsent = "absent" GPUNotBuilt = "not-built" GPUOff = "off" SourceErrorJSON = "error-json" SourceNCCL = "nccl" SourceStderr = "stderr" SourceNVML = "nvml" )
The values of Document.Heartbeat, Document.GPU and Evidence.Source.
Variables ¶
var ( ErrTooLarge = fmt.Errorf("%w: appcause: over its size bound", model.ErrInvalid) ErrSchema = fmt.Errorf("%w: appcause: not this schema", model.ErrInvalid) ErrMalformed = fmt.Errorf("%w: appcause: malformed", model.ErrInvalid) ErrInconsistent = fmt.Errorf("%w: appcause: inconsistent", model.ErrInvalid) )
The decoders' sentinels, each wrapping model.ErrInvalid.
Functions ¶
func Encode ¶
Encode writes d as the launcher does (go/launch spec 0001 D7): every string through redact first, then each control character in free text as a space, then the caps, then, while the encoding exceeds MaxSize, the oldest evidence dropped, then the second fault, then the summary halved. It refuses what Decode would.
func EncodeBeat ¶
EncodeBeat writes b, refusing what DecodeBeat would.
Types ¶
type Beat ¶
type Beat struct {
Schema string `json:"schema"`
Seq uint64 `json:"seq"`
Step int `json:"step"`
Phase string `json:"phase"`
Nodes int `json:"nodes"`
StaleAfter int `json:"staleAfter"`
}
Beat is one launch.beat.v1 beat: proof the launcher is alive, which an adapter judges on its own clock, never on a time written on a compute node. Seq rises on every write, and StaleAfter is whole seconds.
func DecodeBeat ¶
DecodeBeat reads one beat as Decode reads a document, bounded by MaxBeatSize.
type Class ¶
type Class string
Class is the launcher's own refinement of a kind, versioned with this schema, never a record.
const ( ClassException Class = "exception" ClassSignalled Class = "signalled" ClassLaunchError Class = "launch-error" ClassUnclassified Class = "unclassified" ClassHung Class = "hung" ClassCollectiveFailed Class = "collective-failed" ClassGPUFault Class = "gpu-fault" ClassGPUOutOfMemory Class = "gpu-out-of-memory" )
The classes: the first four refine KindNonZeroExit, and each other kind takes its own name.
type Document ¶
type Document struct {
Schema string `json:"schema"`
Phase Phase `json:"phase"`
Kind Kind `json:"kind,omitempty"`
Class Class `json:"class,omitempty"`
Summary string `json:"summary,omitempty"`
At time.Time `json:"at"`
Attempt string `json:"attempt"`
Epoch string `json:"epoch"`
Node string `json:"node,omitempty"`
NodeRank *int `json:"nodeRank,omitempty"`
ExitCode *int `json:"exitCode,omitempty"`
LastStep *int `json:"lastStep,omitempty"`
LastPhase string `json:"lastPhase,omitempty"`
LastBeatAt time.Time `json:"lastBeatAt,omitzero"`
Heartbeat string `json:"heartbeat"`
GPU string `json:"gpu"`
Signal *Signal `json:"signal,omitempty"`
Evidence []Evidence `json:"evidence,omitempty"`
Faults []Fault `json:"faults,omitempty"`
}
Document is one dispatch.app-cause.v1 document. Its members and their bounds are fixed for v1 (go/launch spec 0001 D7).
func Decode ¶
Decode reads one dispatch.app-cause.v1 document strictly: its size, then its schema alone, then every member, refusing an unknown one at any level, then each member's bound, then the members' consistency. Its times are in UTC.
func Refine ¶
func Refine(sched model.Cause, exec model.ExecutionObs, doc []byte, found bool) (model.Cause, Document, bool)
Refine is the one rule by which the document an execution's launcher wrote refines the scheduler's cause sched (go/dispatch spec 0003 D2). doc is what the adapter read, up to MaxSize+1 bytes, and found whether there was a file to read.
It returns the cause to report, the decoded document (zero when it did not decode), and whether the document was used. The result keeps sched's provenance, exit code and time, and its kind is always one this build defines.
type Evidence ¶
type Evidence struct {
Source string `json:"source"`
Rank *int `json:"rank,omitempty"`
Line string `json:"line"`
}
Evidence is one line the launcher found, oldest first in Document.Evidence.
type Kind ¶
type Kind string
Kind is the launcher's cause kind, by name. It is never a model.CauseKind, so that a name this build's model does not define still decodes and re-encodes (go/launch spec 0001 D15).