modelworkers

package
v1.0.0-rc.13 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package modelworkers owns IDE configuration and repair of shared local execution.

Index

Constants

This section is empty.

Variables

View Source
var Contract = servicecontract.Contract{
	ID: "local-model-workers", Summary: "Manage local inference",
	Description: "Review local resource settings and the shared model owner. Inspect workers or stop an idle worker without interrupting another IDE's requests.",
	Operations: []servicecontract.Operation{
		{ID: "status", Summary: "Read settings and owner status"},
		{ID: "admission", Summary: "Configure shared scheduling"},
		{ID: "inspect", Summary: "Inspect worker placement and capacity"},
		{ID: "inventory", Summary: "Read native backends, devices and memory pools"},
		{ID: "stop", Summary: "Stop an idle worker"},
		{ID: "restart", Summary: "Restart the local owner after all native sessions close"},
	},
}

Contract describes shared local execution configuration and repair.

Functions

func CompletionSource

func CompletionSource(db libdbexec.DBManager) func(context.Context, string) (modeldconn.CompletionPlan, error)

CompletionSource reinstates verified residency on its selected host before native requests after restart.

func NewConfigured

func NewConfigured(ctx context.Context, db libdbexec.DBManager) (*modeldconn.Workers, error)

NewConfigured creates a runtime client that reads worker preferences from the local database.

func PolicySource

func PolicySource(db libdbexec.DBManager) func(context.Context) (admission.Config, bool, error)

PolicySource reads the client's explicit scheduling preference without changing the owner.

func ReadAssignedOptions

func ReadAssignedOptions(ctx context.Context, store runtimetypes.Store, role string) (modeldconn.WorkerOptions, error)

ReadAssignedOptions reads a role's own execution settings when reviewing an independent assignment.

func ReadOptions

func ReadOptions(ctx context.Context, store runtimetypes.Store, role string) (modeldconn.WorkerOptions, error)

ReadOptions reads and validates a role's persisted worker settings without starting local inference.

func SaveCompletionProtection

func SaveCompletionProtection(ctx context.Context, store runtimetypes.Store, provider, model string, executions []transport.SessionExecution) error

SaveCompletionProtection persists owner-confirmed allocation evidence in the role assignment transaction.

Types

type Inspection

type Inspection = transport.WorkerInspection

Inspection reports an existing worker's placement and resident allocation.

func InspectWorker

func InspectWorker(ctx context.Context, worker modeldconn.WorkerStatus) (*Inspection, error)

InspectWorker reads a selected worker's native status and capacity.

type InventoryRequest

type InventoryRequest struct {
	Target       string `json:"target"`
	ConnectionID string `json:"connectionId"`
}

InventoryRequest selects this installation or one saved modeld connection.

type Policy

type Policy struct {
	QueueCapacity   int    `json:"queue_capacity"`
	GlobalLimit     int    `json:"global_limit"`
	ForegroundBurst int    `json:"foreground_burst"`
	MaxQueueWait    string `json:"max_queue_wait"`
}

Policy describes editable admission settings without exposing duration encodings.

type Request

type Request struct {
	Action   string
	Instance string
	Policy   Policy
}

Request selects one local execution operation.

type Service

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

Service owns persisted local settings and shared-owner controls.

func New

func New(db libdbexec.DBManager, workers *modeldconn.Workers) (*Service, error)

New constructs worker configuration with complete persistence and execution dependencies.

func (*Service) Execute

func (s *Service) Execute(ctx context.Context, req Request) (*Snapshot, error)

Execute applies the selected operation and returns independently readable configuration and owner state.

func (*Service) ExecuteAt

func (s *Service) ExecuteAt(ctx context.Context, target InventoryRequest, request Request) (*Snapshot, error)

ExecuteAt operates the selected host's owner without consulting another host's leases or processes.

func (*Service) Inspect

func (s *Service) Inspect(ctx context.Context, instance string) (*Inspection, error)

Inspect reads one existing worker without launching or loading another allocation.

func (*Service) InspectAt

func (s *Service) InspectAt(ctx context.Context, target InventoryRequest, instance string) (*Inspection, error)

InspectAt reads an existing worker through its selected host's owner.

func (*Service) Inventory

func (s *Service) Inventory(ctx context.Context, req InventoryRequest) (transport.Inventory, error)

Inventory reads capabilities from the selected execution host without loading a model.

type Snapshot

type Snapshot struct {
	Resources      admission.Resources                 `json:"resources"`
	Contract       servicecontract.Contract            `json:"contract"`
	Admission      Policy                              `json:"admission"`
	Options        map[string]modeldconn.WorkerOptions `json:"options"`
	OptionErrors   map[string]string                   `json:"option_errors"`
	Workers        []modeldconn.WorkerStatus           `json:"workers"`
	OwnerState     string                              `json:"owner_state"`
	OwnerError     string                              `json:"owner_error,omitempty"`
	AdmissionError string                              `json:"admission_error,omitempty"`
}

Snapshot separates saved configuration from unavailable owner observations.

Jump to

Keyboard shortcuts

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