From 36e832bff06ba053ce1cc69776e0d9fb0c61e7e1 Mon Sep 17 00:00:00 2001 From: Imran Rashid Date: Thu, 7 Nov 2013 01:11:49 -0600 Subject: include the appid in the cmd line arguments to Executors --- core/src/main/scala/org/apache/spark/deploy/worker/ExecutorRunner.scala | 2 +- .../scala/org/apache/spark/executor/CoarseGrainedExecutorBackend.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/deploy/worker/ExecutorRunner.scala b/core/src/main/scala/org/apache/spark/deploy/worker/ExecutorRunner.scala index 8fabc95665..fff9cb60c7 100644 --- a/core/src/main/scala/org/apache/spark/deploy/worker/ExecutorRunner.scala +++ b/core/src/main/scala/org/apache/spark/deploy/worker/ExecutorRunner.scala @@ -104,7 +104,7 @@ private[spark] class ExecutorRunner( // SPARK-698: do not call the run.cmd script, as process.destroy() // fails to kill a process tree on Windows Seq(runner) ++ buildJavaOpts() ++ Seq(command.mainClass) ++ - command.arguments.map(substituteVariables) + (command.arguments ++ Seq(appId)).map(substituteVariables) } /** diff --git a/core/src/main/scala/org/apache/spark/executor/CoarseGrainedExecutorBackend.scala b/core/src/main/scala/org/apache/spark/executor/CoarseGrainedExecutorBackend.scala index 80ff4c59cb..caee6b01ab 100644 --- a/core/src/main/scala/org/apache/spark/executor/CoarseGrainedExecutorBackend.scala +++ b/core/src/main/scala/org/apache/spark/executor/CoarseGrainedExecutorBackend.scala @@ -111,7 +111,7 @@ private[spark] object CoarseGrainedExecutorBackend { def main(args: Array[String]) { if (args.length < 4) { - //the reason we allow the last frameworkId argument is to make it easy to kill rogue executors + //the reason we allow the last appid argument is to make it easy to kill rogue executors System.err.println( "Usage: CoarseGrainedExecutorBackend " + "[]") -- cgit v1.2.3 From 8d3cdda9a22a23794c0cd12b15279a80a31952e3 Mon Sep 17 00:00:00 2001 From: Imran Rashid Date: Thu, 7 Nov 2013 01:35:48 -0600 Subject: very basic regression test to make sure appId doesnt get dropped in future --- .../spark/deploy/worker/ExecutorRunnerTest.scala | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 core/src/test/scala/org/apache/spark/deploy/worker/ExecutorRunnerTest.scala diff --git a/core/src/test/scala/org/apache/spark/deploy/worker/ExecutorRunnerTest.scala b/core/src/test/scala/org/apache/spark/deploy/worker/ExecutorRunnerTest.scala new file mode 100644 index 0000000000..a3111e26dd --- /dev/null +++ b/core/src/test/scala/org/apache/spark/deploy/worker/ExecutorRunnerTest.scala @@ -0,0 +1,18 @@ +package org.apache.spark.deploy.worker + +import org.scalatest.FunSuite +import org.apache.spark.deploy.{ExecutorState, Command, ApplicationDescription} +import java.io.File + +class ExecutorRunnerTest extends FunSuite { + + test("command includes appId") { + def f(s:String) = new File(s) + val sparkHome = sys.props("user.dir") + val appDesc = new ApplicationDescription("app name", 8, 500, Command("foo", Seq(),Map()), sparkHome, "appUiUrl") + val appId = "12345-worker321-9876" + val er = new ExecutorRunner(appId, 1, appDesc, 8, 500, null, "blah", "worker321", f(sparkHome), f("ooga"), ExecutorState.RUNNING) + + assert(er.buildCommandSeq().last === appId) + } +} -- cgit v1.2.3 From ca66f5d5a287873d930a3bdc36d40d8e776ca25a Mon Sep 17 00:00:00 2001 From: Imran Rashid Date: Thu, 7 Nov 2013 07:23:59 -0600 Subject: fix formatting --- .../scala/org/apache/spark/deploy/worker/ExecutorRunnerTest.scala | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/test/scala/org/apache/spark/deploy/worker/ExecutorRunnerTest.scala b/core/src/test/scala/org/apache/spark/deploy/worker/ExecutorRunnerTest.scala index a3111e26dd..d433806987 100644 --- a/core/src/test/scala/org/apache/spark/deploy/worker/ExecutorRunnerTest.scala +++ b/core/src/test/scala/org/apache/spark/deploy/worker/ExecutorRunnerTest.scala @@ -1,17 +1,19 @@ package org.apache.spark.deploy.worker +import java.io.File import org.scalatest.FunSuite import org.apache.spark.deploy.{ExecutorState, Command, ApplicationDescription} -import java.io.File class ExecutorRunnerTest extends FunSuite { test("command includes appId") { def f(s:String) = new File(s) val sparkHome = sys.props("user.dir") - val appDesc = new ApplicationDescription("app name", 8, 500, Command("foo", Seq(),Map()), sparkHome, "appUiUrl") + val appDesc = new ApplicationDescription("app name", 8, 500, Command("foo", Seq(),Map()), + sparkHome, "appUiUrl") val appId = "12345-worker321-9876" - val er = new ExecutorRunner(appId, 1, appDesc, 8, 500, null, "blah", "worker321", f(sparkHome), f("ooga"), ExecutorState.RUNNING) + val er = new ExecutorRunner(appId, 1, appDesc, 8, 500, null, "blah", "worker321", f(sparkHome), + f("ooga"), ExecutorState.RUNNING) assert(er.buildCommandSeq().last === appId) } -- cgit v1.2.3