From 581fb86e85b5bb94b451e759cb39b9a399c42dbe Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Thu, 13 Dec 2018 13:26:04 +0100 Subject: [PATCH] [core][executor] Support pushing the control port via env var OCTRL-81 #close --- core/scheduler.go | 2 ++ executor/executor.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/scheduler.go b/core/scheduler.go index 9fa631eb0..8d0e89f08 100644 --- a/core/scheduler.go +++ b/core/scheduler.go @@ -481,8 +481,10 @@ func resourceOffers(state *internalState, fidStore store.Singleton) events.Handl remainingResources.Subtract(builder.Resource) // Append control port to arguments + // For the control port parameter and/or environment variable, see occ/OccGlobals.h cmd.Arguments = append(cmd.Arguments, "--control-port", strconv.FormatUint(controlPort, 10)) cmd.ControlPort = controlPort + cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%d", "OCC_CONTROL_PORT", controlPort)) runCommand := *cmd diff --git a/executor/executor.go b/executor/executor.go index 6ce2dbd42..03dd564c5 100644 --- a/executor/executor.go +++ b/executor/executor.go @@ -432,7 +432,7 @@ func launch(state *internalState, task mesos.TaskInfo) { } else { taskCmd = exec.Command(*commandInfo.Value, commandInfo.Arguments...) } - taskCmd.Env = append(os.Environ()) + taskCmd.Env = append(os.Environ(), commandInfo.Env...) var errStdout, errStderr error stdoutIn, _ := taskCmd.StdoutPipe()