fix: let admin placement recover joined nodes

This commit is contained in:
Dobromir Popov
2026-07-14 16:37:42 +02:00
parent def47f1a42
commit 21e6c86147

View File

@@ -1534,15 +1534,15 @@ def _force_model_load_locked(server: "_TrackerHTTPServer", model_key: str) -> di
if preset is None or not preset.get("hf_repo"):
return None
start, end = _preset_layer_bounds(preset)
# An explicit admin eviction is permitted to recover a stuck/loading node
# and to use the preset default precision. It must only avoid a node that
# already has another assignment in flight.
candidates = [node for node in server.registry.values()
if node.status == "ready" and node.pending_new_assignment is None
and _has_usable_quantization(node)]
if node.pending_new_assignment is None]
if not candidates:
return None
node = max(candidates, key=lambda item: item.benchmark_tokens_per_sec)
shard_end = min(end, start + min(_node_layer_capacity(node, preset), end - start + 1) - 1)
if shard_end < start:
return None
shard_end = min(end, start + max(1, min(_node_layer_capacity(node, preset), end - start + 1)) - 1)
quantization = _node_quantization(node, preset)
directive = _load_directive(node, str(preset["hf_repo"]), start, shard_end, quantization)
replaced = node.hf_repo or node.model