X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/570af13f6dfd7f725abf49335b7abdb46aae5048..7563e6276baade41eb3faa3ff167abab1cb0f890:/services/crunch-dispatch-local/crunch-dispatch-local.go diff --git a/services/crunch-dispatch-local/crunch-dispatch-local.go b/services/crunch-dispatch-local/crunch-dispatch-local.go index 4a45f10545..a3cb1341a4 100644 --- a/services/crunch-dispatch-local/crunch-dispatch-local.go +++ b/services/crunch-dispatch-local/crunch-dispatch-local.go @@ -86,6 +86,26 @@ func doMain() error { runningCmds = make(map[string]*exec.Cmd) + var client arvados.Client + client.APIHost = cluster.Services.Controller.ExternalURL.Host + client.AuthToken = cluster.SystemRootToken + client.Insecure = cluster.TLS.Insecure + + if client.APIHost != "" || client.AuthToken != "" { + // Copy real configs into env vars so [a] + // MakeArvadosClient() uses them, and [b] they get + // propagated to crunch-run via SLURM. + os.Setenv("ARVADOS_API_HOST", client.APIHost) + os.Setenv("ARVADOS_API_TOKEN", client.AuthToken) + os.Setenv("ARVADOS_API_HOST_INSECURE", "") + if client.Insecure { + os.Setenv("ARVADOS_API_HOST_INSECURE", "1") + } + os.Setenv("ARVADOS_EXTERNAL_CLIENT", "") + } else { + logger.Warnf("Client credentials missing from config, so falling back on environment variables (deprecated).") + } + arv, err := arvadosclient.MakeArvadosClient() if err != nil { logger.Errorf("error making Arvados client: %v", err) @@ -149,7 +169,7 @@ type LocalRun struct { // crunch-run terminates, mark the container as Cancelled. func (lr *LocalRun) run(dispatcher *dispatch.Dispatcher, container arvados.Container, - status <-chan arvados.Container) { + status <-chan arvados.Container) error { uuid := container.UUID @@ -159,7 +179,7 @@ func (lr *LocalRun) run(dispatcher *dispatch.Dispatcher, case lr.concurrencyLimit <- true: break case <-lr.ctx.Done(): - return + return lr.ctx.Err() } defer func() { <-lr.concurrencyLimit }() @@ -250,4 +270,5 @@ Finish: } dispatcher.Logger.Printf("finalized container %v", uuid) + return nil }