Spaces:
Sleeping
Sleeping
log zerogpu endpoint tracebacks
Browse files- zerogpu_tinker_proxy.py +5 -0
- zerogpu_tinker_service.py +3 -0
zerogpu_tinker_proxy.py
CHANGED
|
@@ -13,6 +13,7 @@ bodies; dataset/reward/tokenization logic remains local.
|
|
| 13 |
from __future__ import annotations
|
| 14 |
|
| 15 |
import os
|
|
|
|
| 16 |
from typing import Any
|
| 17 |
|
| 18 |
from fastapi import FastAPI, Header, HTTPException, Request
|
|
@@ -74,6 +75,10 @@ def _call_space(route_name: str, key: str, body: dict[str, Any] | None = None) -
|
|
| 74 |
return _client().predict(key, api_name=api_name)
|
| 75 |
return _client().predict(key, body, api_name=api_name)
|
| 76 |
except Exception as exc: # noqa: BLE001
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
raise HTTPException(502, f"ZeroGPU Space call failed: {exc}")
|
| 78 |
|
| 79 |
|
|
|
|
| 13 |
from __future__ import annotations
|
| 14 |
|
| 15 |
import os
|
| 16 |
+
import traceback
|
| 17 |
from typing import Any
|
| 18 |
|
| 19 |
from fastapi import FastAPI, Header, HTTPException, Request
|
|
|
|
| 75 |
return _client().predict(key, api_name=api_name)
|
| 76 |
return _client().predict(key, body, api_name=api_name)
|
| 77 |
except Exception as exc: # noqa: BLE001
|
| 78 |
+
print(
|
| 79 |
+
f"ZeroGPU Space call failed for {route_name}: {exc!r}\n{traceback.format_exc()}",
|
| 80 |
+
flush=True,
|
| 81 |
+
)
|
| 82 |
raise HTTPException(502, f"ZeroGPU Space call failed: {exc}")
|
| 83 |
|
| 84 |
|
zerogpu_tinker_service.py
CHANGED
|
@@ -19,6 +19,7 @@ import os
|
|
| 19 |
import secrets
|
| 20 |
import sys
|
| 21 |
import time
|
|
|
|
| 22 |
import uuid
|
| 23 |
from contextlib import contextmanager
|
| 24 |
from dataclasses import dataclass
|
|
@@ -294,6 +295,8 @@ def _logged_endpoint(endpoint: str, fn):
|
|
| 294 |
endpoint=endpoint,
|
| 295 |
status="error",
|
| 296 |
error_type=type(exc).__name__,
|
|
|
|
|
|
|
| 297 |
duration_ms=round((time.monotonic() - started) * 1000, 2),
|
| 298 |
**context,
|
| 299 |
)
|
|
|
|
| 19 |
import secrets
|
| 20 |
import sys
|
| 21 |
import time
|
| 22 |
+
import traceback
|
| 23 |
import uuid
|
| 24 |
from contextlib import contextmanager
|
| 25 |
from dataclasses import dataclass
|
|
|
|
| 295 |
endpoint=endpoint,
|
| 296 |
status="error",
|
| 297 |
error_type=type(exc).__name__,
|
| 298 |
+
error=repr(exc),
|
| 299 |
+
traceback=traceback.format_exc(),
|
| 300 |
duration_ms=round((time.monotonic() - started) * 1000, 2),
|
| 301 |
**context,
|
| 302 |
)
|