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
d228bff4
Commit
d228bff4
authored
12 years ago
by
Stephen Haberman
Browse files
Options
Downloads
Patches
Plain Diff
Add a test.
parent
dd583b7e
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/test/scala/spark/scheduler/TaskContextSuite.scala
+43
-0
43 additions, 0 deletions
core/src/test/scala/spark/scheduler/TaskContextSuite.scala
with
43 additions
and
0 deletions
core/src/test/scala/spark/scheduler/TaskContextSuite.scala
0 → 100644
+
43
−
0
View file @
d228bff4
package
spark.scheduler
import
org.scalatest.FunSuite
import
org.scalatest.BeforeAndAfter
import
spark.TaskContext
import
spark.RDD
import
spark.SparkContext
import
spark.Split
class
TaskContextSuite
extends
FunSuite
with
BeforeAndAfter
{
var
sc
:
SparkContext
=
_
after
{
if
(
sc
!=
null
)
{
sc
.
stop
()
sc
=
null
}
// To avoid Akka rebinding to the same port, since it doesn't unbind immediately on shutdown
System
.
clearProperty
(
"spark.master.port"
)
}
test
(
"Calls executeOnCompleteCallbacks after failure"
)
{
var
completed
=
false
sc
=
new
SparkContext
(
"local"
,
"test"
)
val
rdd
=
new
RDD
[
String
](
sc
)
{
override
val
splits
=
Array
[
Split
](
StubSplit
(
0
))
override
val
dependencies
=
List
()
override
def
compute
(
split
:
Split
,
context
:
TaskContext
)
=
{
context
.
addOnCompleteCallback
(()
=>
completed
=
true
)
sys
.
error
(
"failed"
)
}
}
val
func
=
(
c
:
TaskContext
,
i
:
Iterator
[
String
])
=>
i
.
next
val
task
=
new
ResultTask
[
String
,
String
](
0
,
rdd
,
func
,
0
,
Seq
(),
0
)
intercept
[
RuntimeException
]
{
task
.
run
(
0
)
}
assert
(
completed
===
true
)
}
case
class
StubSplit
(
val
index
:
Int
)
extends
Split
}
\ No newline at end of file
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