Skip to content

Commit aeed617

Browse files
committed
Address comments.
1 parent 5a9befa commit aeed617

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

core/src/main/scala/org/apache/spark/SparkContext.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2562,7 +2562,7 @@ object SparkContext extends Logging {
25622562
*
25632563
* Throws an exception if a SparkContext is about to be created in executors.
25642564
*/
2565-
private[spark] def assertOnDriver(): Unit = {
2565+
private def assertOnDriver(): Unit = {
25662566
if (TaskContext.get != null) {
25672567
// we're accessing it during task execution, fail.
25682568
throw new IllegalStateException(

core/src/test/scala/org/apache/spark/SparkContextSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ class SparkContextSuite extends SparkFunSuite with LocalSparkContext with Eventu
935935
}
936936
}
937937

938-
test("Disallow to create SparkContext in executors") {
938+
test("SPARK-32160: Disallow to create SparkContext in executors") {
939939
sc = new SparkContext(new SparkConf().setAppName("test").setMaster("local-cluster[3, 1, 1024]"))
940940

941941
val error = intercept[SparkException] {

python/pyspark/tests/test_context.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ def test_resources(self):
268268
self.assertEqual(len(resources), 0)
269269

270270
def test_disallow_to_create_spark_context_in_executors(self):
271+
# SPARK-32160: SparkContext should not be created in executors.
271272
with SparkContext("local-cluster[3, 1, 1024]") as sc:
272273
with self.assertRaises(Exception) as context:
273274
sc.range(2).foreach(lambda _: SparkContext())

0 commit comments

Comments
 (0)