Documentation
¶
Overview ¶
Package workers records each eval worker's check-in and tells the owner whether it can run the configured judge and panel.
Index ¶
- Constants
- func Readiness(list []Worker, cfg *evalqueue.EvalConfig, now time.Time)
- func RegisterRoutes(api huma.API, s *Store, providers ProviderSource, keys *auth.KeyStore, ...)
- type ProviderSource
- type Store
- type Verification
- type Worker
- type WorkersCheckin
- type WorkersCheckinReply
- type WorkersEnvVar
- type WorkersKeyBody
- type WorkersKeyReply
- type WorkersListBody
Constants ¶
const StaleAfter = 5 * time.Minute
StaleAfter is how long a worker may be silent before it shows as offline.
Variables ¶
This section is empty.
Functions ¶
func Readiness ¶
func Readiness(list []Worker, cfg *evalqueue.EvalConfig, now time.Time)
Readiness fills each worker's problems against the configured panel and the other workers' sandbox image.
func RegisterRoutes ¶
func RegisterRoutes(api huma.API, s *Store, providers ProviderSource, keys *auth.KeyStore, publicURL func() string)
RegisterRoutes serves the check-in to workers and the list to owners.
Types ¶
type ProviderSource ¶
type ProviderSource interface {
EvalConfig(ctx context.Context) (*evalqueue.EvalConfig, error)
Backends(ctx context.Context) ([]evalqueue.EvalBackend, error)
}
ProviderSource lists the server's providers and the configured panel.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store reads and writes check-ins.
type Verification ¶
type Verification struct {
Provider string `json:"provider"`
OK bool `json:"ok"`
Detail string `json:"detail"`
Models []string `json:"models"`
}
Verification is one provider check a worker ran with its own credential.
type Worker ¶
type Worker struct {
WorkersCheckin
FirstSeen time.Time `json:"first_seen"`
LastSeen time.Time `json:"last_seen"`
// Problems are why the worker cannot run the configured panel. Empty means ready.
Problems []string `json:"problems"`
}
Worker is one worker's last check-in and its readiness.
type WorkersCheckin ¶
type WorkersCheckin struct {
WorkerID string `json:"worker_id" minLength:"1" maxLength:"200"`
Version string `json:"version"`
Driver string `json:"driver"`
HardwareIsolated bool `json:"hardware_isolated"`
NetworkPolicy bool `json:"network_policy"`
Concurrency int `json:"concurrency"`
SandboxImage string `json:"sandbox_image"`
Pinned string `json:"pinned,omitempty"`
Credentials []string `json:"credentials" maxItems:"64"`
Verifications []Verification `json:"verifications" maxItems:"32"`
}
WorkersCheckin is what a worker reports on each poll.
type WorkersCheckinReply ¶
type WorkersCheckinReply struct {
Providers []evalqueue.EvalBackend `json:"providers"`
}
WorkersCheckinReply names the providers a worker must hold credentials for.
type WorkersEnvVar ¶
type WorkersKeyBody ¶
type WorkersKeyBody struct {
Name string `json:"name" minLength:"1" maxLength:"64"`
}
type WorkersKeyReply ¶
type WorkersKeyReply struct {
Key string `json:"key"`
// Env is every variable the new worker needs, with the key and the
// endpoint filled in and each provider credential left for the owner.
Env []WorkersEnvVar `json:"env"`
}