Skip to content

Commit 2e2715d

Browse files
LuciferYangdongjoon-hyun
authored andcommitted
[SPARK-49518][K8S][BUILD] Change to using build-helper-maven-plugin to manage the code for volcano
### What changes were proposed in this pull request? The main changes in this pr are as follows: 1. In `resource-managers/kubernetes/core/pom.xml` and `resource-managers/kubernetes/integration-tests/pom.xml`, the `build-helper-maven-plugin` configuration has been added for the `volcano` profile to ensure that when the profile is activated with `-Pvolcano`, the `volcano/src/main/scala` directory is treated as an additional source path, and `volcano/src/test/scala` directory is treated as an additional test code path. - `resource-managers/kubernetes/core/pom.xml` ```xml <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <executions> <execution> <id>add-volcano-source</id> <phase>generate-sources</phase> <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>volcano/src/main/scala</source> </sources> </configuration> </execution> <execution> <id>add-volcano-test-sources</id> <phase>generate-test-sources</phase> <goals> <goal>add-test-source</goal> </goals> <configuration> <sources> <source>volcano/src/test/scala</source> </sources> </configuration> </execution> </executions> </plugin> </plugins> </build> ``` - `resource-managers/kubernetes/integration-tests/pom.xml` ```xml <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <executions> <execution> <id>add-volcano-test-sources</id> <phase>generate-test-sources</phase> <goals> <goal>add-test-source</goal> </goals> <configuration> <sources> <source>volcano/src/test/scala</source> </sources> </configuration> </execution> </executions> </plugin> </plugins> </build> ``` 2. Removed the management configuration for `volcano`-related source/test code in SPARK-36061 | #35422. Since Spark uses the `sbt-pom-reader` plugin in its sbt configuration, the behavior of the `build-helper-maven-plugin` will also propagate to the sbt build process. Therefore, no additional configuration is required in `SparkBuild.scala` after this pr. ### Why are the changes needed? The previous configuration way was not very friendly to IntelliJ developers: when debugging code in IntelliJ, regardless of whether they were needed or not, the `volcano` profile had to be activated; otherwise compilation errors would occur when running tests that depended on the `kubernetes` module's source code, for example `org.apache.spark.shuffle.ShuffleChecksumUtilsSuite` : <img width="1465" alt="image" src="https://github.com/user-attachments/assets/e16e3eba-d85e-45ad-bbae-533bd2f8ce0b"> ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? 1. Pass GitHub Actions - https://github.com/LuciferYang/spark/actions/runs/10714343021/job/29707907464 <img width="1109" alt="image" src="https://github.com/user-attachments/assets/d893accb-508f-47f5-b19e-e178f6eff128"> - https://github.com/LuciferYang/spark/actions/runs/10714343021/job/29707906573 <img width="1183" alt="image" src="https://github.com/user-attachments/assets/735e0dc7-7d2c-418f-8fcd-200ee10eda0d"> It can be seen that the test cases `VolcanoFeatureStepSuite ` and `VolcanoSuite` have been successfully executed. 2. Manual Testing Using sbt - Run `build/sbt clean "kubernetes/testOnly *VolcanoFeatureStepSuite" -Pkubernetes`, and without `-Pvolcano`, no tests will be executed: ``` [info] Passed: Total 0, Failed 0, Errors 0, Passed 0 [info] No tests to run for kubernetes / Test / testOnly ``` - Run `build/sbt clean "kubernetes/testOnly *VolcanoFeatureStepSuite" -Pkubernetes -Pvolcano`, and with `-Pvolcano`, `VolcanoFeatureStepSuite` will pass the tests: ``` [info] VolcanoFeatureStepSuite: [info] - SPARK-36061: Driver Pod with Volcano PodGroup (74 milliseconds) [info] - SPARK-36061: Executor Pod with Volcano PodGroup (8 milliseconds) [info] - SPARK-38455: Support driver podgroup template (224 milliseconds) [info] - SPARK-38503: return empty for executor pre resource (1 millisecond) [info] Run completed in 1 second, 268 milliseconds. [info] Total number of tests run: 4 [info] Suites: completed 1, aborted 0 [info] Tests: succeeded 4, failed 0, canceled 0, ignored 0, pending 0 [info] All tests passed. ``` - run `build/sbt clean "kubernetes/package" -Pkubernetes -Pvolcano`, and with `-Pvolcano`, confirm that `spark-kubernetes_2.13-4.0.0-SNAPSHOT.jar` contains `VolcanoFeatureStep.class` - run `build/sbt clean "kubernetes/package" -Pkubernetes`, and without `-Pvolcano`, confirm that `spark-kubernetes_2.13-4.0.0-SNAPSHOT.jar` not contains `VolcanoFeatureStep.class` 3. Manual Testing Using Maven - Run `build/mvn clean test -pl resource-managers/kubernetes/core -am -Dtest=none -DwildcardSuites=org.apache.spark.deploy.k8s.features.VolcanoFeatureStepSuite -Pkubernetes`, and without `-Pvolcano`, no tests will be executed: ``` Discovery starting. Discovery completed in 80 milliseconds. Run starting. Expected test count is: 0 DiscoverySuite: Run completed in 99 milliseconds. Total number of tests run: 0 Suites: completed 1, aborted 0 Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0 No tests were executed. ``` - Run `build/mvn clean test -pl resource-managers/kubernetes/core -am -Dtest=none -DwildcardSuites=org.apache.spark.deploy.k8s.features.VolcanoFeatureStepSuite -Pkubernetes -Pvolcano`, and with `-Pvolcano`, `VolcanoFeatureStepSuite` will pass the tests: ``` Discovery starting. Discovery completed in 263 milliseconds. Run starting. Expected test count is: 4 VolcanoFeatureStepSuite: - SPARK-36061: Driver Pod with Volcano PodGroup - SPARK-36061: Executor Pod with Volcano PodGroup - SPARK-38455: Support driver podgroup template - SPARK-38503: return empty for executor pre resource Run completed in 624 milliseconds. Total number of tests run: 4 Suites: completed 2, aborted 0 Tests: succeeded 4, failed 0, canceled 0, ignored 0, pending 0 All tests passed. ``` - run `build/mvn clean package -pl resource-managers/kubernetes/core -am -DskipTests -Pkubernetes -Pvolcano` and with `-Pvolcano`, confirm that `spark-kubernetes_2.13-4.0.0-SNAPSHOT.jar` contains `VolcanoFeatureStep.class` - run `build/mvn clean package -pl resource-managers/kubernetes/core -am -DskipTests -Pkubernetes` and without `-Pvolcano`, confirm that `spark-kubernetes_2.13-4.0.0-SNAPSHOT.jar` not contains `VolcanoFeatureStep.class` 4. Testing in IntelliJ (both imported as a Maven project and as an sbt project): - By default, do not activate `volcano`, and confirm that `volcano`-related code is not recognized as source/test code, and does not affect the compilation and testing of other code. - Manually activate `volcano`, and confirm that `volcano`-related code is recognized as source/test code, and can be compiled and tested normally. 5. Similar tests were conducted on `kubernetes-integration-tests` module to confirm the validity of the `volcano` profile. ### Was this patch authored or co-authored using generative AI tooling? No Closes #47997 from LuciferYang/refactor-volcano. Authored-by: yangjie01 <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent f7292cb commit 2e2715d

File tree

7 files changed

+56
-46
lines changed

7 files changed

+56
-46
lines changed

project/SparkBuild.scala

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,6 @@ object SparkBuild extends PomBuild {
420420

421421
enable(DockerIntegrationTests.settings)(dockerIntegrationTests)
422422

423-
if (!profiles.contains("volcano")) {
424-
enable(Volcano.settings)(kubernetes)
425-
enable(Volcano.settings)(kubernetesIntegrationTests)
426-
}
427-
428423
enable(KubernetesIntegrationTests.settings)(kubernetesIntegrationTests)
429424

430425
enable(YARN.settings)(yarn)
@@ -1322,13 +1317,6 @@ object SparkR {
13221317
)
13231318
}
13241319

1325-
object Volcano {
1326-
// Exclude all volcano file for Compile and Test
1327-
lazy val settings = Seq(
1328-
unmanagedSources / excludeFilter := HiddenFileFilter || "*Volcano*.scala"
1329-
)
1330-
}
1331-
13321320
trait SharedUnidocSettings {
13331321

13341322
import BuildCommons._

resource-managers/kubernetes/core/pom.xml

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,11 @@
2929
<name>Spark Project Kubernetes</name>
3030
<properties>
3131
<sbt.project.name>kubernetes</sbt.project.name>
32-
<volcano.exclude>**/*Volcano*.scala</volcano.exclude>
3332
</properties>
3433

3534
<profiles>
3635
<profile>
3736
<id>volcano</id>
38-
<properties>
39-
<volcano.exclude></volcano.exclude>
40-
</properties>
4137
<dependencies>
4238
<dependency>
4339
<groupId>io.fabric8</groupId>
@@ -50,6 +46,40 @@
5046
<version>${kubernetes-client.version}</version>
5147
</dependency>
5248
</dependencies>
49+
<build>
50+
<plugins>
51+
<plugin>
52+
<groupId>org.codehaus.mojo</groupId>
53+
<artifactId>build-helper-maven-plugin</artifactId>
54+
<executions>
55+
<execution>
56+
<id>add-volcano-source</id>
57+
<phase>generate-sources</phase>
58+
<goals>
59+
<goal>add-source</goal>
60+
</goals>
61+
<configuration>
62+
<sources>
63+
<source>volcano/src/main/scala</source>
64+
</sources>
65+
</configuration>
66+
</execution>
67+
<execution>
68+
<id>add-volcano-test-sources</id>
69+
<phase>generate-test-sources</phase>
70+
<goals>
71+
<goal>add-test-source</goal>
72+
</goals>
73+
<configuration>
74+
<sources>
75+
<source>volcano/src/test/scala</source>
76+
</sources>
77+
</configuration>
78+
</execution>
79+
</executions>
80+
</plugin>
81+
</plugins>
82+
</build>
5383
</profile>
5484
</profiles>
5585

@@ -151,19 +181,6 @@
151181

152182

153183
<build>
154-
<pluginManagement>
155-
<plugins>
156-
<plugin>
157-
<groupId>net.alchim31.maven</groupId>
158-
<artifactId>scala-maven-plugin</artifactId>
159-
<configuration>
160-
<excludes>
161-
<exclude>${volcano.exclude}</exclude>
162-
</excludes>
163-
</configuration>
164-
</plugin>
165-
</plugins>
166-
</pluginManagement>
167184
<outputDirectory>target/scala-${scala.binary.version}/classes</outputDirectory>
168185
<testOutputDirectory>target/scala-${scala.binary.version}/test-classes</testOutputDirectory>
169186
</build>

resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/features/VolcanoFeatureStep.scala renamed to resource-managers/kubernetes/core/volcano/src/main/scala/org/apache/spark/deploy/k8s/features/VolcanoFeatureStep.scala

File renamed without changes.

resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/features/VolcanoFeatureStepSuite.scala renamed to resource-managers/kubernetes/core/volcano/src/test/scala/org/apache/spark/deploy/k8s/features/VolcanoFeatureStepSuite.scala

File renamed without changes.

resource-managers/kubernetes/integration-tests/pom.xml

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
<test.exclude.tags></test.exclude.tags>
4747
<test.default.exclude.tags>org.apache.spark.deploy.k8s.integrationtest.YuniKornTag</test.default.exclude.tags>
4848
<test.include.tags></test.include.tags>
49-
<volcano.exclude>**/*Volcano*.scala</volcano.exclude>
5049
</properties>
5150
<packaging>jar</packaging>
5251
<name>Spark Project Kubernetes Integration Tests</name>
@@ -83,19 +82,6 @@
8382
</dependencies>
8483

8584
<build>
86-
<pluginManagement>
87-
<plugins>
88-
<plugin>
89-
<groupId>net.alchim31.maven</groupId>
90-
<artifactId>scala-maven-plugin</artifactId>
91-
<configuration>
92-
<excludes>
93-
<exclude>${volcano.exclude}</exclude>
94-
</excludes>
95-
</configuration>
96-
</plugin>
97-
</plugins>
98-
</pluginManagement>
9985
<plugins>
10086
<plugin>
10187
<groupId>org.codehaus.mojo</groupId>
@@ -219,16 +205,35 @@
219205
</profile>
220206
<profile>
221207
<id>volcano</id>
222-
<properties>
223-
<volcano.exclude></volcano.exclude>
224-
</properties>
225208
<dependencies>
226209
<dependency>
227210
<groupId>io.fabric8</groupId>
228211
<artifactId>volcano-client</artifactId>
229212
<version>${kubernetes-client.version}</version>
230213
</dependency>
231214
</dependencies>
215+
<build>
216+
<plugins>
217+
<plugin>
218+
<groupId>org.codehaus.mojo</groupId>
219+
<artifactId>build-helper-maven-plugin</artifactId>
220+
<executions>
221+
<execution>
222+
<id>add-volcano-test-sources</id>
223+
<phase>generate-test-sources</phase>
224+
<goals>
225+
<goal>add-test-source</goal>
226+
</goals>
227+
<configuration>
228+
<sources>
229+
<source>volcano/src/test/scala</source>
230+
</sources>
231+
</configuration>
232+
</execution>
233+
</executions>
234+
</plugin>
235+
</plugins>
236+
</build>
232237
</profile>
233238
</profiles>
234239
</project>

resource-managers/kubernetes/integration-tests/src/test/scala/org/apache/spark/deploy/k8s/integrationtest/VolcanoSuite.scala renamed to resource-managers/kubernetes/integration-tests/volcano/src/test/scala/org/apache/spark/deploy/k8s/integrationtest/VolcanoSuite.scala

File renamed without changes.

resource-managers/kubernetes/integration-tests/src/test/scala/org/apache/spark/deploy/k8s/integrationtest/VolcanoTestsSuite.scala renamed to resource-managers/kubernetes/integration-tests/volcano/src/test/scala/org/apache/spark/deploy/k8s/integrationtest/VolcanoTestsSuite.scala

File renamed without changes.

0 commit comments

Comments
 (0)