Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
spark
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs525-sp18-g07
spark
Commits
8f5ed512
Commit
8f5ed512
authored
13 years ago
by
Matei Zaharia
Browse files
Options
Downloads
Patches
Plain Diff
Delete Spark's temporary directories when the JVM exits.
parent
c0a0df32
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/src/main/scala/spark/ShuffleManager.scala
+7
-0
7 additions, 0 deletions
core/src/main/scala/spark/ShuffleManager.scala
core/src/main/scala/spark/Utils.scala
+19
-5
19 additions, 5 deletions
core/src/main/scala/spark/Utils.scala
with
26 additions
and
5 deletions
core/src/main/scala/spark/ShuffleManager.scala
+
7
−
0
View file @
8f5ed512
...
...
@@ -47,6 +47,13 @@ class ShuffleManager extends Logging {
shuffleDir
=
new
File
(
localDir
,
"shuffle"
)
shuffleDir
.
mkdirs
()
logInfo
(
"Shuffle dir: "
+
shuffleDir
)
// Add a shutdown hook to delete the local dir
Runtime
.
getRuntime
.
addShutdownHook
(
new
Thread
(
"delete Spark local dir"
)
{
override
def
run
()
{
Utils
.
deleteRecursively
(
localDir
)
}
})
val
extServerPort
=
System
.
getProperty
(
"spark.localFileShuffle.external.server.port"
,
"-1"
).
toInt
...
...
This diff is collapsed.
Click to expand it.
core/src/main/scala/spark/Utils.scala
+
19
−
5
View file @
8f5ed512
...
...
@@ -116,12 +116,12 @@ object Utils {
}
/**
* Get the local host's IP address in dotted-quad format (e.g. 1.2.3.4)
* Get the local host's IP address in dotted-quad format (e.g. 1.2.3.4)
.
*/
def
localIpAddress
()
:
String
=
InetAddress
.
getLocalHost
.
getHostAddress
/**
* Returns a standard ThreadFactory except all threads are daemons
* Returns a standard ThreadFactory except all threads are daemons
.
*/
private
def
newDaemonThreadFactory
:
ThreadFactory
=
{
new
ThreadFactory
{
...
...
@@ -134,7 +134,7 @@ object Utils {
}
/**
* Wrapper over newCachedThreadPool
* Wrapper over newCachedThreadPool
.
*/
def
newDaemonCachedThreadPool
()
:
ThreadPoolExecutor
=
{
var
threadPool
=
...
...
@@ -146,7 +146,7 @@ object Utils {
}
/**
* Wrapper over newFixedThreadPool
* Wrapper over newFixedThreadPool
.
*/
def
newDaemonFixedThreadPool
(
nThreads
:
Int
)
:
ThreadPoolExecutor
=
{
var
threadPool
=
...
...
@@ -158,9 +158,23 @@ object Utils {
}
/**
* Get the local machine's hostname
* Get the local machine's hostname
.
*/
def
localHostName
()
:
String
=
{
return
InetAddress
.
getLocalHost
().
getHostName
}
/**
* Delete a file or directory and its contents recursively.
*/
def
deleteRecursively
(
file
:
File
)
{
if
(
file
.
isDirectory
)
{
for
(
child
<-
file
.
listFiles
())
{
deleteRecursively
(
child
)
}
}
if
(!
file
.
delete
())
{
throw
new
IOException
(
"Failed to delete: "
+
file
)
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment