server

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AskRequestV2

type AskRequestV2 struct {
	Task       string                     `json:"task"`
	Complexity int                        `json:"complexity,omitempty"`
	Resources  *decision.ResourceEstimate `json:"resources,omitempty"`
}

AskRequestV2 is the request body for POST /v2/ask.

type AskResponseV2

type AskResponseV2 struct {
	Allowed        bool                  `json:"allowed"`
	Reasons        []string              `json:"reasons,omitempty"`
	PredictedState *decision.FutureState `json:"predicted,omitempty"`
	Confidence     float64               `json:"confidence"`
	Strategy       string                `json:"strategy"`
	Model          string                `json:"model"`
}

AskResponseV2 is the response for POST /v2/ask.

type Coefficients

type Coefficients struct {
	CPUA  float64 `json:"cpu_a,omitempty"`
	CPUB  float64 `json:"cpu_b,omitempty"`
	MemA  float64 `json:"mem_a,omitempty"`
	MemB  float64 `json:"mem_b,omitempty"`
	GPUA  float64 `json:"gpu_a,omitempty"`
	GPUB  float64 `json:"gpu_b,omitempty"`
	VRAMA float64 `json:"vram_a,omitempty"`
	VRAMB float64 `json:"vram_b,omitempty"`
}

Coefficients holds regression coefficients.

type HealthResponse

type HealthResponse struct {
	Status string `json:"status"`
}

type InfoResponse

type InfoResponse struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

type InjectMetricsRequest

type InjectMetricsRequest struct {
	CPU       *float64 `json:"cpu,omitempty"`        // CPU usage percent
	Memory    *float64 `json:"memory,omitempty"`     // Memory usage percent
	GPUUsage  *float64 `json:"gpu_usage,omitempty"`  // GPU usage percent
	VRAMUsage *float64 `json:"vram_usage,omitempty"` // VRAM usage percent
	GPUIndex  int      `json:"gpu_index,omitempty"`  // Which GPU (default 0)
}

InjectMetricsRequest is the request body for POST /debug/inject-metrics.

type ModelStatsResponse

type ModelStatsResponse struct {
	ModelName         string                  `json:"model_name"`
	LearningType      string                  `json:"learning_type"`
	TotalObservations int64                   `json:"total_observations"`
	Tasks             map[string]*TaskStatsV2 `json:"tasks"`
}

ModelStatsResponse is the response for GET /v2/model/stats.

type ReadyResponse

type ReadyResponse struct {
	Ready   bool   `json:"ready"`
	Message string `json:"message,omitempty"`
}

ReadyResponse is the response for /ready endpoint.

type SchedulerStatsResponse

type SchedulerStatsResponse struct {
	Running      bool   `json:"running"`
	Interval     string `json:"interval"`
	RetrainCount int64  `json:"retrain_count"`
	LastRetrain  string `json:"last_retrain,omitempty"`
	LastError    string `json:"last_error,omitempty"`
}

SchedulerStatsResponse is the response for GET /v2/scheduler/stats.

type Server

type Server struct {
	// contains filtered or unexported fields
}

func New

func New(cfg *config.Config, agg *monitor.Aggregator, cm *capacity.Manager, le *learning.Engine, logger *slog.Logger, version string) *Server

func (*Server) Addr

func (s *Server) Addr() string

func (*Server) DecisionManager

func (s *Server) DecisionManager() *decision.Manager

DecisionManager returns the decision manager if available.

func (*Server) ReloadConfig

func (s *Server) ReloadConfig(cfg *config.Config)

ReloadConfig reloads configuration that can be changed at runtime. Note: host/port changes require restart.

func (*Server) SetDecisionComponents

func (s *Server) SetDecisionComponents(v2 *V2Components)

SetDecisionComponents sets the new decision engine components.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

func (*Server) Start

func (s *Server) Start() error

type TaskStatsV2

type TaskStatsV2 struct {
	Task         string        `json:"task"`
	Count        int64         `json:"count"`
	AvgCPUDelta  float64       `json:"avg_cpu_delta"`
	AvgMemDelta  float64       `json:"avg_mem_delta"`
	AvgGPUDelta  float64       `json:"avg_gpu_delta,omitempty"`
	AvgVRAMDelta float64       `json:"avg_vram_delta,omitempty"`
	Coefficients *Coefficients `json:"coefficients,omitempty"`
}

TaskStatsV2 is the stats for a single task in V2.

type V2Components

type V2Components struct {
	DecisionManager *decision.Manager
	Scheduler       *scheduler.Scheduler
	Model           model.PredictionModel
}

V2Components holds the new decision engine components.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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