fix: select_best_gpu respects candidate order — first non-busy wins
Previously it picked the least-loaded GPU globally, ignoring priority order. Now it tries candidates in order: MoE → VLM → Dense. Only falls back to least-loaded when ALL candidates are busy.
This commit is contained in:
+6
-5
@@ -119,7 +119,11 @@ def is_gpu_busy(model):
|
|||||||
return active >= max_c
|
return active >= max_c
|
||||||
|
|
||||||
def select_best_gpu(candidates, reason):
|
def select_best_gpu(candidates, reason):
|
||||||
"""Pick the best GPU from candidates, preferring least-loaded."""
|
"""Pick the best GPU from candidates IN ORDER — first non-busy one wins."""
|
||||||
|
for m in candidates:
|
||||||
|
if not is_gpu_busy(m):
|
||||||
|
return {"model": m, "reason": reason}
|
||||||
|
# All busy — pick least loaded
|
||||||
best = None
|
best = None
|
||||||
best_load = 999
|
best_load = 999
|
||||||
for m in candidates:
|
for m in candidates:
|
||||||
@@ -128,10 +132,7 @@ def select_best_gpu(candidates, reason):
|
|||||||
best_load = load
|
best_load = load
|
||||||
best = m
|
best = m
|
||||||
if best:
|
if best:
|
||||||
actual_reason = reason
|
return {"model": best, "reason": "load_balanced_" + reason}
|
||||||
if is_gpu_busy(best):
|
|
||||||
actual_reason = "load_balanced_" + reason
|
|
||||||
return {"model": best, "reason": actual_reason}
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def route(rd, tier):
|
def route(rd, tier):
|
||||||
|
|||||||
Reference in New Issue
Block a user