File tree 1 file changed +14
-7
lines changed
1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,8 @@ img=cerit.io/ljocha/gromacs:2023-2-plumed-2-9-afed-pytorch-model-cv-2
7
7
8
8
input=$( cat -)
9
9
10
- # XXX: cwd root of the volue only
10
+ # XXX: cwd root of the volume only
11
+ gmxjob=asmsa-gmx-$$
11
12
12
13
if [ -z " $DOCKER_WORKDIR " ]; then
13
14
pvcid=$( df . | tail -1 | cut -f1 -d ' ' | sed ' s/^.*pvc-/pvc-/' )
@@ -16,17 +17,23 @@ if [ -z "$DOCKER_WORKDIR" ]; then
16
17
mnt=$( df . | tail -1 | cut -f7 -d ' ' )
17
18
DIR=$( realpath --relative-base $mnt $PWD )
18
19
19
- kubectl get job/asmsa-gmx 2> /dev/null > /dev/null || kubectl apply -f - >&2 << EOF
20
+ if [ -f $mnt /.gmxjob ]; then
21
+ gmxjob=$( cat $mnt /.gmxjob)
22
+ else
23
+ echo $gmxjob > $mnt /.gmxjob
24
+ fi
25
+
26
+ kubectl get job/$gmxjob 2> /dev/null > /dev/null || kubectl apply -f - >&2 << EOF
20
27
apiVersion: batch/v1
21
28
kind: Job
22
29
metadata:
23
- name: asmsa-gmx
30
+ name: $gmxjob
24
31
spec:
25
32
backoffLimit: 0
26
33
template:
27
34
metadata:
28
35
labels:
29
- job: asmsa-gmx
36
+ job: $gmxjob
30
37
spec:
31
38
restartPolicy: Never
32
39
securityContext: # Pod security context
35
42
seccompProfile:
36
43
type: RuntimeDefault
37
44
containers:
38
- - name: asmsa-gmx
45
+ - name: $gmxjob
39
46
image: $img
40
47
workingDir: /mnt/
41
48
command: [ 'sleep', 'inf' ]
72
79
kcmd=" $kcmd '$c '"
73
80
done
74
81
75
- kubectl wait --for=condition=ready pod -l job=asmsa-gmx >&2
76
- kubectl exec job/asmsa-gmx -- bash -c " $kcmd <<<\" $input \" "
82
+ kubectl wait --for=condition=ready pod -l job=$gmxjob >&2
83
+ kubectl exec job/$gmxjob -- bash -c " $kcmd <<<\" $input \" "
77
84
else
78
85
docker run -i --gpus all -v $DOCKER_WORKDIR :/work -w /work -u $( id -u) $img gmx " $@ " <<< " $input"
79
86
fi
You can’t perform that action at this time.
0 commit comments