Documentation
¶
Overview ¶
Package stress runs explicitly requested, high-load benchmark jobs.
It is a top-level feature, independent from health scoring: health scores collected hardware metrics, while stress executes externally deployed benchmark assets only after an explicit CLI or Web request.
Index ¶
- Constants
- Variables
- func Register(mux *http.ServeMux, manager *Manager, listenAddr string, logger *slog.Logger)
- type AssetCheck
- type BenchmarkConfig
- type BenchmarkResult
- type CheckStatus
- type Config
- type ExecutionProfile
- type Handler
- type MPICheck
- type Manager
- func (m *Manager) Availability(name string) (bool, string)
- func (m *Manager) CanCancel(id string) bool
- func (m *Manager) Cancel(id string) error
- func (m *Manager) Config() Config
- func (m *Manager) Describe(name string) (*ExecutionProfile, error)
- func (m *Manager) History(limit int) ([]Report, error)
- func (m *Manager) Job(id string) (Report, error)
- func (m *Manager) Latest() (Report, error)
- func (m *Manager) Shutdown(ctx context.Context) error
- func (m *Manager) Start(names []string) (Report, error)
- func (m *Manager) StartWithOptions(names []string, options RunOptions) (Report, error)
- type PreflightResult
- type ProfileParameter
- type Report
- type ResourceProfile
- type RunOptions
- type Status
Constants ¶
const ( InitiatorCLI = "cli" InitiatorWeb = "web" )
Variables ¶
Functions ¶
Types ¶
type AssetCheck ¶
type BenchmarkConfig ¶
type BenchmarkConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Timeout time.Duration `yaml:"timeout" json:"timeout"`
// ResultDir is used by HPCG to verify and parse the result file created by
// the current run. Executable paths remain in the host dispatcher script.
ResultDir string `yaml:"result_dir" json:"result_dir"`
}
type BenchmarkResult ¶
type BenchmarkResult struct {
// Name is the configured benchmark identifier. Status describes execution
// and parsing success; Values contains the benchmark-specific measurements.
Name string `json:"name"`
Status Status `json:"status"`
Message string `json:"message"`
StartedAt time.Time `json:"started_at"`
FinishedAt time.Time `json:"finished_at"`
DurationMS int64 `json:"duration_ms"`
Values map[string]float64 `json:"values,omitempty"`
Source string `json:"source,omitempty"`
Output string `json:"output,omitempty"`
// Profile is captured before execution and retained in latest/history
// reports so results can be traced back to the effective host workload.
Profile *ExecutionProfile `json:"profile,omitempty"`
}
type CheckStatus ¶
type CheckStatus string
CheckStatus is the result of a read-only deployment check.
const ( CheckPass CheckStatus = "pass" CheckWarn CheckStatus = "warn" CheckFail CheckStatus = "fail" CheckUnsupported CheckStatus = "unsupported" )
type Config ¶
type Config struct {
Enabled bool `yaml:"enabled" json:"enabled"`
WebEnabled bool `yaml:"web_enabled" json:"web_enabled"`
ScriptPath string `yaml:"script_path" json:"script_path"`
ReportPath string `yaml:"report_path" json:"report_path"`
DefaultBenchmarks []string `yaml:"default_benchmarks" json:"default_benchmarks"`
Benchmarks map[string]BenchmarkConfig `yaml:"benchmarks" json:"benchmarks"`
}
Config is shared by the CLI and Web job manager. Paths are deployment configuration, never accepted from a Web request.
type ExecutionProfile ¶
type ExecutionProfile struct {
ProtocolVersion int `json:"protocol_version"`
Benchmark string `json:"benchmark"`
Parameters []ProfileParameter `json:"parameters"`
Resources ResourceProfile `json:"resources"`
Assets []AssetCheck `json:"assets"`
MPI MPICheck `json:"mpi"`
Preflight PreflightResult `json:"preflight"`
TimeoutSeconds int64 `json:"timeout_seconds"`
ResultDirectory string `json:"result_directory,omitempty"`
ScriptSHA256 string `json:"script_sha256,omitempty"`
ConfigurationSHA256 string `json:"configuration_sha256"`
}
ExecutionProfile is a read-only snapshot returned by the deployed benchmark_check.sh "describe" protocol. It records the effective workload without allowing Web requests to alter host paths, MPI arguments, or scripts.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler owns the stress Web API and standalone SPA. The host Web binary only mounts it; stress policy and job semantics remain inside this feature.
type MPICheck ¶
type MPICheck struct {
Required bool `json:"required"`
Launcher string `json:"launcher,omitempty"`
Implementation string `json:"implementation"`
Version string `json:"version,omitempty"`
ExecutableABI string `json:"executable_abi"`
Status CheckStatus `json:"status"`
Message string `json:"message"`
}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) Availability ¶
Availability combines the basic CATMonitor deployment checks with the dispatcher's read-only describe/preflight protocol. A missing or invalid describe response blocks execution because CATMonitor cannot safely verify the effective workload and required assets.
func (*Manager) Describe ¶
func (m *Manager) Describe(name string) (*ExecutionProfile, error)
Describe returns the effective, read-only workload profile for a benchmark. The dispatcher contract is:
bash benchmark_check.sh describe <stream|hpl|hpcg|npu_burn>
It must write exactly one JSON object to stdout and must not launch a benchmark. Results are cached briefly because the Web UI polls configuration.
func (*Manager) History ¶
History returns final reports ordered newest first. The latest report remains the source of truth for running state; history is a bounded operational view.
func (*Manager) Shutdown ¶
Shutdown cancels the job owned by this Manager and waits for its final report and cross-process lock release. Jobs owned by another process are never cancelled.
func (*Manager) StartWithOptions ¶
func (m *Manager) StartWithOptions(names []string, options RunOptions) (Report, error)
type PreflightResult ¶
type PreflightResult struct {
Status CheckStatus `json:"status"`
Message string `json:"message"`
}
type ProfileParameter ¶
type Report ¶
type Report struct {
JobID string `json:"job_id"`
Initiator string `json:"initiator,omitempty"`
Timestamp time.Time `json:"timestamp"`
StartedAt time.Time `json:"started_at"`
FinishedAt time.Time `json:"finished_at,omitempty"`
Platform string `json:"platform"`
TimeoutSeconds int64 `json:"timeout_seconds,omitempty"`
Status Status `json:"status"`
// ConfigurationSHA256 is a deterministic aggregate of the selected
// benchmark profiles, including the actual per-job timeout.
ConfigurationSHA256 string `json:"configuration_sha256,omitempty"`
// ReportError is set when a running/final in-memory report could not be
// persisted. Initial persistence failures reject the job submission.
ReportError string `json:"report_error,omitempty"`
Benchmarks []BenchmarkResult `json:"benchmarks"`
// Cancellable is a response-only view set by the serving process. It is
// false for jobs started by another process, such as CLI jobs observed by
// Web.
Cancellable bool `json:"cancellable,omitempty"`
}
type ResourceProfile ¶
type RunOptions ¶
RunOptions applies only to one submitted job. It is never persisted back to YAML. Timeout can only shorten the configured per-benchmark limit.
type Status ¶
type Status string
Status is the stress job and benchmark execution state. A terminal StatusHealthy means the command exited successfully and all required result values were parsed. StatusTimeLimitReached also represents success: the configured duration-driven stress window intentionally ended before final values were emitted. Ascend NPU Burn requires a complete PASS/SDC result and therefore treats an outer timeout as unhealthy instead.
This type intentionally does not reuse health.HealthScore.Grade: a health grade is a 0--100 hardware score, while Status is an explicit benchmark job lifecycle/outcome.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cli implements the catmonitor stress command adapter.
|
Package cli implements the catmonitor stress command adapter. |
|
cmd
|
|
|
cpu-runner
command
|
|
|
cpu-runner-client
command
|
|
|
Package runnerapi implements the private Unix-socket protocol used by the optional CATMonitor CPU stress runner.
|
Package runnerapi implements the private Unix-socket protocol used by the optional CATMonitor CPU stress runner. |