Skip to content

Commit 7eb7526

Browse files
committed
Merge branch 'dev' into 'master'
Dev See merge request arm-research/smarter/smarter-device-manager!13
2 parents 43009d9 + 304807e commit 7eb7526

12 files changed

+49
-18
lines changed

compile.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
function printHelp() {
66
echo $(basename $0)" options:";
77
echo " -A <Architectures to use> # Compiling to ${ARCHS} now, examples: linux/amd64,linux/arm/v7,linux/arm/v6,linux/arm64"
8+
if [ ${FLAG_NOCACHE} -gt 0 ]
9+
then
10+
echo " -C # Do not use cache"
11+
else
12+
echo " -C # Use cache"
13+
fi
814
if [ ${FLAG_UPLOADIMAGES} -gt 0 ]
915
then
1016
echo " -U # Do not upload images - the default is upload the images to the registry"
@@ -43,15 +49,20 @@ FLAG_UPLOADMANIFEST=1
4349
ADDITIONAL_TAG=""
4450
ADDITIONAL_IMAGE_NAME=""
4551
PUSH_OPTION=""
52+
FLAG_NOCACHE=0
4653

47-
while getopts hA:B:MST:U name
54+
while getopts hA:B:MST:UC name
4855
do
4956
case $name in
5057
h)
5158
printHelp;
5259
exit 0;;
5360
A)
5461
ARCHS="$OPTARG";;
62+
C)
63+
[ ${FLAG_NOCACHE} -gt 0 ] && FLAG_NOCACHE=0;
64+
[ ${FLAG_NOCACHE} -eq 0 ] && FLAG_NOCACHE=1;
65+
;;
5566
U)
5667
[ ${FLAG_UPLOADIMAGES} -gt 0 ] && FLAG_UPLOADIMAGES=0;
5768
[ ${FLAG_UPLOADIMAGES} -eq 0 ] && FLAG_UPLOADIMAGES=1;
@@ -93,13 +104,20 @@ EOF
93104
fi
94105
fi
95106

107+
if [ $FLAG_NOCACHE -gt 0 ]
108+
then
109+
CACHE_OPTION="--no-cache"
110+
else
111+
CACHE_OPTION=""
112+
fi
113+
96114
if [ $FLAG_UPLOADIMAGES -gt 0 ]
97115
then
98116
PUSH_OPTION="--push"
99117
else
100118
PUSH_OPTION="--load"
101119
fi
102120

103-
docker buildx build -t "${REPOSITORY_NAME}${IMAGE_NAME}${ADDITIONAL_IMAGE_NAME}:${BUILD_TAG}" --platform=${ARCHS} ${PUSH_OPTION} .
121+
docker buildx build ${CACHE_OPTION} -t "${REPOSITORY_NAME}${IMAGE_NAME}${ADDITIONAL_IMAGE_NAME}:${BUILD_TAG}" --platform=${ARCHS} ${PUSH_OPTION} .
104122

105123
exit 0

main.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,17 @@ L:
193193
}
194194

195195
var err error
196-
for _, devicesInUse := range listDevicesAvailable {
197-
switch devicesInUse.deviceType {
196+
for id, _ := range listDevicesAvailable {
197+
switch listDevicesAvailable[id].deviceType {
198198
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 {
201201
glog.V(0).Info("Could not contact Kubelet, retrying. Did you enable the device plugin feature gate?")
202202
break
203203
}
204204
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 {
207207
glog.V(0).Info("Could not contact Kubelet, retrying. Did you enable the device plugin feature gate?")
208208
break
209209
}
@@ -234,13 +234,18 @@ L:
234234
default:
235235
glog.V(0).Infof("Received signal \"%v\", shutting down.", s)
236236
for _, devicesInUse := range listDevicesAvailable {
237+
glog.V(0).Info("Stopping device ", devicesInUse.deviceName)
237238
switch devicesInUse.deviceType {
238239
case deviceFileType :
240+
glog.V(0).Info("Smarter device type")
239241
if devicesInUse.devicePluginSmarter != nil {
242+
glog.V(0).Info("Stopping device")
240243
devicesInUse.devicePluginSmarter.Stop()
241244
}
242245
case nvidiaSysType :
246+
glog.V(0).Info("Nvidia device type")
243247
if devicesInUse.devicePluginNvidia != nil {
248+
glog.V(0).Info("Stopping device")
244249
devicesInUse.devicePluginNvidia.Stop()
245250
}
246251
}

server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,15 @@ func (m *SmarterDevicePlugin) Start() error {
9494

9595
// Stop the gRPC server
9696
func (m *SmarterDevicePlugin) Stop() error {
97+
glog.V(0).Infof("Stopping server with socket ",m.socket)
9798
if m.server == nil {
9899
return nil
99100
}
100101

101102
m.server.Stop()
102103
m.server = nil
103104
close(m.stop)
105+
glog.V(0).Info("Server stopped with socket ",m.socket)
104106

105107
return m.cleanup()
106108
}
@@ -179,6 +181,7 @@ func (m *SmarterDevicePlugin) PreStartContainer(context.Context, *pluginapi.PreS
179181
}
180182

181183
func (m *SmarterDevicePlugin) cleanup() error {
184+
glog.V(0).Info("Removing file ",m.socket)
182185
if err := os.Remove(m.socket); err != nil && !os.IsNotExist(err) {
183186
return err
184187
}

smarter-device-management-pod-k3s-test-xavier.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ spec:
1515
nodeName: smarter-jetson-xavier-4bcc2584
1616
containers:
1717
- name: smarter-device-manager
18-
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.1.1
18+
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.1.2
1919
imagePullPolicy: IfNotPresent
2020
securityContext:
2121
allowPrivilegeEscalation: false

smarter-device-management-pod-k3s.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ spec:
1515
nodeName: <replace with node to run>
1616
containers:
1717
- name: smarter-device-manager
18-
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.1.1
18+
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.1.2
1919
imagePullPolicy: IfNotPresent
2020
securityContext:
2121
allowPrivilegeEscalation: false

smarter-device-management-pod.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ spec:
1515
nodeName: <replace with node to run>
1616
containers:
1717
- name: smarter-device-manager
18-
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.1.1
18+
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.1.2
1919
imagePullPolicy: IfNotPresent
2020
securityContext:
2121
allowPrivilegeEscalation: false
@@ -33,11 +33,16 @@ spec:
3333
mountPath: /var/lib/kubelet/device-plugins
3434
- name: dev-dir
3535
mountPath: /dev
36+
- name: sys-dir
37+
mountPath: /sys
3638
volumes:
3739
- name: device-plugin
3840
hostPath:
3941
path: /var/lib/kubelet/device-plugins
4042
- name: dev-dir
4143
hostPath:
4244
path: /dev
43-
terminationGracePeriodSeconds: 30
45+
- name: sys-dir
46+
hostPath:
47+
path: /sys
48+
terminationGracePeriodSeconds: 30

smarter-device-manager-ds-k3s.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ spec:
3434
dnsPolicy: ClusterFirstWithHostNet
3535
containers:
3636
- name: smarter-device-manager
37-
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.1.1
37+
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.1.2
3838
imagePullPolicy: IfNotPresent
3939
securityContext:
4040
allowPrivilegeEscalation: false

smarter-device-manager-ds-with-configmap-rpi-k3s.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ spec:
3434
dnsPolicy: ClusterFirstWithHostNet
3535
containers:
3636
- name: smarter-device-manager
37-
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.1.1
37+
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.1.2
3838
imagePullPolicy: IfNotPresent
3939
securityContext:
4040
allowPrivilegeEscalation: false

smarter-device-manager-ds-with-configmap-rpi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ spec:
3434
dnsPolicy: ClusterFirstWithHostNet
3535
containers:
3636
- name: smarter-device-manager
37-
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.1.1
37+
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.1.2
3838
imagePullPolicy: IfNotPresent
3939
securityContext:
4040
allowPrivilegeEscalation: false

smarter-device-manager-ds-with-configmap-xavier-k3s.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ spec:
3434
dnsPolicy: ClusterFirstWithHostNet
3535
containers:
3636
- name: smarter-device-manager
37-
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.1.1
37+
image: registry.gitlab.com/arm-research/smarter/smarter-device-manager:v1.1.2
3838
imagePullPolicy: IfNotPresent
3939
securityContext:
4040
allowPrivilegeEscalation: false

0 commit comments

Comments
 (0)