6518: Add --share, quoting, shut down priority checking goroutine when
authorPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 19 Feb 2016 03:20:14 +0000 (22:20 -0500)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 19 Feb 2016 03:20:14 +0000 (22:20 -0500)
container state is complete.

services/crunch-dispatch-slurm/crunch-dispatch-slurm.go

index e053c21d7b3c0e773dc97ec5010f2436ef3ffca6..5133c9fd81fd2cd352c18a1dee3821f5e5746691 100644 (file)
@@ -139,7 +139,7 @@ func dispatchSlurm(priorityPollInterval int, crunchRunCommand string) {
 func run(uuid string, crunchRunCommand string, priorityPollInterval int) {
        stdinReader, stdinWriter := io.Pipe()
 
-       cmd := exec.Command("sbatch", "--job-name="+uuid)
+       cmd := exec.Command("sbatch", "--job-name="+uuid, "--share")
        cmd.Stdin = stdinReader
        cmd.Stderr = os.Stderr
        cmd.Stdout = os.Stderr
@@ -148,7 +148,7 @@ func run(uuid string, crunchRunCommand string, priorityPollInterval int) {
                return
        }
 
-       fmt.Fprintf(stdinWriter, "#!/bin/sh\nexec %s %s\n", crunchRunCommand, uuid)
+       fmt.Fprintf(stdinWriter, "#!/bin/sh\nexec '%s' '%s'\n", crunchRunCommand, uuid)
 
        stdinWriter.Close()
        cmd.Wait()
@@ -179,6 +179,9 @@ func run(uuid string, crunchRunCommand string, priorityPollInterval int) {
                                        cancelcmd := exec.Command("scancel", "--name="+uuid)
                                        cancelcmd.Run()
                                }
+                               if container.State == "Complete" {
+                                       priorityTicker.Stop()
+                               }
                        }
                }
        }()