server

package
v0.17.0-alpha1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConflict    = errors.New("already running a prediction")
	ErrExists      = errors.New("prediction exists")
	ErrNotFound    = errors.New("prediction not found")
	ErrDefunct     = errors.New("server is defunct")
	ErrSetupFailed = errors.New("setup failed")
)

Functions

func NewServeMux

func NewServeMux(handler *Handler, useProcedureMode bool) *http.ServeMux

func SendWebhook

func SendWebhook(webhook string, pr *runner.PredictionResponse) error

Types

type Handler

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

func NewHandler

func NewHandler(ctx context.Context, cfg config.Config, baseLogger *logging.Logger) (*Handler, error)

func (*Handler) ActiveRunners

func (h *Handler) ActiveRunners() []*runner.Runner

ActiveRunners returns active runners from the runner manager

func (*Handler) Cancel

func (h *Handler) Cancel(w http.ResponseWriter, r *http.Request)

func (*Handler) ExitCode

func (h *Handler) ExitCode() int

func (*Handler) ForceKillAll

func (h *Handler) ForceKillAll()

ForceKillAll immediately force-kills all runners (for test cleanup)

func (*Handler) HandleIPC

func (h *Handler) HandleIPC(w http.ResponseWriter, r *http.Request)

func (*Handler) HealthCheck

func (h *Handler) HealthCheck(w http.ResponseWriter, r *http.Request)

func (*Handler) OpenAPI

func (h *Handler) OpenAPI(w http.ResponseWriter, r *http.Request)

func (*Handler) Predict

func (h *Handler) Predict(w http.ResponseWriter, r *http.Request)

func (*Handler) Root

func (h *Handler) Root(w http.ResponseWriter, r *http.Request)

func (*Handler) Start

func (h *Handler) Start(ctx context.Context) error

Start initializes the handler and its runner manager

func (*Handler) Stop

func (h *Handler) Stop() error

type HealthCheck

type HealthCheck struct {
	Status      string             `json:"status"`
	Setup       *SetupResult       `json:"setup,omitempty"`
	Concurrency runner.Concurrency `json:"concurrency,omitempty"`
}

type IPC

type IPC struct {
	Name   string    `json:"name"`
	Pid    int       `json:"pid"`
	Status IPCStatus `json:"status"`
}

type IPCStatus

type IPCStatus string
const (
	IPCStatusReady  IPCStatus = "READY"
	IPCStatusBUSY   IPCStatus = "BUSY"
	IPCStatusOutput IPCStatus = "OUTPUT"
)

type PredictConfig

type PredictConfig struct {
	ModuleName     string `json:"module_name,omitempty"`
	PredictorName  string `json:"predictor_name,omitempty"`
	MaxConcurrency int    `json:"max_concurrency,omitempty"`
}

type SetupResult

type SetupResult struct {
	StartedAt   string             `json:"started_at"`
	CompletedAt string             `json:"completed_at"`
	Status      runner.SetupStatus `json:"status"`
	Logs        string             `json:"logs,omitempty"`
}

Jump to

Keyboard shortcuts

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