From be44e6214ac021cebcb0956184002eaae8a1378f Mon Sep 17 00:00:00 2001 From: Masonmason Date: Thu, 17 Jul 2025 12:05:10 +0800 Subject: [PATCH] update debug for deploment --- .../core/functions/InferencePipeline.py | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/cluster4npu_ui/core/functions/InferencePipeline.py b/cluster4npu_ui/core/functions/InferencePipeline.py index ead58f2..760f672 100644 --- a/cluster4npu_ui/core/functions/InferencePipeline.py +++ b/cluster4npu_ui/core/functions/InferencePipeline.py @@ -215,22 +215,42 @@ class PipelineStage: timeout_start = time.time() while time.time() - timeout_start < 5.0: # 5 second timeout result = self.multidongle.get_latest_inference_result(timeout=0.1) - # Check if result is not None and not an empty dict/tuple + print(f"[Stage {self.stage_id}] Got result from MultiDongle: {result}") + + # Check if result is valid (not None, not (None, None)) if result is not None: - if isinstance(result, dict): - if result: # Non-empty dict + if isinstance(result, tuple) and len(result) == 2: + # Handle tuple results like (probability, result_string) + prob, result_str = result + if prob is not None and result_str is not None: + print(f"[Stage {self.stage_id}] Valid result: prob={prob}, result={result_str}") inference_result = result break + else: + print(f"[Stage {self.stage_id}] Invalid tuple result: prob={prob}, result={result_str}") + elif isinstance(result, dict): + if result: # Non-empty dict + print(f"[Stage {self.stage_id}] Valid dict result: {result}") + inference_result = result + break + else: + print(f"[Stage {self.stage_id}] Empty dict result") else: - # For tuple results like (probability, result_string) + print(f"[Stage {self.stage_id}] Other result type: {type(result)}") inference_result = result break + else: + print(f"[Stage {self.stage_id}] No result yet, waiting...") time.sleep(0.01) # Check if inference_result is empty (handle both dict and tuple types) - if inference_result is None or (isinstance(inference_result, dict) and not inference_result): - print(f"[Stage {self.stage_id}] Warning: No inference result received") + if (inference_result is None or + (isinstance(inference_result, dict) and not inference_result) or + (isinstance(inference_result, tuple) and (not inference_result or inference_result == (None, None)))): + print(f"[Stage {self.stage_id}] Warning: No inference result received after 5 second timeout") inference_result = {'probability': 0.0, 'result': 'No Result'} + else: + print(f"[Stage {self.stage_id}] ✅ Successfully received inference result: {inference_result}") # Step 3: Output postprocessing (inter-stage) processed_result = inference_result