Ngone51 commented on a change in pull request #29002:
URL: https://github.com/apache/spark/pull/29002#discussion_r453164341



##########
File path: core/src/test/scala/org/apache/spark/executor/ExecutorSuite.scala
##########
@@ -402,6 +403,77 @@ class ExecutorSuite extends SparkFunSuite
     assert(taskMetrics.getMetricValue("JVMHeapMemory") > 0)
   }
 
+  test("SPARK-32175: Plugin initialization should start after heartbeater 
started") {
+    val tempDir = Utils.createTempDir()
+
+    val importStatements =
+      """
+        |import java.util.Map;
+        |import org.apache.spark.api.plugin.*;

Review comment:
       What about using the qualified class name to avoid adding the new 
parameter `preClassDefinitionBlock`?

##########
File path: core/src/main/scala/org/apache/spark/TestUtils.scala
##########
@@ -179,11 +179,18 @@ private[spark] object TestUtils {
       destDir: File,
       toStringValue: String = "",
       baseClass: String = null,
-      classpathUrls: Seq[URL] = Seq.empty): File = {
+      classpathUrls: Seq[URL] = Seq.empty,
+      preClassDefinitionBlock: String = "",
+      implementsClasses: Seq[String] = Seq.empty,
+      extraCodeBody: String = ""): File = {
     val extendsText = Option(baseClass).map { c => s" extends ${c}" 
}.getOrElse("")
+    val implementsText = implementsClasses.map(", " + _).mkString

Review comment:
       maybe?
   ```suggestion
       val implementsText =
         s"implements ${implementsClasses ++ 
Seq("java.io.Serializable").mkString(", ")}"
   ```

##########
File path: core/src/test/scala/org/apache/spark/executor/ExecutorSuite.scala
##########
@@ -402,6 +403,77 @@ class ExecutorSuite extends SparkFunSuite
     assert(taskMetrics.getMetricValue("JVMHeapMemory") > 0)
   }
 
+  test("SPARK-32175: Plugin initialization should start after heartbeater 
started") {
+    val tempDir = Utils.createTempDir()

Review comment:
       clean it up at the end of the test? (though I know it will be cleaned by 
shutdown hook anyway.)

##########
File path: core/src/main/scala/org/apache/spark/executor/Executor.scala
##########
@@ -227,6 +222,11 @@ private[spark] class Executor(
 
   metricsPoller.start()
 
+  // Plugins need to load using a class loader that includes the executor's 
user classpath

Review comment:
       Could you add comments to explain why we need to initialize plugin after 
heartbeater?




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to