@@ -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