Detect and recover if runner removed

Tmp cleaners can nuke the file out from underneath us.  This detects the missing
runner, and re-initializes the payloads.
This commit is contained in:
Daniel Hiltgen 2024-04-23 10:05:26 -07:00
parent cc5a71e0e3
commit 58888a74bc

View file

@ -250,6 +250,17 @@ func NewLlamaServer(gpus gpu.GpuInfoList, model string, ggml *GGML, adapters, pr
server = server + ".exe"
}
// Detect tmp cleaners wiping out the file
_, err := os.Stat(server)
if errors.Is(err, os.ErrNotExist) {
slog.Warn("llama server disappeared, reinitializing payloads", "path", server, "error", err)
err = Init()
if err != nil {
slog.Warn("failed to reinitialize payloads", "error", err)
return nil, err
}
}
s := &llmServer{
port: port,
cmd: exec.Command(server, finalParams...),