Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/5501#discussion_r28630870
--- Diff: core/src/test/scala/org/apache/spark/SparkContextSuite.scala ---
@@ -67,6 +67,24 @@ class SparkContextSuite extends FunSuite with
LocalSparkContext {
}
}
+ test("Test getOrCreate") {
+ var sc2: SparkContext = null
+ SparkContext.clearActiveContext()
+ val conf = new SparkConf().setAppName("test").setMaster("local")
+
+ sc = SparkContext.getOrCreate(conf)
+
+ assert(sc.getConf.get("spark.app.name").equals("test"))
+ sc2 = SparkContext.getOrCreate(new
SparkConf().setAppName("test2").setMaster("local"))
+ assert(sc2.getConf.get("spark.app.name").equals("test"))
+ assert(sc === sc2)
+ assert(sc eq sc2)
+
+ // Try creating second context to confirm that it's still possible, if
desired
+ sc2 = new SparkContext(new
SparkConf().setAppName("test3").setMaster("local")
--- End diff --
this is leaking a spark context right? shouldn't we shut it down?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]