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
bd237d4a
Commit
bd237d4a
authored
12 years ago
by
Josh Rosen
Browse files
Options
Downloads
Patches
Plain Diff
Add synchronization to LocalScheduler.updateDependencies().
parent
f1bf4f03
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/scheduler/local/LocalScheduler.scala
+18
-16
18 additions, 16 deletions
...src/main/scala/spark/scheduler/local/LocalScheduler.scala
with
18 additions
and
16 deletions
core/src/main/scala/spark/scheduler/local/LocalScheduler.scala
+
18
−
16
View file @
bd237d4a
...
...
@@ -108,22 +108,24 @@ private[spark] class LocalScheduler(threads: Int, maxFailures: Int, sc: SparkCon
* SparkContext. Also adds any new JARs we fetched to the class loader.
*/
private
def
updateDependencies
(
newFiles
:
HashMap
[
String
,
Long
],
newJars
:
HashMap
[
String
,
Long
])
{
// Fetch missing dependencies
for
((
name
,
timestamp
)
<-
newFiles
if
currentFiles
.
getOrElse
(
name
,
-
1L
)
<
timestamp
)
{
logInfo
(
"Fetching "
+
name
+
" with timestamp "
+
timestamp
)
Utils
.
fetchFile
(
name
,
new
File
(
"."
))
currentFiles
(
name
)
=
timestamp
}
for
((
name
,
timestamp
)
<-
newJars
if
currentJars
.
getOrElse
(
name
,
-
1L
)
<
timestamp
)
{
logInfo
(
"Fetching "
+
name
+
" with timestamp "
+
timestamp
)
Utils
.
fetchFile
(
name
,
new
File
(
"."
))
currentJars
(
name
)
=
timestamp
// Add it to our class loader
val
localName
=
name
.
split
(
"/"
).
last
val
url
=
new
File
(
"."
,
localName
).
toURI
.
toURL
if
(!
classLoader
.
getURLs
.
contains
(
url
))
{
logInfo
(
"Adding "
+
url
+
" to class loader"
)
classLoader
.
addURL
(
url
)
this
.
synchronized
{
// Fetch missing dependencies
for
((
name
,
timestamp
)
<-
newFiles
if
currentFiles
.
getOrElse
(
name
,
-
1L
)
<
timestamp
)
{
logInfo
(
"Fetching "
+
name
+
" with timestamp "
+
timestamp
)
Utils
.
fetchFile
(
name
,
new
File
(
"."
))
currentFiles
(
name
)
=
timestamp
}
for
((
name
,
timestamp
)
<-
newJars
if
currentJars
.
getOrElse
(
name
,
-
1L
)
<
timestamp
)
{
logInfo
(
"Fetching "
+
name
+
" with timestamp "
+
timestamp
)
Utils
.
fetchFile
(
name
,
new
File
(
"."
))
currentJars
(
name
)
=
timestamp
// Add it to our class loader
val
localName
=
name
.
split
(
"/"
).
last
val
url
=
new
File
(
"."
,
localName
).
toURI
.
toURL
if
(!
classLoader
.
getURLs
.
contains
(
url
))
{
logInfo
(
"Adding "
+
url
+
" to class loader"
)
classLoader
.
addURL
(
url
)
}
}
}
}
...
...
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