6518: strigger works
authorPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 26 Feb 2016 13:54:49 +0000 (08:54 -0500)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 26 Feb 2016 13:54:49 +0000 (08:54 -0500)
services/crunch-dispatch-slurm/crunch-dispatch-slurm.go
services/crunch-dispatch-slurm/crunch-finish-slurm.sh

index 875eaa37fcaf23f26a4bc1982cf4d98b0a009d00..7f41a0a3ef54ea92c20a7ad365e67c6e009633d4 100644 (file)
@@ -209,8 +209,9 @@ func submit(container Container, crunchRunCommand string) (jobid string, submite
        return
 }
 
-func strigger(jobid, containerUUID, finishCommand string) {
-       cmd := exec.Command("strigger", "--set", "--jobid="+jobid, "--fini", fmt.Sprintf("--program=%s", finishCommand))
+func strigger(jobid, containerUUID, finishCommand, apiHost, apiToken, apiInsecure string) {
+       cmd := exec.Command("strigger", "--set", "--jobid="+jobid, "--fini",
+               fmt.Sprintf("--program=%s %s %s %s %s", finishCommand, apiHost, apiToken, apiInsecure, containerUUID))
        cmd.Stdout = os.Stdout
        cmd.Stderr = os.Stderr
        err := cmd.Run()
@@ -232,7 +233,11 @@ func run(container Container, crunchRunCommand, finishCommand string, priorityPo
                return
        }
 
-       strigger(jobid, container.UUID, finishCommand)
+       insecure := "0"
+       if arv.ApiInsecure {
+               insecure = "1"
+       }
+       strigger(jobid, container.UUID, finishCommand, arv.ApiServer, arv.ApiToken, insecure)
 
        // Update container status to Running
        err = arv.Update("containers", container.UUID,
index 8be6fdd9e0faae345e94b954356e2b65667ce777..2977e1c6ecd11fa2d3d7db05866adae64b63beba 100755 (executable)
@@ -1,7 +1,16 @@
 #!/bin/sh
 
-jobid=$1
+# I wonder if it is possible to attach metadata to job records to look these
+# things up instead of having to provide it on the command line.
 
-uuid=$(squeue --jobs=$jobid --states=all --format=%j --noheader)
+ARVADOS_API_HOST=$1
+ARVADOS_API_TOKEN=$2
+ARVADOS_API_HOST_INSECURE=$3
+uuid=$4
+jobid=$5
 
-arv containers update --uuid $uuid --container '{"state": "Completed"}'
+#uuid=$(squeue --jobs=$jobid --states=all --format=%j --noheader)
+
+export ARVADOS_API_HOST ARVADOS_API_TOKEN ARVADOS_API_HOST_INSECURE
+
+exec arv container update --uuid $uuid --container '{"state": "Complete"}'