-
Notifications
You must be signed in to change notification settings - Fork 382
Fix PR926 local properties issues in Spark Streaming like scenarios #937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,7 +40,7 @@ object ThreadingSuiteState { | |
| } | ||
|
|
||
| class ThreadingSuite extends FunSuite with LocalSparkContext { | ||
|
|
||
| test("accessing SparkContext form a different thread") { | ||
| sc = new SparkContext("local", "test") | ||
| val nums = sc.parallelize(1 to 10, 2) | ||
|
|
@@ -149,4 +149,40 @@ class ThreadingSuite extends FunSuite with LocalSparkContext { | |
| fail("One or more threads didn't see runningThreads = 4") | ||
| } | ||
| } | ||
|
|
||
| test("set local properties in different thread") { | ||
| sc = new SparkContext("local", "test") | ||
|
|
||
| val threads = (1 to 5).map{ i => | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. space before { |
||
| new Thread() { | ||
| override def run() { | ||
| sc.setLocalProperty("test", i.toString) | ||
| assert(sc.getLocalProperty("test") === i.toString) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| threads.foreach(_.start()) | ||
|
|
||
| assert(sc.getLocalProperty("test") === null) | ||
| } | ||
|
|
||
| test("set and get local properties in parent-children thread") { | ||
| sc = new SparkContext("local", "test") | ||
| sc.setLocalProperty("test", "parent") | ||
|
|
||
| val threads = (1 to 5).map{ i => | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding a space before { |
||
| new Thread() { | ||
| override def run() { | ||
| assert(sc.getLocalProperty("test") === "parent") | ||
| sc.setLocalProperty("test", i.toString) | ||
| assert(sc.getLocalProperty("test") === i.toString) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| threads.foreach(_.start()) | ||
| assert(sc.getLocalProperty("test") === "parent") | ||
| assert(sc.getLocalProperty("Foo") === null) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't we need a barrier here to properly test this? |
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure the line does not exceed 100 chars.