Skip to content

Commit

Permalink
Delete tmp dir when sc is stop
Browse files Browse the repository at this point in the history
When we run driver as a service, and for each time we run job we only call sc.stop, then will not delete tmp dir create by HttpFileServer and SparkEnv, it will be deleted until the service process exit
  • Loading branch information
Sephiroth-Lin committed Feb 6, 2015
1 parent c0d5b28 commit aeac518
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/src/main/scala/org/apache/spark/SparkEnv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ class SparkEnv (
// actorSystem.awaitTermination()

// Note that blockTransferService is stopped by BlockManager since it is started by it.

// If we only stop sc, but sparksubmit still run as a services we need to delete the tmp dir
// if not, it will create too many tmp dir
try {
Utils.deleteRecursively(new File(sparkFilesDir))
} catch {
case e: Exception => logError(s"Exception while deleting Spark temp dir: $sparkFilesDir", e)
}
}

private[spark]
Expand Down

0 comments on commit aeac518

Please sign in to comment.