Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,8 @@ private[spark] class SparkSubmit extends Logging {
} finally {
if (args.master.startsWith("k8s") && !isShell(args.primaryResource) &&
!isSqlShell(args.mainClass) && !isThriftServer(args.mainClass) &&
!isConnectServer(args.mainClass)) {
!isConnectServer(args.mainClass) &&
sparkConf.getBoolean("spark.kubernetes.submit.autoStopActiveSparkContexts", true)) {
try {
SparkContext.getActive.foreach(_.stop())
} catch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,14 @@ private[spark] object Config extends Logging {
.stringConf
.createOptional

val AUTO_STOP_ACTIVE_SPARK_CONTEXTS =
ConfigBuilder("spark.kubernetes.submit.autoStopActiveSparkContexts")
.version("3.5.0")
.doc("When set to true, Spark on Kubernetes will stop all active Spark contexts once " +
"non-shell application' main methods are finished.")
.booleanConf
.createWithDefault(true)

val KUBERNETES_SCHEDULER_NAME =
ConfigBuilder("spark.kubernetes.scheduler.name")
.doc("Specify the scheduler name for driver and executor pods. If " +
Expand Down