-
Notifications
You must be signed in to change notification settings - Fork 107
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
Add --network-mode option #734
Conversation
Signed-off-by: Joshua Stone <[email protected]> Signed-off-by: Daniel J Walsh <[email protected]>
Reviewer's Guide by SourceryThis pull request adds a Sequence diagram for container execution with network modesequenceDiagram
participant User
participant CLI
participant Model
participant Container
User->>CLI: Execute command with --network-mode
CLI->>Model: setup_container(args)
Model->>Container: Create container with network mode
Note over Container: Network access controlled by<br/>specified network mode
Container-->>Model: Container created
Model-->>CLI: Setup complete
CLI-->>User: Command execution result
Class diagram showing CLI argument changesclassDiagram
class ArgumentParser {
+add_argument()
}
class SubParsers {
bench_parser
convert_parser
push_parser
run_parser
serve_parser
}
class NetworkModeOption {
--network-mode: str
default: str
help: str
}
SubParsers --> ArgumentParser
ArgumentParser --> NetworkModeOption
note for NetworkModeOption "Added to all subcommands\nDefaults:\n- 'none' for most commands\n- '' for serve command"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @rhatdan - I've reviewed your changes - here's some feedback:
Overall Comments:
- The --network-mode default value is inconsistently set to an empty string for the serve command while all other commands use 'none'. Consider changing serve to also default to 'none' for consistency.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@@ -188,6 +188,8 @@ def setup_container(self, args): | |||
if k == "CUDA_VISIBLE_DEVICES": | |||
conman_args += ["--device", "nvidia.com/gpu=all"] | |||
conman_args += ["-e", f"{k}={v}"] | |||
if args.network_mode != "": |
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.
Nice and simple fix :)
Summary by Sourcery
New Features:
--network-mode
option to thebench
,convert
,push
,run
, andserve
commands. This option allows users to specify the network mode for the container, such ashost
,bridge
, ornone
.