From 06528d66aa98e4434fc7237aa42c18b56fedecd8 Mon Sep 17 00:00:00 2001 From: Inforithmics Date: Sat, 4 Oct 2025 16:22:55 +0200 Subject: [PATCH] fixing build --- server/sched.go | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/server/sched.go b/server/sched.go index 2de622ea6..5f8c61e09 100644 --- a/server/sched.go +++ b/server/sched.go @@ -623,7 +623,7 @@ func (runner *runnerRef) needsReload(ctx context.Context, req *LlmRequest) bool // a before and after GPU memory allocation. The returned channel // will be notified when we're done waiting, or have timed out and should // proceed anyway -func (runner *runnerRef) waitForVRAMRecovery() chan any { +func (s *Scheduler) waitForVRAMRecovery(runner *runnerRef, runners []discover.FilteredRunnerDiscovery) chan any { finished := make(chan any, 1) // CPU or Metal don't need checking, so no waiting required @@ -638,7 +638,7 @@ func (runner *runnerRef) waitForVRAMRecovery() chan any { start := time.Now() // Establish a baseline before we unload - gpusBefore := discover.GetGPUInfo() + gpusBefore := s.getGpuFn(context.Background(), runners) var totalMemoryBefore, freeMemoryBefore uint64 for _, gpu := range gpusBefore { totalMemoryBefore += gpu.TotalMemory @@ -656,7 +656,7 @@ func (runner *runnerRef) waitForVRAMRecovery() chan any { } // Query GPUs, look for free to go back up - gpusNow := discover.GetGPUInfo() + gpusNow := s.getGpuFn(context.Background(), runners) var totalMemoryNow, freeMemoryNow uint64 for _, gpu := range gpusNow { totalMemoryNow += gpu.TotalMemory @@ -699,6 +699,32 @@ func (runner *runnerRef) LogValue() slog.Value { return slog.GroupValue(attrs...) } +// Implements discover.RunnerDiscovery +func (runner *runnerRef) GetPort() int { + if runner.llama != nil { + return runner.llama.GetPort() + } + return -1 +} + +func (runner *runnerRef) GetDeviceInfos(ctx context.Context) []ml.DeviceInfo { + if runner.llama != nil { + return runner.llama.GetDeviceInfos(ctx) + } + return nil +} + +func (runner *runnerRef) GetActiveDeviceIDs() []ml.DeviceID { + return runner.gpus +} + +func (runner *runnerRef) HasExited() bool { + if runner.llama != nil { + return runner.llama.HasExited() + } + return true +} + type ByDurationAndName []*runnerRef func (a ByDurationAndName) Len() int { return len(a) }