Skip to content

Commit aee4193

Browse files
committed
cleanup
1 parent 107cae3 commit aee4193

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

eval_protocol/adapters/fireworks_tracing.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ def __init__(
264264
self.project_id = project_id
265265
self.base_url = base_url.rstrip("/")
266266
self.timeout = timeout
267-
# Reuse a single session for connection pooling and to avoid leaking FDs.
268267
self._session = requests.Session()
269268

270269
def search_logs(self, tags: List[str], limit: int = 100, hours_back: int = 24) -> List[Dict[str, Any]]:
@@ -415,21 +414,19 @@ def get_evaluation_rows(
415414
result = None
416415
try:
417416
with self._session.get(url, params=params, timeout=self.timeout, headers=headers) as response:
418-
response.raise_for_status()
417+
if response.status_code >= 400:
418+
error_msg: str = response.text
419+
try:
420+
payload = response.json()
421+
if isinstance(payload, dict) and "detail" in payload:
422+
detail = payload.get("detail")
423+
if detail:
424+
error_msg = str(detail)
425+
except Exception:
426+
pass
427+
logger.error("Failed to fetch traces from proxy (HTTP %s): %s", response.status_code, error_msg)
428+
return eval_rows
419429
result = response.json()
420-
except requests.exceptions.HTTPError as e:
421-
error_msg = str(e)
422-
423-
# Try to extract detail message from response
424-
if e.response is not None:
425-
try:
426-
error_detail = e.response.json().get("detail", {})
427-
error_msg = error_detail or e.response.text
428-
except Exception: # In case e.response.json() fails
429-
error_msg = f"Proxy error: {e.response.text}"
430-
431-
logger.error("Failed to fetch traces from proxy (HTTP %s): %s", e.response.status_code, error_msg)
432-
return eval_rows
433430
except requests.exceptions.RequestException as e:
434431
# Non-HTTP errors (network issues, timeouts, etc.)
435432
logger.error("Failed to fetch traces from proxy: %s", str(e))

eval_protocol/pytest/remote_rollout_processor.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def __init__(
5454
self._timeout_seconds = timeout_seconds
5555
self._output_data_loader = output_data_loader or default_fireworks_output_data_loader
5656
self._tracing_adapter = FireworksTracingAdapter(base_url=self._model_base_url)
57-
5857
self._session = requests.Session()
5958

6059
def __call__(self, rows: List[EvaluationRow], config: RolloutProcessorConfig) -> List[asyncio.Task[EvaluationRow]]:
@@ -206,6 +205,10 @@ async def _sem_wrapper(r: EvaluationRow) -> EvaluationRow:
206205
return tasks
207206

208207
def cleanup(self) -> None:
208+
try:
209+
self._tracing_adapter.close()
210+
except Exception:
211+
pass
209212
try:
210213
self._session.close()
211214
except Exception:

0 commit comments

Comments
 (0)