Skip to content

Commit

Permalink
Migrate examples and maven-archetypes (including Java Quickstart) to …
Browse files Browse the repository at this point in the history
…Spark 3 (addresses #23728) (#23730)
  • Loading branch information
Moritz Mack authored Oct 24, 2022
1 parent 1ec1945 commit 760c83e
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 63 deletions.
7 changes: 1 addition & 6 deletions examples/java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,8 @@ dependencies {
}
directRunnerPreCommit project(path: ":runners:direct-java", configuration: "shadow")
flinkRunnerPreCommit project(":runners:flink:${project.ext.latestFlinkVersion}")
// TODO: Make the netty version used configurable, we add netty-all 4.1.17.Final so it appears on the classpath
// before 4.1.8.Final defined by Apache Beam
sparkRunnerPreCommit "io.netty:netty-all:4.1.17.Final"
sparkRunnerPreCommit project(":runners:spark:2")
sparkRunnerPreCommit project(":runners:spark:3")
sparkRunnerPreCommit project(":sdks:java:io:hadoop-file-system")
sparkRunnerPreCommit library.java.spark_streaming
sparkRunnerPreCommit library.java.spark_core
}

/*
Expand Down
7 changes: 1 addition & 6 deletions examples/kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,8 @@ dependencies {
}
directRunnerPreCommit project(path: ":runners:direct-java", configuration: "shadow")
flinkRunnerPreCommit project(":runners:flink:${project.ext.latestFlinkVersion}")
// TODO: Make the netty version used configurable, we add netty-all 4.1.17.Final so it appears on the classpath
// before 4.1.8.Final defined by Apache Beam
sparkRunnerPreCommit "io.netty:netty-all:4.1.17.Final"
sparkRunnerPreCommit project(":runners:spark:2")
sparkRunnerPreCommit project(":runners:spark:3")
sparkRunnerPreCommit project(":sdks:java:io:hadoop-file-system")
sparkRunnerPreCommit library.java.spark_streaming
sparkRunnerPreCommit library.java.spark_core
}

/*
Expand Down
2 changes: 1 addition & 1 deletion release/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ task("runJavaExamplesValidationTask") {
description = "Run the Beam quickstart across all Java runners"
dependsOn(":runners:direct-java:runQuickstartJavaDirect")
dependsOn(":runners:google-cloud-dataflow-java:runQuickstartJavaDataflow")
dependsOn(":runners:spark:2:runQuickstartJavaSpark")
dependsOn(":runners:spark:3:runQuickstartJavaSpark")
dependsOn(":runners:flink:1.13:runQuickstartJavaFlinkLocal")
dependsOn(":runners:direct-java:runMobileGamingJavaDirect")
dependsOn(":runners:google-cloud-dataflow-java:runMobileGamingJavaDataflow")
Expand Down
3 changes: 3 additions & 0 deletions runners/spark/3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ project.ext {
// Load the main build script which contains all build logic.
apply from: "$basePath/spark_runner.gradle"

// Generates runQuickstartJavaSpark task (can only support 1 version of Spark)
createJavaExamplesArchetypeValidationTask(type: 'Quickstart', runner: 'Spark')

// Additional supported Spark versions (used in compatibility tests)
def sparkVersions = [
"330": "3.3.0",
Expand Down
3 changes: 0 additions & 3 deletions runners/spark/spark_runner.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,6 @@ tasks.register("validatesRunner") {
//dependsOn validatesStructuredStreamingRunnerBatch
}

// Generates :runners:spark:*:runQuickstartJavaSpark task
createJavaExamplesArchetypeValidationTask(type: 'Quickstart', runner: 'Spark')

tasks.register("hadoopVersionsTest") {
group = "Verification"
dependsOn hadoopVersions.collect{k,v -> "hadoopVersion${k}Test"}
Expand Down
2 changes: 1 addition & 1 deletion sdks/java/maven-archetypes/examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ processResources {
'libraries-bom.version': dependencies.create(project.library.java.google_cloud_platform_libraries_bom).getVersion(),
'pubsub.version': dependencies.create(project.library.java.google_api_services_pubsub).getVersion(),
'slf4j.version': dependencies.create(project.library.java.slf4j_api).getVersion(),
'spark.version': dependencies.create(project.library.java.spark_core).getVersion(),
'spark.version': dependencies.create(project.library.java.spark3_core).getVersion(),
'nemo.version': dependencies.create(project.library.java.nemo_compiler_frontend_beam).getVersion(),
'hadoop.version': dependencies.create(project.library.java.hadoop_client).getVersion(),
'mockito.version': dependencies.create(project.library.java.mockito_core).getVersion(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,11 @@

<profile>
<id>spark-runner</id>
<!-- Makes the SparkRunner available when running a pipeline. Additionally,
overrides some Spark dependencies to Beam-compatible versions. -->
<properties>
<netty.version>4.1.17.Final</netty.version>
</properties>
<!-- Makes the SparkRunner available when running a pipeline. -->
<dependencies>
<dependency>
<groupId>org.apache.beam</groupId>
<artifactId>beam-runners-spark</artifactId>
<artifactId>beam-runners-spark-3</artifactId>
<version>${beam.version}</version>
<scope>runtime</scope>
<exclusions>
Expand All @@ -246,7 +242,7 @@
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_2.11</artifactId>
<artifactId>spark-streaming_2.12</artifactId>
<version>${spark.version}</version>
<scope>runtime</scope>
<exclusions>
Expand All @@ -258,26 +254,10 @@
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-scala_2.11</artifactId>
<artifactId>jackson-module-scala_2.12</artifactId>
<version>${jackson.version}</version>
<scope>runtime</scope>
</dependency>
<!-- [BEAM-3519] GCP IO exposes netty on its API surface, causing conflicts with runners -->
<dependency>
<groupId>org.apache.beam</groupId>
<artifactId>beam-sdks-java-io-google-cloud-platform</artifactId>
<version>${beam.version}</version>
<exclusions>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</profile>
<profile>
Expand Down
2 changes: 1 addition & 1 deletion sdks/java/maven-archetypes/gcp-bom-examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ processResources {
'junit.version': dependencies.create(project.library.java.junit).getVersion(),
'pubsub.version': dependencies.create(project.library.java.google_api_services_pubsub).getVersion(),
'slf4j.version': dependencies.create(project.library.java.slf4j_api).getVersion(),
'spark.version': dependencies.create(project.library.java.spark_core).getVersion(),
'spark.version': dependencies.create(project.library.java.spark3_core).getVersion(),
'nemo.version': dependencies.create(project.library.java.nemo_compiler_frontend_beam).getVersion(),
'hadoop.version': dependencies.create(project.library.java.hadoop_client).getVersion(),
'mockito.version': dependencies.create(project.library.java.mockito_core).getVersion(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,10 @@
<id>spark-runner</id>
<!-- Makes the SparkRunner available when running a pipeline. Additionally,
overrides some Spark dependencies to Beam-compatible versions. -->
<properties>
<netty.version>4.1.17.Final</netty.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.beam</groupId>
<artifactId>beam-runners-spark</artifactId>
<artifactId>beam-runners-spark-3</artifactId>
<scope>runtime</scope>
<exclusions>
<exclusion>
Expand All @@ -238,7 +235,7 @@
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_2.11</artifactId>
<artifactId>spark-streaming_2.12</artifactId>
<scope>runtime</scope>
<exclusions>
<exclusion>
Expand All @@ -249,25 +246,10 @@
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-scala_2.11</artifactId>
<artifactId>jackson-module-scala_2.12</artifactId>
<version>${jackson.version}</version>
<scope>runtime</scope>
</dependency>
<!-- [BEAM-3519] GCP IO exposes netty on its API surface, causing conflicts with runners -->
<dependency>
<groupId>org.apache.beam</groupId>
<artifactId>beam-sdks-java-io-google-cloud-platform</artifactId>
<exclusions>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</profile>
<profile>
Expand Down

0 comments on commit 760c83e

Please sign in to comment.