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 ¶
const ScriptName = "timestral_server.py"
ScriptName is the file EnsureScript writes under the forecast directory.
Variables ¶
This section is empty.
Functions ¶
func EnsureScript ¶
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 ¶
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 Serve ¶
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 ¶
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.