fix how tests create service subprocess (causes errors with new cuda)#897
fix how tests create service subprocess (causes errors with new cuda)#897rapids-bot[bot] merged 1 commit intoNVIDIA:mainfrom
Conversation
📝 WalkthroughWalkthroughThree test files were updated to migrate from hardcoded environment variable configuration to command-line argument configuration for the cuopt server process. Changes include adding Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
python/cuopt_server/cuopt_server/tests/utils/utils.py (1)
315-316: Consider narrowing fixture scope to reduce inter-test contamination.
scope="session"means all tests share one server process for the entire pytest run. Queued requests, cached responses, or GPU allocations from an earlier test can silently influence later ones. Switching toscope="module"(or adding an explicit request-flush/health-reset call in the fixture's teardown) would better align with the test isolation requirement.As per coding guidelines: "Ensure test isolation: prevent GPU state, cached memory, and global variables from leaking between test cases; verify each test independently initializes its environment."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@python/cuopt_server/cuopt_server/tests/utils/utils.py` around lines 315 - 316, The cuoptproc pytest fixture currently uses scope="session" which lets one server process be shared across all tests; change the fixture declaration for cuoptproc to scope="module" (or, alternatively, add explicit teardown/reset logic inside the cuoptproc fixture that flushes queued requests, clears GPU state, and/or calls the server health-reset API between tests) so each module gets an isolated server instance; update the decorator on the cuoptproc fixture and/or add calls to the server reset/cleanup functions in its teardown block to ensure no cached responses, queued requests, or GPU allocations persist across tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@python/cuopt_server/cuopt_server/tests/utils/utils.py`:
- Around line 315-316: The cuoptproc pytest fixture currently uses
scope="session" which lets one server process be shared across all tests; change
the fixture declaration for cuoptproc to scope="module" (or, alternatively, add
explicit teardown/reset logic inside the cuoptproc fixture that flushes queued
requests, clears GPU state, and/or calls the server health-reset API between
tests) so each module gets an isolated server instance; update the decorator on
the cuoptproc fixture and/or add calls to the server reset/cleanup functions in
its teardown block to ensure no cached responses, queued requests, or GPU
allocations persist across tests.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
python/cuopt_server/cuopt_server/tests/test_bill_logging.pypython/cuopt_server/cuopt_server/tests/test_server_health.pypython/cuopt_server/cuopt_server/tests/utils/utils.py
|
/merge |
Recent changes in CUDA and related Python libraries exposed a bug in cuOpt service tests where subprocesses to run the server were started without a full copy of the parent environment. This omitted things like the CONDA path, etc. Previously this was harmless, but library loading code in CUDA is more sophisticated now and missing env vars cause unexpected errors.
Summary by CodeRabbit