You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "panbingkun (via GitHub)" <gi...@apache.org> on 2023/07/31 01:38:06 UTC

[GitHub] [spark] panbingkun commented on a diff in pull request #42201: [MINOR][TESTS] Clearing residual files after SparkSubmitSuite

panbingkun commented on code in PR #42201:
URL: https://github.com/apache/spark/pull/42201#discussion_r1278672126


##########
core/src/test/scala/org/apache/spark/deploy/SparkSubmitSuite.scala:
##########
@@ -510,8 +510,19 @@ class SparkSubmitSuite
         "my.great.lib.MyLib", "my.great.dep.MyLib")
 
       val appArgs = new SparkSubmitArguments(clArgs)
-      val (_, _, sparkConf, _) = submit.prepareSubmitEnvironment(appArgs)
-      sparkConf.get("spark.jars").contains("mylib") shouldBe true
+      try {
+        val (_, _, sparkConf, _) = submit.prepareSubmitEnvironment(appArgs)
+        sparkConf.get("spark.jars").contains("mylib") shouldBe true
+      } finally {
+        val mainJarPath = Paths.get("my.great.dep_mylib-0.1.jar")
+        val depJarPath = Paths.get("my.great.lib_mylib-0.1.jar")
+        if (Files.exists(mainJarPath)) {
+          Files.delete(mainJarPath)
+        }
+        if (Files.exists(depJarPath)) {
+          Files.delete(depJarPath)

Review Comment:
   1.yeah, it was not cleared when the jvm was shut down.
   
   2.The logic it generates is here:
   https://github.com/apache/spark/blob/be95298f24669cddaa65e412d7681476149e2977/core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala#L452-L454
   
   3.We can simply reproduce it by any of the following commands:
   ```
   - ./build/sbt "core/testOnly *SparkSubmitSuite*"
   - ./build/sbt "core/testOnly *SparkSubmitSuite -- -z \"SPARK-35084: include jars of the --packages in k8s client mode & driver runs inside a POD\""
   ```
   



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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org