Skip to content

Commit

Permalink
Merge pull request alteryx#148 from squito/include_appId
Browse files Browse the repository at this point in the history
Include appId in executor cmd line args

add the appId back into the executor cmd line args.

I also made a pretty lame regression test, just to make sure it doesn't get dropped in the future.  not sure it will run on the build server, though, b/c `ExecutorRunner.buildCommandSeq()` expects to be abel to run the scripts in `bin`.

(cherry picked from commit 3d4ad84)
Signed-off-by: Reynold Xin <[email protected]>
  • Loading branch information
rxin committed Nov 7, 2013
1 parent d5ae953 commit a5916b9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <driverUrl> <executorId> <hostname> <cores> " +
"[<appid>]")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.apache.spark.deploy.worker

import java.io.File
import org.scalatest.FunSuite
import org.apache.spark.deploy.{ExecutorState, Command, ApplicationDescription}

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)
}
}

0 comments on commit a5916b9

Please sign in to comment.