update debug for deploment
This commit is contained in:
parent
45222fdd06
commit
be44e6214a
@ -215,22 +215,42 @@ class PipelineStage:
|
|||||||
timeout_start = time.time()
|
timeout_start = time.time()
|
||||||
while time.time() - timeout_start < 5.0: # 5 second timeout
|
while time.time() - timeout_start < 5.0: # 5 second timeout
|
||||||
result = self.multidongle.get_latest_inference_result(timeout=0.1)
|
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 result is not None:
|
||||||
if isinstance(result, dict):
|
if isinstance(result, tuple) and len(result) == 2:
|
||||||
if result: # Non-empty dict
|
# 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
|
inference_result = result
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
# For tuple results like (probability, result_string)
|
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
|
inference_result = result
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
print(f"[Stage {self.stage_id}] Empty dict result")
|
||||||
|
else:
|
||||||
|
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)
|
time.sleep(0.01)
|
||||||
|
|
||||||
# Check if inference_result is empty (handle both dict and tuple types)
|
# 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):
|
if (inference_result is None or
|
||||||
print(f"[Stage {self.stage_id}] Warning: No inference result received")
|
(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'}
|
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)
|
# Step 3: Output postprocessing (inter-stage)
|
||||||
processed_result = inference_result
|
processed_result = inference_result
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user