sarthfrey commented on a change in pull request #27395: [SPARK-30667][CORE] Add
allGather method to BarrierTaskContext
URL: https://github.com/apache/spark/pull/27395#discussion_r379104351
##########
File path:
core/src/test/scala/org/apache/spark/scheduler/BarrierTaskContextSuite.scala
##########
@@ -52,6 +53,78 @@ class BarrierTaskContextSuite extends SparkFunSuite with
LocalSparkContext {
assert(times.max - times.min <= 1000)
}
+ test("share messages with allGather() call") {
+ val conf = new SparkConf()
+ .setMaster("local-cluster[4, 1, 1024]")
+ .setAppName("test-cluster")
+ sc = new SparkContext(conf)
+ val rdd = sc.makeRDD(1 to 10, 4)
+ val rdd2 = rdd.barrier().mapPartitions { it =>
+ val context = BarrierTaskContext.get()
+ // Sleep for a random time before global sync.
+ Thread.sleep(Random.nextInt(1000))
+ // Pass partitionId message in
+ val message = context.partitionId().toString
+ val messages = context.allGather(message)
+ messages.toList.iterator
+ }
+ // Take a sorted list of all the partitionId messages
+ val messages = rdd2.collect().head
+ // All the task partitionIds are shared
+ for((x, i) <- messages.view.zipWithIndex) assert(x == i.toString)
+ }
+
+ test("throw exception if we attempt to synchronize with different blocking
calls") {
Review comment:
cc @Ngone51 @jiangxb1987 @mengxr
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]