Skip to content

Comments

fix how tests create service subprocess (causes errors with new cuda)#897

Merged
rapids-bot[bot] merged 1 commit intoNVIDIA:mainfrom
tmckayus:fixci
Feb 23, 2026
Merged

fix how tests create service subprocess (causes errors with new cuda)#897
rapids-bot[bot] merged 1 commit intoNVIDIA:mainfrom
tmckayus:fixci

Conversation

@tmckayus
Copy link
Contributor

@tmckayus tmckayus commented Feb 23, 2026

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

  • Tests
    • Refactored test server startup configuration to use explicit command-line arguments instead of environment variables for improved test flexibility and reliability.

@tmckayus tmckayus requested a review from a team as a code owner February 23, 2026 17:22
@tmckayus tmckayus requested a review from Iroy30 February 23, 2026 17:22
@tmckayus tmckayus added bug Something isn't working non-breaking Introduces a non-breaking change P0 labels Feb 23, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 23, 2026

📝 Walkthrough

Walkthrough

Three test files were updated to migrate from hardcoded environment variable configuration to command-line argument configuration for the cuopt server process. Changes include adding os imports, replacing static environment dictionaries with os.environ.copy(), and updating server invocation to use explicit CLI flags (-i, -p, -l) instead of environment variables.

Changes

Cohort / File(s) Summary
Test Configuration Migration
python/cuopt_server/cuopt_server/tests/test_bill_logging.py, python/cuopt_server/cuopt_server/tests/test_server_health.py, python/cuopt_server/cuopt_server/tests/utils/utils.py
Migrated cuopt server process startup from environment variable configuration to command-line arguments. Updated environment handling to use os.environ.copy() with selective overrides and changed server invocation to pass explicit host, port, and log level via CLI flags (-i, -p, -l).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main change: fixing how tests create service subprocesses to work with new CUDA by passing full environment to child processes instead of partial environment variables.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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 to scope="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

📥 Commits

Reviewing files that changed from the base of the PR and between fcfd4f0 and 6a5d662.

📒 Files selected for processing (3)
  • python/cuopt_server/cuopt_server/tests/test_bill_logging.py
  • python/cuopt_server/cuopt_server/tests/test_server_health.py
  • python/cuopt_server/cuopt_server/tests/utils/utils.py

@tmckayus
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit d54b193 into NVIDIA:main Feb 23, 2026
89 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Introduces a non-breaking change P0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants