Skip to content

Commit e3946b4

Browse files
committed
Close SparkContext after the Main method has finished, to allow SparkApplication on K8S to complete
1 parent cdfbf08 commit e3946b4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ private[spark] class SparkSubmit extends Logging {
954954
throw findCause(t)
955955
} finally {
956956
try {
957-
org.apache.spark.SparkContext.getOrCreate().stop()
957+
SparkContext.getActive.foreach(_.stop())
958958
} catch {
959959
case e: Throwable => logError(s"Failed to close SparkContext: $e")
960960
}

0 commit comments

Comments
 (0)