X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/190b1365c4074d86ae1bb0b9b07c3626a8671fac..9ea9735d7569f23a89fbcfaa69710f209eea6466:/services/crunch-dispatch-slurm/squeue.go diff --git a/services/crunch-dispatch-slurm/squeue.go b/services/crunch-dispatch-slurm/squeue.go index 819c2d2510..adb620ea8d 100644 --- a/services/crunch-dispatch-slurm/squeue.go +++ b/services/crunch-dispatch-slurm/squeue.go @@ -8,7 +8,6 @@ import ( "bytes" "fmt" "log" - "os/exec" "strings" "sync" "time" @@ -23,18 +22,13 @@ type jobPriority struct { // command 'squeue'. type SqueueChecker struct { Period time.Duration + Slurm Slurm uuids map[string]jobPriority startOnce sync.Once done chan struct{} sync.Cond } -func squeueFunc() *exec.Cmd { - return exec.Command("squeue", "--all", "--format=%j %y %Q") -} - -var squeueCmd = squeueFunc - // HasUUID checks if a given container UUID is in the slurm queue. // This does not run squeue directly, but instead blocks until woken // up by next successful update of squeue. @@ -84,7 +78,7 @@ func (sqc *SqueueChecker) check() { sqc.L.Lock() defer sqc.L.Unlock() - cmd := squeueCmd() + cmd := sqc.Slurm.QueueCommand([]string{"--all", "--format=%j %y %Q"}) stdout, stderr := &bytes.Buffer{}, &bytes.Buffer{} cmd.Stdout, cmd.Stderr = stdout, stderr if err := cmd.Run(); err != nil {