-
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
Update logic to set environment for calls out to nvidia-smi #110
Conversation
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.
Some questions / comments.
cmd/nvidia-dra-plugin/nvlib.go
Outdated
@@ -495,11 +511,19 @@ func (l deviceLib) setTimeSlice(uuids []string, timeSlice int) error { | |||
} | |||
|
|||
func (l deviceLib) setComputeMode(uuids []string, mode string) error { | |||
// In order for nvidia-smi to run, we need to set the PATH to the parent of |
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.
Does it make sense to add a runNvidiaSMI
method to encapsulate this logic?
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.
i thought about it, but purposefully didn't since there are only 2 instances of this call and we want to drop the second one soon.
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.
LGTM.
Just tested this before merging and it doesn't seem to work:
|
I think wrapping the call in a "bash -c" would likely work. |
f44f0ba
to
b338e30
Compare
Previously, we were setting the envvars needed for nvidia-smi in the plugin's environment itself. This caused errors, however, when shelling out to other binaries that didn't need these envvars set. This change pushes the setting of the envvars into the actual exec call for nvidia-smi instead of setting them in the plugin's environment itself. Closes NVIDIA#106 Signed-off-by: Kevin Klues <[email protected]>
Previously, we were setting the envvars needed for nvidia-smi in the plugin's environment itself. This caused errors, however, when shelling out to other binaries that didn't need these envvars set.
This change pushes the setting of the envvars into the actual exec call for nvidia-smi instead of setting them in the plugin's environment itself.
Closes #106