squito commented on a change in pull request #23767: [SPARK-26329][CORE] Faster 
polling of executor memory metrics.
URL: https://github.com/apache/spark/pull/23767#discussion_r304123225
 
 

 ##########
 File path: core/src/test/scala/org/apache/spark/executor/ExecutorSuite.scala
 ##########
 @@ -342,6 +320,87 @@ class ExecutorSuite extends SparkFunSuite
     }
   }
 
+  test("Send task executor metrics in DirectTaskResult") {
+    // Run a successful, trivial result task
+    // We need to ensure, however, that executor metrics are polled after the 
task is started
+    // so this requires some coordination using ExecutorSuiteHelper.
+    val conf = new SparkConf().setMaster("local").setAppName("executor suite 
test")
+    sc = new SparkContext(conf)
+    val serializer = SparkEnv.get.closureSerializer.newInstance()
+    ExecutorSuiteHelper.latches = new ExecutorSuiteHelper
+    val resultFunc =
+      (context: TaskContext, itr: Iterator[Int]) => {
+        ExecutorSuiteHelper.latches.latch1.await(300, TimeUnit.MILLISECONDS)
+        ExecutorSuiteHelper.latches.latch2.countDown()
+        ExecutorSuiteHelper.latches.latch3.await(500, TimeUnit.MILLISECONDS)
 
 Review comment:
   would help to have a short comment about the purpose of these latches.  Eg. 
"latch2 tells the metricsPoller to poll and send results, and latch3 waits till 
the poller has sent its results"
   
   (I don't see the point of latch1, so you'd probably switch to just using 
latch1 & latch2)

----------------------------------------------------------------
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]

Reply via email to