|
193 | 193 | } |
194 | 194 |
|
195 | 195 | var err error |
196 | | - for _, devicesInUse := range listDevicesAvailable { |
197 | | - switch devicesInUse.deviceType { |
| 196 | + for id, _ := range listDevicesAvailable { |
| 197 | + switch listDevicesAvailable[id].deviceType { |
198 | 198 | case deviceFileType : |
199 | | - devicesInUse.devicePluginSmarter = NewSmarterDevicePlugin(devicesInUse.numDevices, devicesInUse.deviceFile, devicesInUse.deviceName, devicesInUse.socketName) |
200 | | - if err = devicesInUse.devicePluginSmarter.Serve(); err != nil { |
| 199 | + listDevicesAvailable[id].devicePluginSmarter = NewSmarterDevicePlugin(listDevicesAvailable[id].numDevices, listDevicesAvailable[id].deviceFile, listDevicesAvailable[id].deviceName, listDevicesAvailable[id].socketName) |
| 200 | + if err = listDevicesAvailable[id].devicePluginSmarter.Serve(); err != nil { |
201 | 201 | glog.V(0).Info("Could not contact Kubelet, retrying. Did you enable the device plugin feature gate?") |
202 | 202 | break |
203 | 203 | } |
204 | 204 | case nvidiaSysType : |
205 | | - devicesInUse.devicePluginNvidia = NewNvidiaDevicePlugin(devicesInUse.numDevices, devicesInUse.deviceName,"NVIDIA_VISIBLE_DEVICES", devicesInUse.socketName, devicesInUse.deviceId) |
206 | | - if err = devicesInUse.devicePluginNvidia.Serve(); err != nil { |
| 205 | + listDevicesAvailable[id].devicePluginNvidia = NewNvidiaDevicePlugin(listDevicesAvailable[id].numDevices, listDevicesAvailable[id].deviceName,"NVIDIA_VISIBLE_DEVICES", listDevicesAvailable[id].socketName, listDevicesAvailable[id].deviceId) |
| 206 | + if err = listDevicesAvailable[id].devicePluginNvidia.Serve(); err != nil { |
207 | 207 | glog.V(0).Info("Could not contact Kubelet, retrying. Did you enable the device plugin feature gate?") |
208 | 208 | break |
209 | 209 | } |
|
234 | 234 | default: |
235 | 235 | glog.V(0).Infof("Received signal \"%v\", shutting down.", s) |
236 | 236 | for _, devicesInUse := range listDevicesAvailable { |
| 237 | + glog.V(0).Info("Stopping device ", devicesInUse.deviceName) |
237 | 238 | switch devicesInUse.deviceType { |
238 | 239 | case deviceFileType : |
| 240 | + glog.V(0).Info("Smarter device type") |
239 | 241 | if devicesInUse.devicePluginSmarter != nil { |
| 242 | + glog.V(0).Info("Stopping device") |
240 | 243 | devicesInUse.devicePluginSmarter.Stop() |
241 | 244 | } |
242 | 245 | case nvidiaSysType : |
| 246 | + glog.V(0).Info("Nvidia device type") |
243 | 247 | if devicesInUse.devicePluginNvidia != nil { |
| 248 | + glog.V(0).Info("Stopping device") |
244 | 249 | devicesInUse.devicePluginNvidia.Stop() |
245 | 250 | } |
246 | 251 | } |
|
0 commit comments