Skip to content

Commit 24a2a4b

Browse files
authored
Merge pull request #86 from docker/config-refinement
Try to make backend configuration a little more robust.
2 parents e57dcc0 + 9f02211 commit 24a2a4b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pkg/inference/scheduling/loader.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"errors"
66
"fmt"
77
"os"
8+
"reflect"
89
"runtime"
910
"time"
1011

@@ -528,6 +529,20 @@ func (l *loader) setRunnerConfig(ctx context.Context, backendName, model string,
528529

529530
runnerId := runnerKey{backendName, model, mode}
530531

532+
// If the configuration hasn't changed, then just return.
533+
if existingConfig, ok := l.runnerConfigs[runnerId]; ok && reflect.DeepEqual(runnerConfig, existingConfig) {
534+
l.log.Infof("Configuration for %s runner for model %s unchanged", backendName, model)
535+
return nil
536+
}
537+
538+
// If there's an active runner whose configuration we want to override, then
539+
// try evicting it (because it may not be in use).
540+
if _, ok := l.runners[runnerId]; ok {
541+
l.evictRunner(backendName, model, mode)
542+
}
543+
544+
// If there's still then active runner, then we can't (or at least
545+
// shouldn't) change the configuration.
531546
if _, ok := l.runners[runnerId]; ok {
532547
return errRunnerAlreadyActive
533548
}

0 commit comments

Comments
 (0)