Skip to content

Commit

Permalink
Merge pull request #109 from KenSuenobu/ticket-102
Browse files Browse the repository at this point in the history
Ticket-102
  • Loading branch information
KenSuenobu committed Jun 24, 2018
2 parents b433423 + 33a0503 commit e166da4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
Expand Up @@ -42,6 +42,15 @@ object SparkCache {
throw new NullPointerException("Missing SparkConf object.")
}

// Appends scattersphere-base to the jars list if not already added.
var currentJars: Seq[String] = conf.get("spark.jars").split(",")

if (!currentJars.contains("scattersphere-base")) {
currentJars = currentJars :+ "../scattersphere-base/target/scattersphere-base-0.2.1.jar"
}

conf.setJars(currentJars)

SPARK_CONF_CACHE.put(key, conf)
}

Expand Down
Expand Up @@ -33,8 +33,7 @@ class SparkCacheTest extends FlatSpec with Matchers with SimpleLogger {
SparkCache.save("test", new SparkConf()
.setMaster(Properties.envOrElse("SPARK_MASTER", "local[*]"))
.setAppName("local pi test")
.setJars(Array("target/scattersphere-core-0.2.1-tests.jar",
"../scattersphere-base/target/scattersphere-base-0.2.1.jar"))
.setJars(Array("target/scattersphere-core-0.2.1-tests.jar"))
.set("spark.ui.enabled", "false"))
val spark: SparkSession = SparkCache.getSession("test")
val sContext: SparkContext = spark.sparkContext
Expand Down
Expand Up @@ -36,8 +36,7 @@ class SparkRealWorldTest extends FlatSpec with Matchers with SimpleLogger {
SparkCache.save("realWorldTest", new SparkConf()
.setMaster(Properties.envOrElse("SPARK_MASTER", "local[*]"))
.setAppName("local pi test")
.setJars(Array("target/scattersphere-tasks-0.2.1-tests.jar",
"../scattersphere-base/target/scattersphere-base-0.2.1.jar"))
.setJars(Array("target/scattersphere-tasks-0.2.1-tests.jar"))
.set("spark.ui.enabled", "false"))

"Spark Real World Test" should "be able to run in Spark" in {
Expand Down
Expand Up @@ -29,8 +29,7 @@ class SparkTaskPiTest extends FlatSpec with Matchers with SimpleLogger {
SparkCache.save("sparkPiTestCache", new SparkConf()
.setMaster(Properties.envOrElse("SPARK_MASTER", "local[*]"))
.setAppName("local pi test")
.setJars(Array("target/scattersphere-tasks-0.2.1-tests.jar",
"../scattersphere-base/target/scattersphere-base-0.2.1.jar"))
.setJars(Array("target/scattersphere-tasks-0.2.1-tests.jar"))
.set("spark.ui.enabled", "false"))

"Spark task pi test" should "calculate Pi in the form of a task" in {
Expand Down

0 comments on commit e166da4

Please sign in to comment.