add a scriptlet to put cuopt_grpc_server on the default path#1100
add a scriptlet to put cuopt_grpc_server on the default path#1100tmckayus wants to merge 3 commits intoNVIDIA:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds a console script entry Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
| ] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. | ||
|
|
||
| [project.scripts] | ||
| cuopt_grpc_server = "cuopt_server._grpc_server_wrapper:main" |
There was a problem hiding this comment.
added, and realize I left out the wrapper
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@python/cuopt_server/cuopt_server/tests/test_grpc_server_entry_point.py`:
- Around line 14-26: The test_cuopt_grpc_server_help currently calls
subprocess.run on the bare "cuopt_grpc_server" and only checks stdout, which can
raise FileNotFoundError and miss help output printed to stderr; update the test
to first locate the executable with shutil.which("cuopt_grpc_server") and call
pytest.skip if not found, or alternatively invoke the module via sys.executable
-m if an importable entrypoint exists, then call subprocess.run with
stderr=subprocess.STDOUT (or combine stdout/stderr) and a controlled env (e.g.,
env=os.environ.copy() with GPU vars like CUDA_VISIBLE_DEVICES cleared) so the
call is stream-agnostic and environment-isolated, and assert on the combined
output and returncode.
🪄 Autofix (Beta)
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: Pro Plus
Run ID: 9c80b148-7cb0-405c-b790-842b0fdb0941
📒 Files selected for processing (4)
conda/recipes/cuopt-server/recipe.yamlpython/cuopt_server/cuopt_server/_grpc_server_wrapper.pypython/cuopt_server/cuopt_server/tests/test_grpc_server_entry_point.pypython/cuopt_server/pyproject.toml
✅ Files skipped from review due to trivial changes (1)
- python/cuopt_server/pyproject.toml
| def test_cuopt_grpc_server_help(): | ||
| result = subprocess.run( | ||
| ["cuopt_grpc_server", "--help"], | ||
| capture_output=True, | ||
| text=True, | ||
| timeout=10, | ||
| ) | ||
| assert result.returncode == 0, ( | ||
| f"cuopt_grpc_server --help failed (rc={result.returncode}): {result.stderr}" | ||
| ) | ||
| assert "cuopt_grpc_server" in result.stdout, ( | ||
| f"Expected 'cuopt_grpc_server' in --help output, got: {result.stdout}" | ||
| ) |
There was a problem hiding this comment.
Make test_cuopt_grpc_server_help self-contained and stream-agnostic.
On Line 16, invoking the bare command can raise FileNotFoundError when this test runs independently in a misconfigured environment, and Line 24 only inspects stdout even though many CLIs print help to stderr.
Proposed test hardening
def test_cuopt_grpc_server_help():
+ exe = shutil.which("cuopt_grpc_server")
+ assert exe is not None, "cuopt_grpc_server should be on PATH before help test"
+
result = subprocess.run(
- ["cuopt_grpc_server", "--help"],
+ [exe, "--help"],
capture_output=True,
text=True,
timeout=10,
)
assert result.returncode == 0, (
f"cuopt_grpc_server --help failed (rc={result.returncode}): {result.stderr}"
)
- assert "cuopt_grpc_server" in result.stdout, (
- f"Expected 'cuopt_grpc_server' in --help output, got: {result.stdout}"
+ output = f"{result.stdout}\n{result.stderr}"
+ assert "cuopt_grpc_server" in output, (
+ f"Expected 'cuopt_grpc_server' in --help output, got: {output}"
)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/test_grpc_server_entry_point.py`
around lines 14 - 26, The test_cuopt_grpc_server_help currently calls
subprocess.run on the bare "cuopt_grpc_server" and only checks stdout, which can
raise FileNotFoundError and miss help output printed to stderr; update the test
to first locate the executable with shutil.which("cuopt_grpc_server") and call
pytest.skip if not found, or alternatively invoke the module via sys.executable
-m if an importable entrypoint exists, then call subprocess.run with
stderr=subprocess.STDOUT (or combine stdout/stderr) and a controlled env (e.g.,
env=os.environ.copy() with GPU vars like CUDA_VISIBLE_DEVICES cleared) so the
call is stream-agnostic and environment-isolated, and assert on the combined
output and returncode.
This changes adds a scriptlet for cuopt_grpc_server so that after installation of the cuopt-server-cuXX packages the binary is on the default path, similar to cuopt_cli.