From 570af13f6dfd7f725abf49335b7abdb46aae5048 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Wed, 14 Jul 2021 16:37:19 -0400 Subject: [PATCH] 17816: Add --runtime-engine to crunch-dispatch-local and crunch-dispatch-slurm refs #17816 Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- .../crunch-dispatch-local/crunch-dispatch-local.go | 13 +++++++++++-- .../crunch-dispatch-slurm/crunch-dispatch-slurm.go | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/services/crunch-dispatch-local/crunch-dispatch-local.go b/services/crunch-dispatch-local/crunch-dispatch-local.go index 2922817b55..4a45f10545 100644 --- a/services/crunch-dispatch-local/crunch-dispatch-local.go +++ b/services/crunch-dispatch-local/crunch-dispatch-local.go @@ -17,6 +17,7 @@ import ( "syscall" "time" + "git.arvados.org/arvados.git/lib/config" "git.arvados.org/arvados.git/sdk/go/arvados" "git.arvados.org/arvados.git/sdk/go/arvadosclient" "git.arvados.org/arvados.git/sdk/go/dispatch" @@ -74,6 +75,13 @@ func doMain() error { return nil } + loader := config.NewLoader(nil, logger) + cfg, err := loader.Load() + cluster, err := cfg.GetCluster("") + if err != nil { + return fmt.Errorf("config error: %s", err) + } + logger.Printf("crunch-dispatch-local %s started", version) runningCmds = make(map[string]*exec.Cmd) @@ -90,7 +98,7 @@ func doMain() error { dispatcher := dispatch.Dispatcher{ Logger: logger, Arv: arv, - RunContainer: (&LocalRun{startFunc, make(chan bool, 8), ctx}).run, + RunContainer: (&LocalRun{startFunc, make(chan bool, 8), ctx, cluster}).run, PollPeriod: time.Duration(*pollInterval) * time.Second, } @@ -128,6 +136,7 @@ type LocalRun struct { startCmd func(container arvados.Container, cmd *exec.Cmd) error concurrencyLimit chan bool ctx context.Context + cluster *arvados.Cluster } // Run a container. @@ -169,7 +178,7 @@ func (lr *LocalRun) run(dispatcher *dispatch.Dispatcher, waitGroup.Add(1) defer waitGroup.Done() - cmd := exec.Command(*crunchRunCommand, uuid) + cmd := exec.Command(*crunchRunCommand, "--runtime-engine="+lr.cluster.Containers.RuntimeEngine, uuid) cmd.Stdin = nil cmd.Stderr = os.Stderr cmd.Stdout = os.Stderr diff --git a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go index a5899ce8a7..2f2f013c71 100644 --- a/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go +++ b/services/crunch-dispatch-slurm/crunch-dispatch-slurm.go @@ -255,6 +255,7 @@ func (disp *Dispatcher) submit(container arvados.Container, crunchRunCommand []s // append() here avoids modifying crunchRunCommand's // underlying array, which is shared with other goroutines. crArgs := append([]string(nil), crunchRunCommand...) + crArgs = append(crArgs, "--runtime-engine="+disp.cluster.Containers.RuntimeEngine) crArgs = append(crArgs, container.UUID) crScript := strings.NewReader(execScript(crArgs)) -- 2.30.2