diff --git a/build.gradle.kts b/build.gradle.kts index d4bd0fca4fc1..c69733326a0b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -313,6 +313,7 @@ tasks.register("javaPreCommit") { dependsOn(":sdks:java:testing:tpcds:build") dependsOn(":sdks:java:testing:watermarks:build") dependsOn(":sdks:java:transform-service:build") + dependsOn(":sdks:java:transform-service:app:build") dependsOn(":sdks:java:transform-service:launcher:build") } diff --git a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy index f3d79c528f8c..10a7ba7f1c84 100644 --- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy +++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy @@ -2860,7 +2860,7 @@ class BeamModulePlugin implements Plugin { project.evaluationDependsOn(":sdks:python") project.evaluationDependsOn(":runners:core-construction-java") project.evaluationDependsOn(":sdks:java:extensions:python") - project.evaluationDependsOn(":sdks:java:transform-service:launcher") + project.evaluationDependsOn(":sdks:java:transform-service:app") def usesDataflowRunner = config.pythonPipelineOptions.contains("--runner=TestDataflowRunner") || config.pythonPipelineOptions.contains("--runner=DataflowRunner") @@ -2868,7 +2868,7 @@ class BeamModulePlugin implements Plugin { def envDir = project.project(":sdks:python").envdir def pythonDir = project.project(":sdks:python").projectDir def externalPort = getRandomPort() - def launcherJar = project.project(':sdks:java:transform-service:launcher').shadowJar.archivePath + def launcherJar = project.project(':sdks:java:transform-service:app').shadowJar.archivePath def groupId = project.name + randomUUID().toString() def transformServiceOpts = [ "transform_service_launcher_jar": launcherJar, @@ -2895,7 +2895,7 @@ class BeamModulePlugin implements Plugin { dependsOn ':sdks:python:expansion-service-container:docker' dependsOn ':sdks:java:expansion-service:container:docker' dependsOn ":sdks:python:installGcpTest" - dependsOn project.project(':sdks:java:transform-service:launcher').shadowJar.getPath() + dependsOn project.project(':sdks:java:transform-service:app').shadowJar.getPath() if (usesDataflowRunner) { dependsOn ":sdks:python:test-suites:dataflow:py${project.ext.pythonVersion.replace('.', '')}:initializeForDataflowJob" diff --git a/sdks/java/extensions/python/build.gradle b/sdks/java/extensions/python/build.gradle index 40729d5f9cab..a83afac68815 100644 --- a/sdks/java/extensions/python/build.gradle +++ b/sdks/java/extensions/python/build.gradle @@ -30,7 +30,7 @@ dependencies { implementation project(path: ":model:pipeline", configuration: "shadow") implementation project(path: ":runners:core-construction-java") implementation project(path: ":sdks:java:core", configuration: "shadow") - implementation project(path: ":sdks:java:transform-service:launcher", configuration: "shadow") + implementation project(path: ":sdks:java:transform-service:launcher") testImplementation library.java.junit testImplementation library.java.hamcrest testImplementation project(":runners:core-construction-java").sourceSets.test.output diff --git a/sdks/java/harness/build.gradle b/sdks/java/harness/build.gradle index 505cbb38ab13..6c4be1451097 100644 --- a/sdks/java/harness/build.gradle +++ b/sdks/java/harness/build.gradle @@ -29,7 +29,7 @@ dependencies { // :sdks:java:core and transitive dependencies provided project(path: ":model:pipeline", configuration: "shadow") provided project(path: ":sdks:java:core", configuration: "shadow") - provided project(path: ":sdks:java:transform-service:launcher", configuration: "shadow") + provided project(path: ":sdks:java:transform-service:launcher") provided library.java.avro provided library.java.joda_time provided library.java.slf4j_api diff --git a/sdks/java/transform-service/app/build.gradle b/sdks/java/transform-service/app/build.gradle new file mode 100644 index 000000000000..5125899bec9b --- /dev/null +++ b/sdks/java/transform-service/app/build.gradle @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +apply plugin: 'org.apache.beam.module' +apply plugin: 'application' + +applyJavaNature( + automaticModuleName: 'org.apache.beam.sdk.transform.service.app', + exportJavadoc: false, + validateShadowJar: false, + shadowClosure: {}, +) +mainClassName = "org.apache.beam.sdk.transformservice.launcher.TransformServiceLauncher" + +description = "Apache Beam :: SDKs :: Java :: Transform Service :: App" +ext.summary = """Runs a transform service.""" + +dependencies { + implementation project(":sdks:java:transform-service:launcher") + permitUnusedDeclared project(":sdks:java:transform-service:launcher") + runtimeOnly library.java.slf4j_jdk14 +} + +jar { + manifest { + attributes 'Main-Class': application.mainClass + } +} diff --git a/sdks/java/transform-service/launcher/build.gradle b/sdks/java/transform-service/launcher/build.gradle index 0952f37109eb..e225d8da2f1d 100644 --- a/sdks/java/transform-service/launcher/build.gradle +++ b/sdks/java/transform-service/launcher/build.gradle @@ -16,17 +16,11 @@ * limitations under the License. */ apply plugin: 'org.apache.beam.module' -apply plugin: 'application' -mainClassName = "org.apache.beam.sdk.transformservice.launcher.TransformServiceLauncher" applyJavaNature( - automaticModuleName: 'org.apache.beam.sdk.transform.service', - exportJavadoc: false, - validateShadowJar: false, - shadowClosure: {}, + automaticModuleName: 'org.apache.beam.sdk.transform.service', ) - description = "Apache Beam :: SDKs :: Java :: Transform Service :: Launcher" ext.summary = """Contains code that can be used to run an transform service.""" @@ -40,10 +34,11 @@ test { } dependencies { - shadow library.java.vendored_guava_32_1_2_jre - shadow library.java.slf4j_api - shadow library.java.args4j - shadow library.java.error_prone_annotations + // This library is designed to be light-weight, having minimum amount of dependencies and is used by Beam runner artifacts. + implementation library.java.vendored_guava_32_1_2_jre + implementation library.java.slf4j_api + implementation library.java.args4j + compileOnly library.java.error_prone_annotations permitUnusedDeclared(library.java.error_prone_annotations) testImplementation library.java.junit testImplementation library.java.mockito_core @@ -58,9 +53,3 @@ sourceSets { output.resourcesDir = "$buildDir/resources/docker-compose/$name" } } - -jar { - manifest { - attributes 'Main-Class': application.mainClass - } -} diff --git a/sdks/python/apache_beam/utils/transform_service_launcher.py b/sdks/python/apache_beam/utils/transform_service_launcher.py index ac492513aba5..ca3e456c5238 100644 --- a/sdks/python/apache_beam/utils/transform_service_launcher.py +++ b/sdks/python/apache_beam/utils/transform_service_launcher.py @@ -35,7 +35,7 @@ _COMMAND_POSSIBLE_VALUES = ['up', 'down', 'ps'] -_EXPANSION_SERVICE_LAUNCHER_JAR = ':sdks:java:transform-service:launcher:build' +_EXPANSION_SERVICE_LAUNCHER_JAR = ':sdks:java:transform-service:app:build' class TransformServiceLauncher(object): diff --git a/settings.gradle.kts b/settings.gradle.kts index b1b03b55add0..cae135744680 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -278,6 +278,7 @@ include(":sdks:java:testing:test-utils") include(":sdks:java:testing:tpcds") include(":sdks:java:testing:watermarks") include(":sdks:java:transform-service") +include(":sdks:java:transform-service:app") include(":sdks:java:transform-service:launcher") include(":sdks:java:transform-service:controller-container") include(":sdks:python") diff --git a/website/www/site/content/en/documentation/programming-guide.md b/website/www/site/content/en/documentation/programming-guide.md index 47808063254f..d3333c1f9f64 100644 --- a/website/www/site/content/en/documentation/programming-guide.md +++ b/website/www/site/content/en/documentation/programming-guide.md @@ -8165,7 +8165,7 @@ Beam users also have the option to [manually start](/documentation/programming-g A Beam Transform service instance can be manually started by using utilities provided with Apache Beam SDKs. {{< highlight java >}} -java -jar beam-sdks-java-transform-service-launcher-.jar --port --beam_version --project_name --command up +java -jar beam-sdks-java-transform-service-app-.jar --port --beam_version --project_name --command up {{< /highlight >}} {{< highlight py >}} @@ -8179,7 +8179,7 @@ This feature is currently in development. To stop the transform service, use the following commands. {{< highlight java >}} -java -jar beam-sdks-java-transform-service-launcher-.jar --port --beam_version --project_name --command down +java -jar beam-sdks-java-transform-service-app-.jar --port --beam_version --project_name --command down {{< /highlight >}} {{< highlight py >}}