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
cf52a3cb
Commit
cf52a3cb
authored
11 years ago
by
Y.CORP.YAHOO.COM\tgraves
Browse files
Options
Downloads
Patches
Plain Diff
Allow for Executors to have different directories then the Spark Master for Yarn
parent
6dd64e8b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/src/main/scala/spark/executor/Executor.scala
+25
-0
25 additions, 0 deletions
core/src/main/scala/spark/executor/Executor.scala
with
25 additions
and
0 deletions
core/src/main/scala/spark/executor/Executor.scala
+
25
−
0
View file @
cf52a3cb
...
...
@@ -60,6 +60,13 @@ private[spark] class Executor(
System
.
setProperty
(
key
,
value
)
}
// If we are in yarn mode, systems can have different disk layouts so we must set it
// to what Yarn on this system said was available. This will be used later when SparkEnv
// created.
if
(
java
.
lang
.
Boolean
.
valueOf
(
System
.
getProperty
(
"SPARK_YARN_MODE"
,
System
.
getenv
(
"SPARK_YARN_MODE"
))))
{
System
.
setProperty
(
"spark.local.dir"
,
getYarnLocalDirs
())
}
// Create our ClassLoader and set it on this thread
private
val
urlClassLoader
=
createClassLoader
()
private
val
replClassLoader
=
addReplClassLoaderIfNeeded
(
urlClassLoader
)
...
...
@@ -107,6 +114,24 @@ private[spark] class Executor(
threadPool
.
execute
(
new
TaskRunner
(
context
,
taskId
,
serializedTask
))
}
/** Get the Yarn approved local directories. */
private
def
getYarnLocalDirs
()
:
String
=
{
// Hadoop 0.23 and 2.x have different Environment variable names for the
// local dirs, so lets check both. We assume one of the 2 is set.
// LOCAL_DIRS => 2.X, YARN_LOCAL_DIRS => 0.23.X
var
localDirs
=
System
.
getenv
(
"LOCAL_DIRS"
)
val
yarnLocalSysDirs
=
Option
(
System
.
getenv
(
"YARN_LOCAL_DIRS"
))
yarnLocalSysDirs
match
{
case
Some
(
s
)
=>
localDirs
=
s
case
None
=>
{
if
((
localDirs
==
null
)
||
(
localDirs
.
isEmpty
()))
{
throw
new
Exception
(
"Yarn Local dirs can't be empty"
)
}
}
}
return
localDirs
}
class
TaskRunner
(
context
:
ExecutorBackend
,
taskId
:
Long
,
serializedTask
:
ByteBuffer
)
extends
Runnable
{
...
...
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