Fix job scheduling and JavaScript errors

- Fixed JavaScript error in analyze.html: 'data.result.substring is not a function' by checking if data.result is a string before calling substring, converting objects to JSON string if needed
- Added debug logging to cluster_master.select_worker_for_job() to diagnose why no distributed workers are found when GPU clients are connected
- Debug logs show available processes and process queue to help identify registration issues

This should resolve the JavaScript console error and help debug why cluster workers aren't being selected for jobs.
parent 71340283
......@@ -144,7 +144,8 @@
if (data.status === 'completed') {
statusHtml += '<p style="color: green;">✓ Job completed successfully!</p>';
if (data.result) {
statusHtml += `<p><strong>Result:</strong> ${data.result.substring(0, 200)}${data.result.length > 200 ? '...' : ''}</p>`;
let resultText = typeof data.result === 'string' ? data.result : JSON.stringify(data.result);
statusHtml += `<p><strong>Result:</strong> ${resultText.substring(0, 200)}${resultText.length > 200 ? '...' : ''}</p>`;
}
} else if (data.status === 'processing') {
statusHtml += '<p style="color: blue;">⟳ Job is being processed...</p>';
......
......@@ -772,8 +772,13 @@ class ClusterMaster:
"""Advanced worker selection based on VRAM requirements and job scheduling logic."""
from .models import estimate_model_vram_requirements
print(f"DEBUG: Selecting worker for {process_type}, model {model_path}")
print(f"DEBUG: Available processes: {list(self.processes.keys())}")
print(f"DEBUG: Process queue for {process_type}: {self.process_queue.get(process_type, [])}")
# Step 1: Determine VRAM required for the model
required_vram_gb = estimate_model_vram_requirements(model_path)
print(f"DEBUG: Required VRAM: {required_vram_gb}GB")
# Step 2: Determine workers with sufficient GPU memory
available_workers = []
......
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