Spaces:
Running on Zero
Running on Zero
update
Browse files
app.py
CHANGED
|
@@ -220,12 +220,17 @@ def _append_trace(trace_path: str, stage: str) -> None:
|
|
| 220 |
handle.flush()
|
| 221 |
|
| 222 |
|
| 223 |
-
def _read_trace(trace_path: str
|
| 224 |
trace_file = Path(trace_path)
|
| 225 |
if not trace_file.exists():
|
| 226 |
return ""
|
| 227 |
-
|
| 228 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
|
| 230 |
|
| 231 |
def _export_glb_from_points(xyz: np.ndarray, rgb: np.ndarray, output_path: Path) -> None:
|
|
@@ -368,7 +373,7 @@ def run_demo(
|
|
| 368 |
return result.depth_vis, glb_path.as_posix(), download_files, status
|
| 369 |
except Exception as exc:
|
| 370 |
error_trace = traceback.format_exc()
|
| 371 |
-
|
| 372 |
Log.exception(f"[{request_id}] run_demo failed")
|
| 373 |
|
| 374 |
# Classify the error for clearer diagnostics
|
|
@@ -387,13 +392,13 @@ def run_demo(
|
|
| 387 |
else:
|
| 388 |
error_message = f"Error [{request_id}] ({exc_type}): {exc}"
|
| 389 |
|
| 390 |
-
if
|
| 391 |
-
error_message = f"{error_message}\n\
|
| 392 |
-
if
|
| 393 |
error_message = f"{error_message}\n\n{error_trace}"
|
| 394 |
# Always log full traceback to server logs (visible in HF Space Logs tab)
|
| 395 |
Log.error(f"[{request_id}] trace_path={trace_path}")
|
| 396 |
-
Log.error(f"[{request_id}]
|
| 397 |
Log.error(f"[{request_id}] Full traceback:\n{error_trace}")
|
| 398 |
return None, None, [], error_message
|
| 399 |
|
|
|
|
| 220 |
handle.flush()
|
| 221 |
|
| 222 |
|
| 223 |
+
def _read_trace(trace_path: str) -> str:
|
| 224 |
trace_file = Path(trace_path)
|
| 225 |
if not trace_file.exists():
|
| 226 |
return ""
|
| 227 |
+
return trace_file.read_text(encoding="utf-8").rstrip()
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
def _should_show_full_traceback() -> bool:
|
| 231 |
+
if SPACE_RUNTIME:
|
| 232 |
+
return True
|
| 233 |
+
return os.getenv("INFINIDEPTH_SHOW_TRACEBACK", "0") == "1"
|
| 234 |
|
| 235 |
|
| 236 |
def _export_glb_from_points(xyz: np.ndarray, rgb: np.ndarray, output_path: Path) -> None:
|
|
|
|
| 373 |
return result.depth_vis, glb_path.as_posix(), download_files, status
|
| 374 |
except Exception as exc:
|
| 375 |
error_trace = traceback.format_exc()
|
| 376 |
+
trace_content = _read_trace(trace_path)
|
| 377 |
Log.exception(f"[{request_id}] run_demo failed")
|
| 378 |
|
| 379 |
# Classify the error for clearer diagnostics
|
|
|
|
| 392 |
else:
|
| 393 |
error_message = f"Error [{request_id}] ({exc_type}): {exc}"
|
| 394 |
|
| 395 |
+
if trace_content:
|
| 396 |
+
error_message = f"{error_message}\n\nWorker trace:\n{trace_content}"
|
| 397 |
+
if _should_show_full_traceback():
|
| 398 |
error_message = f"{error_message}\n\n{error_trace}"
|
| 399 |
# Always log full traceback to server logs (visible in HF Space Logs tab)
|
| 400 |
Log.error(f"[{request_id}] trace_path={trace_path}")
|
| 401 |
+
Log.error(f"[{request_id}] Worker trace:\n{trace_content or '<none>'}")
|
| 402 |
Log.error(f"[{request_id}] Full traceback:\n{error_trace}")
|
| 403 |
return None, None, [], error_message
|
| 404 |
|