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
7e1c97fc
Commit
7e1c97fc
authored
12 years ago
by
Matei Zaharia
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into mesos-0.9
parents
6888bc71
04827679
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/HadoopWriter.scala
+8
-11
8 additions, 11 deletions
core/src/main/scala/spark/HadoopWriter.scala
core/src/main/scala/spark/PairRDDFunctions.scala
+3
-3
3 additions, 3 deletions
core/src/main/scala/spark/PairRDDFunctions.scala
with
11 additions
and
14 deletions
core/src/main/scala/spark/HadoopWriter.scala
+
8
−
11
View file @
7e1c97fc
...
...
@@ -12,8 +12,8 @@ import java.io.IOException
import
java.net.URI
import
java.util.Date
import
spark.SerializableWritable
import
spark.Logging
import
spark.SerializableWritable
/**
* Saves an RDD using a Hadoop OutputFormat as specified by a JobConf. The JobConf should also
...
...
@@ -84,26 +84,23 @@ class HadoopWriter(@transient jobConf: JobConf) extends Logging with Serializabl
writer
.
close
(
Reporter
.
NULL
)
}
def
commit
()
:
Boolean
=
{
var
result
=
false
def
commit
()
{
val
taCtxt
=
getTaskContext
()
val
cmtr
=
getOutputCommitter
()
if
(
cmtr
.
needsTaskCommit
(
taCtxt
))
{
try
{
cmtr
.
commitTask
(
taCtxt
)
logInfo
(
taID
+
": Committed"
)
result
=
true
}
catch
{
case
e
:
IOException
=>
{
logError
(
"Error committing the output of task: "
+
taID
.
value
)
e
.
printStackTrace
()
case
e
:
IOException
=>
{
logError
(
"Error committing the output of task: "
+
taID
.
value
,
e
)
cmtr
.
abortTask
(
taCtxt
)
throw
e
}
}
return
result
}
logWarning
(
"No need to commit output of task: "
+
taID
.
value
)
return
true
}
else
{
logWarning
(
"No need to commit output of task: "
+
taID
.
value
)
}
}
def
cleanup
()
{
...
...
This diff is collapsed.
Click to expand it.
core/src/main/scala/spark/PairRDDFunctions.scala
+
3
−
3
View file @
7e1c97fc
...
...
@@ -335,7 +335,7 @@ class PairRDDFunctions[K: ClassManifest, V: ClassManifest](
val
writer
=
new
HadoopWriter
(
conf
)
writer
.
preSetup
()
def
writeToFile
(
context
:
TaskContext
,
iter
:
Iterator
[(
K
,
V
)])
:
HadoopWriter
=
{
def
writeToFile
(
context
:
TaskContext
,
iter
:
Iterator
[(
K
,
V
)])
{
writer
.
setup
(
context
.
stageId
,
context
.
splitId
,
context
.
attemptId
)
writer
.
open
()
...
...
@@ -347,10 +347,10 @@ class PairRDDFunctions[K: ClassManifest, V: ClassManifest](
}
writer
.
close
()
return
writer
writer
.
commit
()
}
self
.
context
.
runJob
(
self
,
writeToFile
_
).
foreach
(
_
.
commit
()
)
self
.
context
.
runJob
(
self
,
writeToFile
_
)
writer
.
cleanup
()
}
...
...
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