10216: Merge branch 'master' into 10216-allow-cr-bypass-reuse
[arvados.git] / services / crunch-dispatch-slurm / crunch-dispatch-slurm.go
index aaea51cbf7950d30e2a8fe91aed8843566c98114..0c1ce49592a6b08223271d440dca41f3a5d8fd46 100644 (file)
@@ -79,9 +79,9 @@ func doMain() error {
                // propagated to crunch-run via SLURM.
                os.Setenv("ARVADOS_API_HOST", theConfig.Client.APIHost)
                os.Setenv("ARVADOS_API_TOKEN", theConfig.Client.AuthToken)
-               os.Setenv("ARVADOS_API_INSECURE", "")
+               os.Setenv("ARVADOS_API_HOST_INSECURE", "")
                if theConfig.Client.Insecure {
-                       os.Setenv("ARVADOS_API_INSECURE", "1")
+                       os.Setenv("ARVADOS_API_HOST_INSECURE", "1")
                }
                os.Setenv("ARVADOS_KEEP_SERVICES", strings.Join(theConfig.Client.KeepServiceURIs, " "))
                os.Setenv("ARVADOS_EXTERNAL_CLIENT", "")
@@ -127,6 +127,9 @@ func sbatchFunc(container arvados.Container) *exec.Cmd {
        sbatchArgs = append(sbatchArgs, fmt.Sprintf("--job-name=%s", container.UUID))
        sbatchArgs = append(sbatchArgs, fmt.Sprintf("--mem-per-cpu=%d", int(memPerCPU)))
        sbatchArgs = append(sbatchArgs, fmt.Sprintf("--cpus-per-task=%d", container.RuntimeConstraints.VCPUs))
+       if container.RuntimeConstraints.Partition != nil {
+               sbatchArgs = append(sbatchArgs, fmt.Sprintf("--partition=%s", strings.Join(container.RuntimeConstraints.Partition, ",")))
+       }
 
        return exec.Command("sbatch", sbatchArgs...)
 }
@@ -180,9 +183,10 @@ func submit(dispatcher *dispatch.Dispatcher,
        squeueUpdater.SlurmLock.Lock()
        defer squeueUpdater.SlurmLock.Unlock()
 
+       log.Printf("sbatch starting: %+q", cmd.Args)
        err := cmd.Start()
        if err != nil {
-               submitErr = fmt.Errorf("Error starting %v: %v", cmd.Args, err)
+               submitErr = fmt.Errorf("Error starting sbatch: %v", err)
                return
        }