Remove automatic weight adjustment when clients connect

- Cluster master now participates in job selection even when clients are connected
- Local workers compete with external workers based on weight and VRAM
parent 89c63cf8
...@@ -311,12 +311,9 @@ class ClusterMaster: ...@@ -311,12 +311,9 @@ class ClusterMaster:
'failing': False # Mark as failing after 3 consecutive failures 'failing': False # Mark as failing after 3 consecutive failures
} }
# If this is the first client and weight wasn't explicitly set, change master weight to 0 # Update connected clients count
from .database import get_connected_cluster_clients from .database import get_connected_cluster_clients
connected_clients = get_connected_cluster_clients() connected_clients = get_connected_cluster_clients()
if len(connected_clients) == 1 and self.weight == 100 and not self.weight_explicit:
self.weight = 0
print("First client connected - changing master weight to 0 (automatic)")
backend_type = "GPU" if has_gpu else "CPU-only" backend_type = "GPU" if has_gpu else "CPU-only"
print(f"Client {client_id} authenticated ({backend_type}) with backends: {available_backends}") print(f"Client {client_id} authenticated ({backend_type}) with backends: {available_backends}")
...@@ -399,10 +396,7 @@ class ClusterMaster: ...@@ -399,10 +396,7 @@ class ClusterMaster:
for proc_type, queue in self.process_queue.items(): for proc_type, queue in self.process_queue.items():
self.process_queue[proc_type] = [(k, w) for k, w in queue if k != proc_key] self.process_queue[proc_type] = [(k, w) for k, w in queue if k != proc_key]
# If no clients remain and weight wasn't explicitly set, change master weight back to 100 # Update client count
if len(self.clients) == 0 and self.weight == 0 and not self.weight_explicit:
self.weight = 100
print("All clients disconnected - changing master weight back to 100 (automatic)")
print(f"Client {client_id} disconnected") print(f"Client {client_id} disconnected")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment