Fix cluster client communication architecture

- Modified cluster client to connect to backend's TCP web port instead of worker Unix socket
- Backend acts as proper bridge: web interface (TCP)  workers (Unix socket)
- Cluster client now communicates with backend the same way as web interface
- This fixes the timeout issue and ensures proper job flow through the backend
parent 7986d63b
......@@ -299,13 +299,13 @@ class ClusterClient:
print(f"Received job assignment: {job_id} for process type: {process_type}")
# Forward job to local backend, which will route it to the appropriate worker
# Forward job to local backend via TCP (web interface), which will route it to the appropriate worker
try:
from .comm import SocketCommunicator
from .compat import get_socket_path
from .config import get_backend_web_port
# Connect to local backend
backend_comm = SocketCommunicator(socket_path=get_socket_path('worker'), comm_type='unix')
# Connect to local backend web server
backend_comm = SocketCommunicator(host='localhost', port=get_backend_web_port(), comm_type='tcp')
backend_comm.connect()
# Send job to backend
......@@ -333,12 +333,12 @@ class ClusterClient:
"""Monitor for job result from local backend."""
try:
from .comm import SocketCommunicator
from .compat import get_socket_path
from .config import get_backend_web_port
# Poll for result
for _ in range(300): # Poll for up to 5 minutes (300 * 1s)
try:
backend_comm = SocketCommunicator(socket_path=get_socket_path('worker'), comm_type='unix')
backend_comm = SocketCommunicator(host='localhost', port=get_backend_web_port(), comm_type='tcp')
backend_comm.connect()
# Send get_result request
......
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