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 @@ -43,6 +43,7 @@ class LocalSparkCluster(
private val localHostname = Utils.localHostName()
private val masterRpcEnvs = ArrayBuffer[RpcEnv]()
private val workerRpcEnvs = ArrayBuffer[RpcEnv]()
private val shutdownWaitTimeout = conf.get(config.LOCAL_CLUSTER_SHUTDOWN_WAIT_TIMEOUT)
// exposed for testing
var masterWebUIPort = -1

Expand Down Expand Up @@ -75,6 +76,7 @@ class LocalSparkCluster(
def stop(): Unit = {
logInfo("Shutting down local Spark cluster.")
// Stop the workers before the master so they don't get upset that it disconnected
Thread.sleep(shutdownWaitTimeout)
workerRpcEnvs.foreach(_.shutdown())
masterRpcEnvs.foreach(_.shutdown())
workerRpcEnvs.foreach(_.awaitTermination())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1873,4 +1873,12 @@ package object config {
.version("3.1.0")
.booleanConf
.createWithDefault(false)

private[spark] val LOCAL_CLUSTER_SHUTDOWN_WAIT_TIMEOUT =
ConfigBuilder("spark.localCluster.shutdown.wait.timeoutMs")
.internal()
.doc("Timeout in milliseconds for waiting for local cluster to shutdown.")
.version("3.1.0")
.timeConf(TimeUnit.MILLISECONDS)
.createWithDefault(1000)
}