feat: allow watch pid with pre-created group.#60
Conversation
Signed-off-by: Huamin Chen <hchen@redhat.com>
Thank you for your contribution. The reason sample test is failing because the Please share output with a successful run on a MIG device and suggested changes. |
| for _, gpu := range pidInfo { | ||
| log.Printf("gpu %d, process info: %+v\n", gpu.GPU, gpu) | ||
| } |
There was a problem hiding this comment.
Please consider using template for output same as samples/processInfo/main.go for consistency.
| // create a tick to watch the process every 5 seconds | ||
| ticker := time.NewTicker(5 * time.Second) | ||
| defer ticker.Stop() | ||
| for range ticker.C { |
There was a problem hiding this comment.
Consider running it once or twice but not every 5 seconds.
| if err != nil { | ||
| return fmt.Errorf("failed to find supported devices: %v", err) | ||
| } | ||
| log.Printf("found %d supported devices\n", len(supportedDeviceIndices)) |
There was a problem hiding this comment.
nit:
s/found/Found
as it is not an error.
Fix #59
The existing
WatchPidFieldsExAPI always creates device group. If the MIG is enabled, the device group doesn't capture the MIG device and may fail to watch processes there.The PR allows a pre-created device to pass into the
WatchPidFieldsWithGroupAPI.I am also adding a sample test file here, but for certain reason I am not able to run it successfully:
In fact, the existing sample also failed with the same error: