forecastserve

package
v0.209.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 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 forecastserve places and runs the Timestral forecast server: the python file it ships (embedded, so a binary drop carries the server that matches it), the venv `install forecast` builds, and the launcher llama-swap's seat runs (`local-offload forecast-serve`). The launcher holds the python child for the whole of its own life: when llama-swap stops the seat, or the launcher dies, the child goes with it, so a stop never orphans a process that holds the card.

Index

Constants

View Source
const ScriptName = "timestral_server.py"

ScriptName is the file EnsureScript writes under the forecast directory.

Variables

This section is empty.

Functions

func EnsureScript

func EnsureScript(dir string) (path string, wrote bool, err error)

EnsureScript writes <dir>/timestral_server.py when it is missing or differs from the embedded source, and returns its path and whether it wrote. The write is atomic (temp file + rename), so a launcher that reads the file while an upgrade replaces it never sees half of it.

func IsLoopbackHost

func IsLoopbackHost(host string) bool

IsLoopbackHost reports whether host names only this machine: an IP literal in the loopback range or "localhost". The server has no authentication, so nothing else is accepted.

func Script

func Script() []byte

Script is the embedded server source.

func Serve

func Serve(ctx context.Context, o Options) (int, error)

Serve refreshes the embedded script, starts the server under the venv python and waits for it. The child is bound to this process's life (see startBound); SIGINT and SIGTERM are forwarded as a stop. It returns the child's exit code; err is non-nil only when the launch itself failed.

func VenvPython

func VenvPython(dir string) string

VenvPython is the interpreter of the venv `install forecast` builds under dir.

Types

type Options

type Options struct {
	Dir           string // the forecast directory: <dir>/venv and the script
	Model         string // the checkpoint directory (config.json + model.safetensors)
	Host          string // loopback only
	Port          int
	Device        string
	MaxRowPatches int // 0 leaves the server's default
	Stdout        io.Writer
	Stderr        io.Writer
}

Options is one launch of the server.

func (Options) Args

func (o Options) Args(script string) []string

Args is the python command line after the interpreter.

func (Options) Check

func (o Options) Check() error

Check refuses a launch that cannot work, naming what is missing and the verb that fixes it.

Jump to

Keyboard shortcuts

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