Skip to content

Commit cb9d859

Browse files
authored
Merge pull request #167 from klueska/demos-caatch-sigterm
Update all demos so that their PID 1 processes explicitly catch SIGTERM
2 parents aa231a6 + 72a9d2f commit cb9d859

File tree

7 files changed

+21
-17
lines changed

7 files changed

+21
-17
lines changed

demo/specs/quickstart/gpu-test1.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ spec:
3333
- name: ctr
3434
image: ubuntu:22.04
3535
command: ["bash", "-c"]
36-
args: ["nvidia-smi -L; sleep 9999"]
36+
args: ["nvidia-smi -L; trap 'exit 0' TERM; sleep 9999 & wait"]
3737
resources:
3838
claims:
3939
- name: gpu
@@ -54,7 +54,7 @@ spec:
5454
- name: ctr
5555
image: ubuntu:22.04
5656
command: ["bash", "-c"]
57-
args: ["nvidia-smi -L; sleep 9999"]
57+
args: ["nvidia-smi -L; trap 'exit 0' TERM; sleep 9999 & wait"]
5858
resources:
5959
claims:
6060
- name: gpu

demo/specs/quickstart/gpu-test2.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ spec:
3131
- name: ctr0
3232
image: ubuntu:22.04
3333
command: ["bash", "-c"]
34-
args: ["nvidia-smi -L; sleep 9999"]
34+
args: ["nvidia-smi -L; trap 'exit 0' TERM; sleep 9999 & wait"]
3535
resources:
3636
claims:
3737
- name: shared-gpu
3838
- name: ctr1
3939
image: ubuntu:22.04
4040
command: ["bash", "-c"]
41-
args: ["nvidia-smi -L; sleep 9999"]
41+
args: ["nvidia-smi -L; trap 'exit 0' TERM; sleep 9999 & wait"]
4242
resources:
4343
claims:
4444
- name: shared-gpu

demo/specs/quickstart/gpu-test3.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ spec:
3232
- name: ctr
3333
image: ubuntu:22.04
3434
command: ["bash", "-c"]
35-
args: ["nvidia-smi -L; sleep 9999"]
35+
args: ["nvidia-smi -L; trap 'exit 0' TERM; sleep 9999 & wait"]
3636
resources:
3737
claims:
3838
- name: shared-gpu
@@ -53,7 +53,7 @@ spec:
5353
- name: ctr
5454
image: ubuntu:22.04
5555
command: ["bash", "-c"]
56-
args: ["nvidia-smi -L; sleep 9999"]
56+
args: ["nvidia-smi -L; trap 'exit 0' TERM; sleep 9999 & wait"]
5757
resources:
5858
claims:
5959
- name: shared-gpu

demo/specs/quickstart/gpu-test4.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,31 +68,31 @@ spec:
6868
- name: ctr0
6969
image: ubuntu:22.04
7070
command: ["bash", "-c"]
71-
args: ["nvidia-smi -L; sleep 9999"]
71+
args: ["nvidia-smi -L; trap 'exit 0' TERM; sleep 9999 & wait"]
7272
resources:
7373
claims:
7474
- name: mig-devices
7575
request: mig-1g-5gb-0
7676
- name: ctr1
7777
image: ubuntu:22.04
7878
command: ["bash", "-c"]
79-
args: ["nvidia-smi -L; sleep 9999"]
79+
args: ["nvidia-smi -L; trap 'exit 0' TERM; sleep 9999 & wait"]
8080
resources:
8181
claims:
8282
- name: mig-devices
8383
request: mig-1g-5gb-1
8484
- name: ctr2
8585
image: ubuntu:22.04
8686
command: ["bash", "-c"]
87-
args: ["nvidia-smi -L; sleep 9999"]
87+
args: ["nvidia-smi -L; trap 'exit 0' TERM; sleep 9999 & wait"]
8888
resources:
8989
claims:
9090
- name: mig-devices
9191
request: mig-2g-10gb
9292
- name: ctr3
9393
image: ubuntu:22.04
9494
command: ["bash", "-c"]
95-
args: ["nvidia-smi -L; sleep 9999"]
95+
args: ["nvidia-smi -L; trap 'exit 0' TERM; sleep 9999 & wait"]
9696
resources:
9797
claims:
9898
- name: mig-devices

demo/specs/quickstart/gpu-test5.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,32 @@ spec:
5454
containers:
5555
- name: ts-ctr0
5656
image: nvcr.io/nvidia/k8s/cuda-sample:nbody-cuda11.6.0-ubuntu18.04
57-
args: ["--benchmark", "--numbodies=4226000"]
57+
command: ["bash", "-c"]
58+
args: ["trap 'exit 0' TERM; /tmp/sample --benchmark --numbodies=4226000 & wait"]
5859
resources:
5960
claims:
6061
- name: shared-gpus
6162
request: ts-gpu
6263
- name: ts-ctr1
6364
image: nvcr.io/nvidia/k8s/cuda-sample:nbody-cuda11.6.0-ubuntu18.04
64-
args: ["--benchmark", "--numbodies=4226000"]
65+
command: ["bash", "-c"]
66+
args: ["trap 'exit 0' TERM; /tmp/sample --benchmark --numbodies=4226000 & wait"]
6567
resources:
6668
claims:
6769
- name: shared-gpus
6870
request: ts-gpu
6971
- name: mps-ctr0
7072
image: nvcr.io/nvidia/k8s/cuda-sample:nbody-cuda11.6.0-ubuntu18.04
71-
args: ["--benchmark", "--numbodies=4226000"]
73+
command: ["bash", "-c"]
74+
args: ["trap 'exit 0' TERM; /tmp/sample --benchmark --numbodies=4226000 & wait"]
7275
resources:
7376
claims:
7477
- name: shared-gpus
7578
request: mps-gpu
7679
- name: mps-ctr1
7780
image: nvcr.io/nvidia/k8s/cuda-sample:nbody-cuda11.6.0-ubuntu18.04
78-
args: ["--benchmark", "--numbodies=4226000"]
81+
command: ["bash", "-c"]
82+
args: ["trap 'exit 0' TERM; /tmp/sample --benchmark --numbodies=4226000 & wait"]
7983
resources:
8084
claims:
8185
- name: shared-gpus

demo/specs/quickstart/gpu-test6.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ spec:
7272
- name: ctr
7373
image: ubuntu:22.04
7474
command: ["bash", "-c"]
75-
args: ["nvidia-smi -L; sleep 9999"]
75+
args: ["nvidia-smi -L; trap 'exit 0' TERM; sleep 9999 & wait"]
7676
resources:
7777
claims:
7878
- name: a100

demo/specs/selectors/pods.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ spec:
1515
- name: ctr
1616
image: ubuntu:22.04
1717
command: ["bash", "-c"]
18-
args: ["nvidia-smi -L; sleep 9999"]
18+
args: ["nvidia-smi -L; trap 'exit 0' TERM; sleep 9999 & wait"]
1919
resources:
2020
claims:
2121
- name: gpu
@@ -41,7 +41,7 @@ spec:
4141
- name: ctr
4242
image: ubuntu:22.04
4343
command: ["bash", "-c"]
44-
args: ["nvidia-smi -L; sleep 9999"]
44+
args: ["nvidia-smi -L; trap 'exit 0' TERM; sleep 9999 & wait"]
4545
resources:
4646
claims:
4747
- name: gpu

0 commit comments

Comments
 (0)