runner

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBackup

func CreateBackup(src string, backupDst string) error

CreateBackup backs up the src folder to backupDst atomically.

func DownloadRelease

func DownloadRelease(url string, destPath string, progressChan chan float64) error

DownloadRelease downloads an asset URL and writes progress fraction (0.0 to 1.0) to progressChan.

func ExtractArchive

func ExtractArchive(archivePath string, destDir string) error

ExtractArchive extracts zip/tar.gz into destDir and flattens single directories.

func GetMemoryUsage

func GetMemoryUsage(pid int) (float64, error)

GetMemoryUsage queries physical memory usage (RSS) of a process in MB.

func MatchAsset

func MatchAsset(release *GithubRelease, specs *hardware.HardwareSpecs) (mainAsset *ReleaseAsset, cudartAsset *ReleaseAsset, err error)

MatchAsset finds the most suitable assets (main binaries and optional cudart DLLs) for the user's OS, CPU/GPU architecture.

func QueryLocalVersion

func QueryLocalVersion(llamaCppDir string) (version string, commit string, buildInfo string, err error)

QueryLocalVersion runs llama-server (or llama-cli) --version and parses output.

func QueryServerRequests

func QueryServerRequests(port int) (int, error)

QueryServerRequests queries total completion requests processed via the /metrics endpoint.

func RollbackBackup

func RollbackBackup(backupSrc string, dst string) error

RollbackBackup restores the backup directory.

Types

type GithubRelease

type GithubRelease struct {
	TagName string         `json:"tag_name"`
	Name    string         `json:"name"`
	Body    string         `json:"body"`
	Assets  []ReleaseAsset `json:"assets"`
}

func CheckAppRelease added in v0.2.0

func CheckAppRelease() (*GithubRelease, error)

CheckAppRelease queries GitHub API for the latest llama-manager release.

func CheckLatestRelease

func CheckLatestRelease() (*GithubRelease, error)

CheckLatestRelease queries GitHub API for the latest llama.cpp release.

type InstanceInfo

type InstanceInfo struct {
	Port      int
	ModelPath string
	PID       int
	Uptime    time.Duration
	LogFile   string
}

type ReleaseAsset

type ReleaseAsset struct {
	Name               string `json:"name"`
	BrowserDownloadURL string `json:"browser_download_url"`
	Size               int64  `json:"size"`
}

type ServerInstance

type ServerInstance struct {
	Port       int
	ModelPath  string
	PID        int
	Cmd        *exec.Cmd
	LaunchTime time.Time
	LogFile    string
	// contains filtered or unexported fields
}

type ServerRunner

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

func NewServerRunner

func NewServerRunner(logDir string) *ServerRunner

func (*ServerRunner) GetAllInstances

func (sr *ServerRunner) GetAllInstances() []InstanceInfo

GetAllInstances returns status information for all active servers.

func (*ServerRunner) GetStatus

func (sr *ServerRunner) GetStatus() (ServerStatus, string, int)

GetStatus returns the status, running model path, and port of the primary running server (50505 or first found).

func (*ServerRunner) Start

func (sr *ServerRunner) Start(llamaCppDir string, modelPath string, ctxSize uint32, threads int, gpuLayers int, batchSize int, host string, port int) error

Start launches the llama-server on the specified port.

func (*ServerRunner) Stop

func (sr *ServerRunner) Stop() error

Stop terminates ALL running servers.

func (*ServerRunner) StopInstance

func (sr *ServerRunner) StopInstance(port int) error

StopInstance terminates the server running on the specified port.

type ServerStatus

type ServerStatus int
const (
	StatusStopped ServerStatus = iota
	StatusRunning
	StatusFailed
)

Jump to

Keyboard shortcuts

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