Skip to content

Commit 30e94a4

Browse files
author
Sherif Akoush
committed
treat scheduling with min replicas as good
1 parent 52b2b32 commit 30e94a4

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

scheduler/pkg/scheduler/scheduler.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -185,25 +185,21 @@ func (s *SimpleScheduler) scheduleToServer(modelName string) error {
185185
ok := s.findAndUpdateToServers(filteredServers, latestModel, desiredReplicas, desiredReplicas)
186186
// Try to scheduler with min replicas if not enough replicas
187187
okWithMinReplicas := false
188-
if !ok {
189-
if minReplicas > 0 {
190-
okWithMinReplicas = s.findAndUpdateToServers(filteredServers, latestModel, desiredReplicas, int(minReplicas))
191-
}
188+
if !ok && minReplicas > 0 {
189+
okWithMinReplicas = s.findAndUpdateToServers(filteredServers, latestModel, desiredReplicas, int(minReplicas))
190+
msg := "Failed to schedule model as no matching server had enough suitable replicas, managed to schedule with min replicas"
191+
logger.Debug(msg)
192192
}
193193

194-
if !ok {
194+
if !ok && !okWithMinReplicas {
195195
msg := "Failed to schedule model as no matching server had enough suitable replicas"
196-
if okWithMinReplicas {
197-
msg = "Failed to schedule model as no matching server had enough suitable replicas, managed to schedule with min replicas"
198-
}
199196
logger.Debug(msg)
200197
// we do not want to reset the server if it has live replicas or loading replicas
201198
// in the case of loading replicas, we need to make sure that we can unload them later.
202199
// for example in the case that a model is just marked as loading on a particular server replica
203200
// then it gets a delete request (before it is marked as loaded or available) we need to make sure
204201
// that we can unload it from the server
205-
// we also do not want to reset the server if we managed to schedule with min replicas
206-
s.store.FailedScheduling(latestModel, msg, !latestModel.HasLiveReplicas() && !latestModel.IsLoadingOrLoadedOnServer() && !okWithMinReplicas)
202+
s.store.FailedScheduling(latestModel, msg, !latestModel.HasLiveReplicas() && !latestModel.IsLoadingOrLoadedOnServer())
207203
return errors.New(msg)
208204
}
209205

0 commit comments

Comments
 (0)