mirror of
https://github.com/mudler/LocalAI.git
synced 2026-09-29 09:35:02 -04:00
Warm local targets are pinned in the watchdog and preloaded. Switches and target health are exported as metrics, skipped attempts as traces. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
18 lines
609 B
Go
18 lines
609 B
Go
package application
|
|
|
|
import (
|
|
"github.com/mudler/LocalAI/core/backend"
|
|
"github.com/mudler/xlog"
|
|
)
|
|
|
|
// applyFailoverWarmTargets pins warm failover targets in the watchdog and
|
|
// loads them, so a switch does not wait for a cold load.
|
|
func (a *Application) applyFailoverWarmTargets(warm []string) {
|
|
a.SyncPinnedModelsToWatchdog()
|
|
for _, name := range warm {
|
|
if _, err := backend.PreloadModelByName(a.ApplicationConfig().Context, a.ModelConfigLoader(), a.ModelLoader(), a.ApplicationConfig(), name); err != nil {
|
|
xlog.Warn("failover: could not preload warm target", "model", name, "error", err)
|
|
}
|
|
}
|
|
}
|