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
531a7e55
Commit
531a7e55
authored
11 years ago
by
Charles Reiss
Browse files
Options
Downloads
Patches
Plain Diff
Pass executor env vars (e.g. SPARK_CLASSPATH) to compute-classpath.
parent
cd7259b4
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/Utils.scala
+9
-3
9 additions, 3 deletions
core/src/main/scala/spark/Utils.scala
core/src/main/scala/spark/deploy/worker/ExecutorRunner.scala
+3
-1
3 additions, 1 deletion
core/src/main/scala/spark/deploy/worker/ExecutorRunner.scala
with
12 additions
and
4 deletions
core/src/main/scala/spark/Utils.scala
+
9
−
3
View file @
531a7e55
...
@@ -6,6 +6,7 @@ import java.util.{Locale, Random, UUID}
...
@@ -6,6 +6,7 @@ import java.util.{Locale, Random, UUID}
import
java.util.concurrent.
{
ConcurrentHashMap
,
Executors
,
ThreadFactory
,
ThreadPoolExecutor
}
import
java.util.concurrent.
{
ConcurrentHashMap
,
Executors
,
ThreadFactory
,
ThreadPoolExecutor
}
import
java.util.regex.Pattern
import
java.util.regex.Pattern
import
scala.collection.Map
import
scala.collection.mutable.
{
ArrayBuffer
,
HashMap
}
import
scala.collection.mutable.
{
ArrayBuffer
,
HashMap
}
import
scala.collection.JavaConversions._
import
scala.collection.JavaConversions._
import
scala.io.Source
import
scala.io.Source
...
@@ -545,10 +546,15 @@ private object Utils extends Logging {
...
@@ -545,10 +546,15 @@ private object Utils extends Logging {
/**
/**
* Execute a command and get its output, throwing an exception if it yields a code other than 0.
* Execute a command and get its output, throwing an exception if it yields a code other than 0.
*/
*/
def
executeAndGetOutput
(
command
:
Seq
[
String
],
workingDir
:
File
=
new
File
(
"."
))
:
String
=
{
def
executeAndGetOutput
(
command
:
Seq
[
String
],
workingDir
:
File
=
new
File
(
"."
),
val
process
=
new
ProcessBuilder
(
command
:
_
*
)
extraEnvironment
:
Map
[
String
,
String
]
=
Map
.
empty
)
:
String
=
{
val
builder
=
new
ProcessBuilder
(
command
:
_
*
)
.
directory
(
workingDir
)
.
directory
(
workingDir
)
.
start
()
val
environment
=
builder
.
environment
()
for
((
key
,
value
)
<-
extraEnvironment
)
{
environment
.
put
(
key
,
value
)
}
val
process
=
builder
.
start
()
new
Thread
(
"read stderr for "
+
command
(
0
))
{
new
Thread
(
"read stderr for "
+
command
(
0
))
{
override
def
run
()
{
override
def
run
()
{
for
(
line
<-
Source
.
fromInputStream
(
process
.
getErrorStream
).
getLines
)
{
for
(
line
<-
Source
.
fromInputStream
(
process
.
getErrorStream
).
getLines
)
{
...
...
This diff is collapsed.
Click to expand it.
core/src/main/scala/spark/deploy/worker/ExecutorRunner.scala
+
3
−
1
View file @
531a7e55
...
@@ -98,7 +98,9 @@ private[spark] class ExecutorRunner(
...
@@ -98,7 +98,9 @@ private[spark] class ExecutorRunner(
// Figure out our classpath with the external compute-classpath script
// Figure out our classpath with the external compute-classpath script
val
ext
=
if
(
System
.
getProperty
(
"os.name"
).
startsWith
(
"Windows"
))
".cmd"
else
".sh"
val
ext
=
if
(
System
.
getProperty
(
"os.name"
).
startsWith
(
"Windows"
))
".cmd"
else
".sh"
val
classPath
=
Utils
.
executeAndGetOutput
(
Seq
(
sparkHome
+
"/bin/compute-classpath"
+
ext
))
val
classPath
=
Utils
.
executeAndGetOutput
(
Seq
(
sparkHome
+
"/bin/compute-classpath"
+
ext
),
extraEnvironment
=
appDesc
.
command
.
environment
)
Seq
(
"-cp"
,
classPath
)
++
libraryOpts
++
userOpts
++
memoryOpts
Seq
(
"-cp"
,
classPath
)
++
libraryOpts
++
userOpts
++
memoryOpts
}
}
...
...
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