-
Notifications
You must be signed in to change notification settings - Fork 55
Surface remote eval errors instead of silently failing #322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,7 +75,11 @@ async def _send_job_enter( | |
| tasks: list[dict[str, Any]] | None = None, | ||
| hud_eval_config: dict[str, Any] | None = None, | ||
| ) -> list[str] | None: | ||
| """Send job enter payload (async request before traces start).""" | ||
| """Send job enter payload (async request before traces start). | ||
|
|
||
| Returns task_version_ids on success, None if telemetry is disabled. | ||
| Raises on any failure (network, bad response, etc). | ||
| """ | ||
| import httpx | ||
|
|
||
| from hud.eval.types import JobEnterPayload | ||
|
|
@@ -94,25 +98,20 @@ async def _send_job_enter( | |
| hud_eval_config=hud_eval_config, | ||
| ) | ||
|
|
||
| try: | ||
| async with httpx.AsyncClient(timeout=10.0) as client: | ||
| resp = await client.post( | ||
| f"{settings.hud_api_url}/trace/job/{job_id}/enter", | ||
| json=payload.model_dump(exclude_none=True), | ||
| headers={"Authorization": f"Bearer {api_key}"}, | ||
| ) | ||
| if resp.is_success: | ||
| try: | ||
| data = resp.json() | ||
| except Exception: | ||
| return None | ||
| if isinstance(data, dict): | ||
| ids = data.get("task_version_ids") | ||
| if isinstance(ids, list) and all(isinstance(x, str) for x in ids): | ||
| return ids | ||
| except Exception as e: | ||
| logger.warning("Failed to send job enter: %s", e) | ||
| return None | ||
| async with httpx.AsyncClient(timeout=10.0) as client: | ||
| resp = await client.post( | ||
| f"{settings.hud_api_url}/trace/job/{job_id}/enter", | ||
| json=payload.model_dump(exclude_none=True), | ||
| headers={"Authorization": f"Bearer {api_key}"}, | ||
| ) | ||
|
|
||
| resp.raise_for_status() | ||
| data = resp.json() | ||
| if isinstance(data, dict): | ||
| ids = data.get("task_version_ids") | ||
| if isinstance(ids, list) and all(isinstance(x, str) for x in ids): | ||
| return ids | ||
| raise ValueError(f"Job registration failed: unexpected response: {data}") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Raises on valid responses missing
|
||
|
|
||
|
|
||
| @asynccontextmanager | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.