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
c546c299
Commit
c546c299
authored
14 years ago
by
Mosharaf Chowdhury
Browse files
Options
Downloads
Patches
Plain Diff
combining is happening inside the thread. Its still synchronized though.
parent
0d7ca775
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
src/scala/spark/LocalFileShuffle.scala
+27
-21
27 additions, 21 deletions
src/scala/spark/LocalFileShuffle.scala
with
27 additions
and
21 deletions
src/scala/spark/LocalFileShuffle.scala
+
27
−
21
View file @
c546c299
...
...
@@ -88,28 +88,13 @@ class LocalFileShuffle[K, V, C] extends Shuffle[K, V, C] with Logging {
val
requestPath
=
"%d/%d/%d"
.
format
(
shuffleId
,
inputId
,
myId
)
val
shuffleClient
=
new
ShuffleClient
(
serverAddress
,
s
er
verPort
,
requestPath
)
val
shuffleClient
=
new
ShuffleClient
(
serverAddress
,
serverPort
,
requestPath
,
m
er
geCombiners
)
val
readStartTime
=
System
.
currentTimeMillis
logInfo
(
"BEGIN READ: "
+
requestPath
)
shuffleClient
.
start
shuffleClient
.
join
val
inputStream
=
new
ObjectInputStream
(
new
ByteArrayInputStream
(
shuffleClient
.
byteArray
))
try
{
while
(
true
)
{
val
(
k
,
c
)
=
inputStream
.
readObject
().
asInstanceOf
[(
K
,
C
)]
combiners
(
k
)
=
combiners
.
get
(
k
)
match
{
case
Some
(
oldC
)
=>
mergeCombiners
(
oldC
,
c
)
case
None
=>
c
}
}
}
catch
{
case
e
:
EOFException
=>
{}
}
inputStream
.
close
hasSplits
+=
1
hasSplitsBitVector
.
synchronized
{
hasSplitsBitVector
.
set
(
splitIndex
)
...
...
@@ -141,13 +126,14 @@ class LocalFileShuffle[K, V, C] extends Shuffle[K, V, C] with Logging {
}
}
class
ShuffleClient
(
hostAddress
:
String
,
listenPort
:
Int
,
requestPath
:
String
)
class
ShuffleClient
(
hostAddress
:
String
,
listenPort
:
Int
,
requestPath
:
String
,
mergeCombiners
:
(
C
,
C
)
=>
C
)
extends
Thread
with
Logging
{
private
var
peerSocketToSource
:
Socket
=
null
private
var
oosSource
:
ObjectOutputStream
=
null
private
var
oisSource
:
ObjectInputStream
=
null
var
byteArray
:
Array
[
Byte
]
=
null
private
var
byteArray
:
Array
[
Byte
]
=
null
override
def
run
:
Unit
=
{
// Setup the timeout mechanism
...
...
@@ -160,7 +146,7 @@ class LocalFileShuffle[K, V, C] extends Shuffle[K, V, C] with Logging {
var
timeOutTimer
=
new
Timer
// TODO: Set wait timer
// TODO: If its too small, things FAIL
timeOutTimer
.
schedule
(
timeOutTask
,
10000
)
timeOutTimer
.
schedule
(
timeOutTask
,
10000
0
)
logInfo
(
"ShuffleClient started... => %s:%d#%s"
.
format
(
hostAddress
,
listenPort
,
requestPath
))
...
...
@@ -195,7 +181,27 @@ class LocalFileShuffle[K, V, C] extends Shuffle[K, V, C] with Logging {
if
(
bytesRead
>
0
)
{
alreadyRead
=
alreadyRead
+
bytesRead
}
}
}
// Now add this to combiners
combiners
.
synchronized
{
val
inputStream
=
new
ObjectInputStream
(
new
ByteArrayInputStream
(
byteArray
))
try
{
while
(
true
)
{
val
(
k
,
c
)
=
inputStream
.
readObject
.
asInstanceOf
[(
K
,
C
)]
combiners
(
k
)
=
combiners
.
get
(
k
)
match
{
case
Some
(
oldC
)
=>
mergeCombiners
(
oldC
,
c
)
case
None
=>
c
}
}
}
catch
{
case
e
:
Exception
=>
{
logInfo
(
"Merging to combiners had a "
+
e
)
}
}
inputStream
.
close
}
}
else
{
throw
new
SparkException
(
"ShuffleServer "
+
hostAddress
+
" does not have "
+
requestPath
)
}
...
...
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