-
Notifications
You must be signed in to change notification settings - Fork 161
add a scriptlet to put cuopt_grpc_server on the default path #1100
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
Open
tmckayus
wants to merge
3
commits into
NVIDIA:main
Choose a base branch
from
tmckayus:grpcpath
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+50
−0
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import os | ||
| import subprocess | ||
| import sys | ||
|
|
||
|
|
||
| def main(): | ||
| """ | ||
| Wrapper that launches the cuopt_grpc_server binary from the libcuopt package. | ||
| """ | ||
| import libcuopt | ||
|
|
||
| server_path = os.path.join( | ||
| os.path.dirname(libcuopt.__file__), "bin", "cuopt_grpc_server" | ||
| ) | ||
| sys.exit(subprocess.call([server_path] + sys.argv[1:])) |
26 changes: 26 additions & 0 deletions
26
python/cuopt_server/cuopt_server/tests/test_grpc_server_entry_point.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import shutil | ||
| import subprocess | ||
|
|
||
|
|
||
| def test_cuopt_grpc_server_on_path(): | ||
| assert shutil.which("cuopt_grpc_server") is not None, ( | ||
| "cuopt_grpc_server should be on PATH after installing cuopt-server" | ||
| ) | ||
|
|
||
|
|
||
| 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}" | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,6 +52,9 @@ test = [ | |
| "requests", | ||
| ] # 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" | ||
|
Collaborator
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. @tmckayus Would we need a test for this ?
Contributor
Author
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. added, and realize I left out the wrapper |
||
|
|
||
| [project.urls] | ||
| Homepage = "https://docs.nvidia.com/cuopt/introduction.html" | ||
| Source = "https://github.com/nvidia/cuopt" | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make
test_cuopt_grpc_server_helpself-contained and stream-agnostic.On Line 16, invoking the bare command can raise
FileNotFoundErrorwhen this test runs independently in a misconfigured environment, and Line 24 only inspectsstdouteven though many CLIs print help tostderr.Proposed test hardening
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