Skip to content

Commit

Permalink
Fix the hacky way of calling Client
Browse files Browse the repository at this point in the history
  • Loading branch information
zsxwing committed Oct 17, 2014
1 parent ff16fec commit e1cb9ef
Showing 1 changed file with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,12 @@ class YarnClusterSuite extends FunSuite with BeforeAndAfterAll with Matchers wit
val main = YarnClusterDriver.getClass.getName().stripSuffix("$")
var result = File.createTempFile("result", null, tempDir)

// The Client object will call System.exit() after the job is done, and we don't want
// that because it messes up the scalatest monitoring. So replicate some of what main()
// does here.
val args = Array("--class", main,
"--jar", "file:" + fakeSparkJar.getAbsolutePath(),
"--arg", "yarn-cluster",
"--arg", result.getAbsolutePath(),
"--num-executors", "1")
val sparkConf = new SparkConf()
val yarnConf = SparkHadoopUtil.get.newConfiguration(sparkConf)
val clientArgs = new ClientArguments(args, sparkConf)
new Client(clientArgs, yarnConf, sparkConf).run()
Client.main(args)
checkResult(result)
}

Expand All @@ -146,12 +140,8 @@ class YarnClusterSuite extends FunSuite with BeforeAndAfterAll with Matchers wit
"--jar", "file:" + fakeSparkJar.getAbsolutePath(),
"--arg", "yarn-cluster",
"--num-executors", "1")
val sparkConf = new SparkConf()
val yarnConf = SparkHadoopUtil.get.newConfiguration(sparkConf)
val clientArgs = new ClientArguments(args, sparkConf)

val exception = intercept[SparkException] {
new Client(clientArgs, yarnConf, sparkConf).run()
Client.main(args)
}
assert(Utils.exceptionString(exception).contains("Application is failed"))
}
Expand Down

0 comments on commit e1cb9ef

Please sign in to comment.