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_r269273325
 
 

 ##########
 File path: core/src/test/scala/org/apache/spark/executor/ExecutorSuite.scala
 ##########
 @@ -392,6 +457,17 @@ class ExecutorSuite extends SparkFunSuite
         uncaughtExceptionHandler = mockUncaughtExceptionHandler)
       // the task will be launched in a dedicated worker thread
       executor.launchTask(mockBackend, taskDescription)
+      if (poll) {
+        // Ensure that the executor's metricsPoller is polled at least once so 
that values are
+        // recorded for the task metrics.
+        // When the task fails, peak values for these metrics get sent in the 
TaskFailedReason.
+        val executorClass = classOf[Executor]
+        val metricsPollerField =
+          
executorClass.getDeclaredField("org$apache$spark$executor$Executor$$metricsPoller")
+        metricsPollerField.setAccessible(true)
+        val metricsPoller = 
metricsPollerField.get(executor).asInstanceOf[ExecutorMetricsPoller]
 
 Review comment:
   rather than using reflection here, just widen the visibility of the field in 
`Executor` to
   
   ```scala
   // Visible for testing
   private[executor] metricsPoller
   ```

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