-
Notifications
You must be signed in to change notification settings - Fork 61
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
Change how docker run args are built #267
base: master
Are you sure you want to change the base?
Conversation
instead of constructing new list objects every time the list has items appended to it, use python's list mutator functions (append and extend)
5f1683d
to
56cd69e
Compare
Make distDocker's runJob similar to localDocker's. Build a list of args instead of assembling nested strings. Make sure to preserve quoting of interior arguments. This has the effect of making the vm core and memory limits effective for distDocker
56cd69e
to
bff657d
Compare
tested with distDocker |
📝 Walkthrough📝 WalkthroughWalkthroughThe pull request introduces modifications to Docker-related classes in Changes
Sequence DiagramsequenceDiagram
participant Client
participant DockerClass
participant SSHConnection
participant DockerContainer
Client->>DockerClass: runJob()
DockerClass->>DockerClass: Construct Docker run arguments
DockerClass->>SSHConnection: Execute Docker run command
SSHConnection->>DockerContainer: Start container
DockerContainer-->>SSHConnection: Container execution result
SSHConnection-->>DockerClass: Return execution result
DockerClass-->>Client: Job result
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
vmms/localDocker.py (1)
179-183
: Consider using an f-string for better readability.While the implementation is correct, the command string could be more readable using an f-string.
- args.append( - 'cp -r mount/* autolab/; su autolab -c "%s"; \ - cp output/feedback mount/feedback' - % autodriverCmd - ) + args.append( + f'cp -r mount/* autolab/; su autolab -c "{autodriverCmd}"; \ + cp output/feedback mount/feedback' + )vmms/distDocker.py (1)
292-296
: Consider adding a comment about SSH command quoting.While the implementation is correct, it would be helpful to document why the extra quotes are necessary for SSH command execution.
+ # Double quotes are required for proper SSH command execution args.append( f"\"cp -r mount/* autolab/; su autolab -c '{autodriverCmd}'; \ cp output/feedback mount/feedback\"" )
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
vmms/distDocker.py
(2 hunks)vmms/localDocker.py
(2 hunks)
🔇 Additional comments (4)
vmms/localDocker.py (2)
159-165
: LGTM! Clean implementation of Docker run arguments.
The implementation properly handles resource limits and network configuration using list operations, making the code more maintainable and less error-prone.
166-167
: LGTM! Consistent use of list operations.
The image and shell command arguments are added consistently using list operations.
vmms/distDocker.py (2)
283-291
: LGTM! Successfully aligned with localDocker implementation.
The implementation correctly mirrors the approach in localDocker.py, maintaining consistency across both Docker implementations.
305-306
: LGTM! Clean SSH command construction.
The SSH command construction is properly implemented using list operations.
append only takes a single value, make sure the arg is a single string. use f-strings to build string values from multiple components.
There are 2 changes here
This isn't tested yet. I'll try to do that by next tuesday or so.