Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split standalone transform service application from launcher jar #30190

Merged
merged 1 commit into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2860,15 +2860,15 @@ class BeamModulePlugin implements Plugin<Project> {
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")

// Task for launching transform services
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,
Expand All @@ -2895,7 +2895,7 @@ class BeamModulePlugin implements Plugin<Project> {
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"
Expand Down
2 changes: 1 addition & 1 deletion sdks/java/extensions/python/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sdks/java/harness/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
43 changes: 43 additions & 0 deletions sdks/java/transform-service/app/build.gradle
Original file line number Diff line number Diff line change
@@ -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
}
}
23 changes: 6 additions & 17 deletions sdks/java/transform-service/launcher/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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."""

Expand All @@ -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
Expand All @@ -58,9 +53,3 @@ sourceSets {
output.resourcesDir = "$buildDir/resources/docker-compose/$name"
}
}

jar {
manifest {
attributes 'Main-Class': application.mainClass
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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-<Beam version for the jar>.jar --port <port> --beam_version <Beam version for the transform service> --project_name <a unique ID for the transform service> --command up
java -jar beam-sdks-java-transform-service-app-<Beam version for the jar>.jar --port <port> --beam_version <Beam version for the transform service> --project_name <a unique ID for the transform service> --command up
{{< /highlight >}}

{{< highlight py >}}
Expand All @@ -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-<Beam version for the jar>.jar --port <port> --beam_version <Beam version for the transform service> --project_name <a unique ID for the transform service> --command down
java -jar beam-sdks-java-transform-service-app-<Beam version for the jar>.jar --port <port> --beam_version <Beam version for the transform service> --project_name <a unique ID for the transform service> --command down
{{< /highlight >}}

{{< highlight py >}}
Expand Down
Loading