fix(evaluator): prefer sync SDK for FilesetRef dataset download - #1211
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughChangesEvaluator SDK execution
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@plugins/nemo-evaluator/src/nemo_evaluator/jobs/evaluate.py`:
- Around line 91-93: Update the fallback HTTP-client setup in
AsyncEvaluator.run_local to reuse the custom client configuration from async_sdk
instead of constructing a fresh DefaultAsyncHttpxClient, preserving OAuth hooks,
proxy settings, and transport configuration. Add a regression test that passes a
customized platform client and verifies download_dataset receives those
settings.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: a8d2c814-dece-427f-9d96-b07c54594469
📒 Files selected for processing (2)
plugins/nemo-evaluator/src/nemo_evaluator/jobs/evaluate.pyplugins/nemo-evaluator/tests/test_evaluate_job.py
🚧 Files skipped from review as they are similar to previous changes (1)
- plugins/nemo-evaluator/tests/test_evaluate_job.py
Avoid binding the shared async platform client to a short-lived asyncio.run() loop before result-entity persistence. Signed-off-by: Arpit Singh (SW-CLOUD) <arpsingh@nvidia.com>
When only async_sdk is available, download through a fresh httpx client so the injected shared client is not bound to a short-lived asyncio.run loop. Signed-off-by: Arpit Singh (SW-CLOUD) <arpsingh@nvidia.com>
Share run_with_isolated_async_sdk across FilesetRef download, result persistence, and Intake publication so shared httpx clients are not bound to short-lived asyncio.run loops. Signed-off-by: Arpit Singh (SW-CLOUD) <arpsingh@nvidia.com>
Co-authored-by: Nick Goncharenko <8766167+ngoncharenko@users.noreply.github.com> Signed-off-by: Arpit Singh (SW-CLOUD) <arpsingh@nvidia.com>
Signed-off-by: Arpit Singh (SW-CLOUD) <arpsingh@nvidia.com>
f36b741 to
9f86a90
Compare
`test_prefers_sync_sdk_for_fileset_ref_when_both_sdks_injected` arrived from main in #1211, after this branch renamed the evaluate job's dataset call to `run_dataset_sync`. It mocked `run_sync`, so the job reached an auto-created Mock instead, which failed on the way into the result artifact as `TypeError: Object of type Mock is not JSON serializable`. Its four siblings in the same class already mock `run_dataset_sync` with the same helper; this brings the newcomer in line. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Sandy Chapman <schapman@nvidia.com>
Summary
What failed?
run_synccreates a new events loop. When async client is passed to it. It attaches client to this loop when function ends, the client is rendered unusable. Any downstream function using client runs into "Event loop closed" issue.GET /eval-results/{job_id}returned 404 — noEvaluateResultEntitywas persisted. The same shared-client/run_syncpattern can also break Intake publication after result-entity persistence on agent-eval jobs.Why? Dataset download (or entity save) and a later
run_synceach usedasyncio.run()on the sameAsyncNeMoPlatformhttpx client. The first loop closed after use; the next raiseEvent loop is closedwas swallowed as best-effort (persist) or surfaced as a publication failure.What is the fix?
NeMoPlatform+download_dataset_sync()when available.run_synccall sites, run work throughrun_with_isolated_async_sdk()so each call usesasync_sdk.copy(http_client=DefaultAsyncHttpxClient()).What to review
plugins/nemo-evaluator/src/nemo_evaluator/jobs/utils.py(run_with_isolated_async_sdk)plugins/nemo-evaluator/src/nemo_evaluator/jobs/evaluate.py(FilesetRef async download)plugins/nemo-evaluator/src/nemo_evaluator/jobs/result_persistence.py(entity save)plugins/nemo-evaluator/src/nemo_evaluator/jobs/publication.py(Intake publish)Related Issue
https://nvbugspro.nvidia.com/bug/6563418
Changes
jobs/utils.pyhelper that clones async SDK httpx for eachrun_syncType of Change
Quality Gates
Verification
Signed-off-by:traileruv run pre-commit run --fileson changed files passesTargeted validation:
Full plugin suite for the touched files:
111 passed.Live end-to-end repro
Ran the NVBug 6563418 reproduction steps against a local platform (
nemo services runwithentities,files,jobs,evaluator,secrets,models,inference-gateway,authplus thejobs/entitiescontrollers): created a real fileset, uploaded a JSONL dataset, submitted a row evaluation through
the public Evaluator SDK using
FilesetRef(root="default/<fileset>"), and waited for completion.evaluation-resultswas also downloadable from the persisted entity'sbundle_ref. The reportedsymptom for this bug was a 404 from that final retrieve; it now returns 200 with the aggregate
scores,
dataset_ref, andbundle_refpopulated.Summary by CodeRabbit
Summary by CodeRabbit
Bug Fixes
Tests