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

Generate external transform wrappers using a script #29834

Merged
merged 72 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
f80f1ac
checkpoint
ahmedabu98 Dec 13, 2023
2517445
Merge branch 'master' of https://github.com/ahmedabu98/beam into gen_…
ahmedabu98 Dec 19, 2023
e5bf704
gen_xlang_wrappers workflow
ahmedabu98 Dec 20, 2023
9295861
add tests; integrate with setup.py
ahmedabu98 Dec 20, 2023
1ec6c11
remove duplicate changes; adjust transform positions in standard serv…
ahmedabu98 Dec 20, 2023
f9bbf42
undo deleted line
ahmedabu98 Dec 20, 2023
6a2d3d2
add more config modifications
ahmedabu98 Dec 20, 2023
23450fd
warn when generation script not found
ahmedabu98 Dec 20, 2023
01dbc63
add jinja2 dependency; include script in MANIFEST.in; create a xlang …
ahmedabu98 Dec 20, 2023
0bc4ff4
add MarkupSafe==2.1.3 because jinja2 needs it
ahmedabu98 Dec 20, 2023
390d8f8
lints and fixes
ahmedabu98 Dec 20, 2023
45a71ea
jinja template abides more by lint/format rules in case yapf doesn't …
ahmedabu98 Dec 21, 2023
8847562
lint and fixes
ahmedabu98 Dec 21, 2023
18a157d
no yapf; use random dir name for tests
ahmedabu98 Dec 21, 2023
c64d75b
lint
ahmedabu98 Dec 22, 2023
7049f80
lint
ahmedabu98 Dec 22, 2023
ddd5b2f
format fix
ahmedabu98 Dec 22, 2023
91fe758
address comments
ahmedabu98 Jan 17, 2024
29d50ac
commit the transform config yaml file; in setup, only generate from t…
ahmedabu98 Jan 22, 2024
fc739fd
Merge branch 'master' of https://github.com/ahmedabu98/beam into gen_…
ahmedabu98 Jan 22, 2024
3f843dd
format generated files
ahmedabu98 Jan 22, 2024
4347cd4
add yapf dep
ahmedabu98 Jan 22, 2024
8093519
template fixes
ahmedabu98 Jan 23, 2024
1c8a17f
set default inside init
ahmedabu98 Jan 23, 2024
f33e3f8
yapf best effort
ahmedabu98 Jan 23, 2024
da03ff3
add support for test suites to spin up multiple services; add PreComm…
ahmedabu98 Jan 24, 2024
c356ba8
Merge branch 'master' of https://github.com/ahmedabu98/beam into gen_…
ahmedabu98 Jan 25, 2024
2690d0a
address comments
ahmedabu98 Jan 26, 2024
0b6827a
try catch imports
ahmedabu98 Jan 26, 2024
cf04b3d
camel_case_to_snake_case in provider module
ahmedabu98 Jan 26, 2024
a20e2a3
Merge branch 'master' of https://github.com/ahmedabu98/beam into gen_…
ahmedabu98 Jan 26, 2024
2bd52e8
lint
ahmedabu98 Jan 26, 2024
cc60dfd
skip unit tests if importing out of apache_beam
ahmedabu98 Jan 27, 2024
6672d61
generate wrappers in transforms/_external_transforms.py subdir and im…
ahmedabu98 Jan 29, 2024
7d81370
add _external_transforms package
ahmedabu98 Jan 30, 2024
1c8cafc
lint
ahmedabu98 Jan 30, 2024
fe02266
fix precommit workflow name
ahmedabu98 Jan 30, 2024
37d844e
add workflow_dispatch option
ahmedabu98 Jan 30, 2024
dcc37fa
address comments; add description to CHANGES.md
ahmedabu98 Feb 1, 2024
346346f
resolve branch conflict
ahmedabu98 Feb 1, 2024
3da5f1f
Merge branch 'master' of https://github.com/ahmedabu98/beam into gen_…
ahmedabu98 Feb 1, 2024
d1f103e
python deps
ahmedabu98 Feb 1, 2024
92664fb
manually add greenlet dep
ahmedabu98 Feb 2, 2024
11fbd99
address comments
ahmedabu98 Feb 5, 2024
51c2086
add xlang __init__
ahmedabu98 Feb 5, 2024
19358f0
lint
ahmedabu98 Feb 6, 2024
128fdbc
Merge branch 'master' of https://github.com/ahmedabu98/beam into gen_…
ahmedabu98 Feb 6, 2024
1c32d2a
remove jinja from test dependencies; allow option to pass in extra de…
ahmedabu98 Feb 6, 2024
9cb5a98
address comments; always generate wrappers
ahmedabu98 Feb 7, 2024
a20154d
add greenlet back
ahmedabu98 Feb 7, 2024
f28b053
better link to docs
ahmedabu98 Feb 7, 2024
da8d51d
don't add unneeded io direct test suite
ahmedabu98 Feb 8, 2024
538b40a
add bounds to jinja2 install
ahmedabu98 Feb 8, 2024
27b7f6a
Merge branch 'master' of https://github.com/ahmedabu98/beam into gen_…
ahmedabu98 Feb 12, 2024
889b17c
try pass import; command only generates config; install pyyaml before…
ahmedabu98 Feb 12, 2024
5dd9477
lint
ahmedabu98 Feb 12, 2024
9568de5
let python automatically start up expansion services instead of manua…
ahmedabu98 Feb 15, 2024
1f49d75
remove merge conflict
ahmedabu98 Feb 15, 2024
bdf290f
Merge branch 'master' into gen_wrappers_script
ahmedabu98 Feb 15, 2024
c96ade5
touch postcommit files to trigger GHA
ahmedabu98 Feb 15, 2024
082295d
Merge branch 'gen_wrappers_script' of https://github.com/ahmedabu98/b…
ahmedabu98 Feb 15, 2024
28146bd
rename to external_provider_it_test.py to avoid running on unit test …
ahmedabu98 Feb 15, 2024
5f9a227
rename tests ..Test -> ..IT
ahmedabu98 Feb 15, 2024
06d5fd5
small adjustments to pass python unit tests: import script from file …
ahmedabu98 Feb 16, 2024
e42b3fe
run tests only when expansion jars are built
ahmedabu98 Feb 16, 2024
0d11059
load the script after importing
ahmedabu98 Feb 16, 2024
c1b29f3
skip test if jars not built
ahmedabu98 Feb 16, 2024
620344c
Merge branch 'master' of https://github.com/ahmedabu98/beam into gen_…
ahmedabu98 Feb 17, 2024
8fdb02a
Merge branch 'master' into gen_wrappers_script
ahmedabu98 Feb 21, 2024
35da8b9
touch postcommit files to trigger GHA
ahmedabu98 Feb 21, 2024
bc43578
Merge branch 'gen_wrappers_script' of https://github.com/ahmedabu98/b…
ahmedabu98 Feb 21, 2024
89e139e
correct command name (generateExternalTransformsConfig)
ahmedabu98 Feb 22, 2024
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 .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ PreCommit Jobs run in a schedule and also get triggered in a PR if relevant sour
| [ PreCommit Website ](https://github.com/apache/beam/actions/workflows/beam_PreCommit_Website.yml) | N/A |`Run Website PreCommit`| [![.github/workflows/beam_PreCommit_Website.yml](https://github.com/apache/beam/actions/workflows/beam_PreCommit_Website.yml/badge.svg?event=schedule)](https://github.com/apache/beam/actions/workflows/beam_PreCommit_Website.yml?query=event%3Aschedule) |
| [ PreCommit Website Stage GCS ](https://github.com/apache/beam/actions/workflows/beam_PreCommit_Website_Stage_GCS.yml) | N/A |`Run Website_Stage_GCS PreCommit`| [![.github/workflows/beam_PreCommit_Website_Stage_GCS.yml](https://github.com/apache/beam/actions/workflows/beam_PreCommit_Website_Stage_GCS.yml/badge.svg?event=schedule)](https://github.com/apache/beam/actions/workflows/beam_PreCommit_Website_Stage_GCS.yml?query=event%3Aschedule) |
| [ PreCommit Whitespace ](https://github.com/apache/beam/actions/workflows/beam_PreCommit_Whitespace.yml) | N/A |`Run Whitespace PreCommit`| [![.github/workflows/beam_PreCommit_Whitespace.yml](https://github.com/apache/beam/actions/workflows/beam_PreCommit_Whitespace.yml/badge.svg?event=schedule)](https://github.com/apache/beam/actions/workflows/beam_PreCommit_Whitespace.yml?query=event%3Aschedule) |
| [ PreCommit Xlang Generated Transforms ](https://github.com/apache/beam/actions/workflows/beam_PreCommit_Xlang_Generated_Transforms.yml) | N/A |`Run Xlang_Generated_Transforms PreCommit`| [![.github/workflows/beam_PreCommit_Xlang_Generated_Transforms.yml](https://github.com/apache/beam/actions/workflows/beam_PreCommit_Xlang_Generated_Transforms.yml/badge.svg?event=schedule)](https://github.com/apache/beam/actions/workflows/beam_PreCommit_Xlang_Generated_Transforms.yml?query=event%3Aschedule) |

### PostCommit Jobs

Expand Down
176 changes: 176 additions & 0 deletions .github/workflows/beam_PreCommit_Xlang_Generated_Transforms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
# 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.

name: PreCommit Xlang Generated Transforms

on:
push:
tags: ['v*']
branches: ['master', 'release-*']
paths:
- 'model/**'
- 'sdks/python/**'
- 'sdks/java/expansion-service/**'
- 'sdks/java/core/**'
- 'sdks/java/io/**'
- 'sdks/java/extensions/sql/**'
- '!sdks/java/io/amazon-web-services/**'
ahmedabu98 marked this conversation as resolved.
Show resolved Hide resolved
- '!sdks/java/io/amazon-web-services2/**'
- '!sdks/java/io/amqp/**'
- '!sdks/java/io/azure/**'
- '!sdks/java/io/cassandra/**'
- '!sdks/java/io/cdap/**'
- '!sdks/java/io/clickhouse/**'
- '!sdks/java/io/debezium/**'
- '!sdks/java/io/elasticsearch/**'
- '!sdks/java/io/elasticsearch-tests/**'
- '!sdks/java/io/hadoop-common/**'
- '!sdks/java/io/hadoop-file-system/**'
- '!sdks/java/io/hadoop-format/**'
- '!sdks/java/io/hbase/**'
- '!sdks/java/io/hcatalog/**'
- '!sdks/java/io/influxdb/**'
- '!sdks/java/io/jms/**'
- '!sdks/java/io/kinesis/**'
- '!sdks/java/io/kudu/**'
- '!sdks/java/io/mqtt/**'
- '!sdks/java/io/mongodb/**'
- '!sdks/java/io/neo4j/**'
- '!sdks/java/io/pulsar/**'
- '!sdks/java/io/rabbitmq/**'
- '!sdks/java/io/redis/**'
- '!sdks/java/io/rrio/**'
- '!sdks/java/io/snowflake/**'
- '!sdks/java/io/solr/**'
- '!sdks/java/io/splunk/**'
- '!sdks/java/io/thrift/**'
- '!sdks/java/io/tika/**'
- 'release/**'
- '.github/workflows/beam_PreCommit_Xlang_Generated_Transforms.yml'
pull_request_target:
branches: ['master', 'release-*']
paths:
- 'model/**'
- 'sdks/python/**'
- 'sdks/java/expansion-service/**'
- 'sdks/java/core/**'
- 'sdks/java/io/**'
- 'sdks/java/extensions/sql/**'
- '!sdks/java/io/amazon-web-services/**'
- '!sdks/java/io/amazon-web-services2/**'
- '!sdks/java/io/amqp/**'
- '!sdks/java/io/azure/**'
- '!sdks/java/io/cassandra/**'
- '!sdks/java/io/cdap/**'
- '!sdks/java/io/clickhouse/**'
- '!sdks/java/io/debezium/**'
- '!sdks/java/io/elasticsearch/**'
- '!sdks/java/io/elasticsearch-tests/**'
- '!sdks/java/io/hadoop-common/**'
- '!sdks/java/io/hadoop-file-system/**'
- '!sdks/java/io/hadoop-format/**'
- '!sdks/java/io/hbase/**'
- '!sdks/java/io/hcatalog/**'
- '!sdks/java/io/influxdb/**'
- '!sdks/java/io/jms/**'
- '!sdks/java/io/kinesis/**'
- '!sdks/java/io/kudu/**'
- '!sdks/java/io/mqtt/**'
- '!sdks/java/io/mongodb/**'
- '!sdks/java/io/neo4j/**'
- '!sdks/java/io/pulsar/**'
- '!sdks/java/io/rabbitmq/**'
- '!sdks/java/io/redis/**'
- '!sdks/java/io/rrio/**'
- '!sdks/java/io/snowflake/**'
- '!sdks/java/io/solr/**'
- '!sdks/java/io/splunk/**'
- '!sdks/java/io/thrift/**'
- '!sdks/java/io/tika/**'
- 'release/**'
- 'release/trigger_all_tests.json'
- '.github/workflows/beam_PreCommit_Xlang_Generated_Transforms.yml'
issue_comment:
types: [created]
schedule:
- cron: '30 2/6 * * *'
workflow_dispatch:

#Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event
permissions:
actions: write
pull-requests: read
checks: read
contents: read
deployments: read
id-token: none
issues: read
discussions: read
packages: read
pages: read
repository-projects: read
security-events: read
statuses: read

# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.issue.number || github.event.pull_request.head.label || github.sha || github.head_ref || github.ref }}-${{ github.event.schedule || github.event.comment.id || github.event.sender.login }}'
cancel-in-progress: true

env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}

jobs:
beam_PreCommit_Xlang_Generated_Transforms:
name: ${{ matrix.job_name }} (${{ matrix.job_phrase }} ${{ matrix.python_version }})
timeout-minutes: 120
runs-on: ['self-hosted', ubuntu-20.04, main]
strategy:
fail-fast: false
matrix:
job_name: ['beam_PreCommit_Xlang_Generated_Transforms']
job_phrase: ['Run Xlang_Generated_Transforms PreCommit']
python_version: ['3.8']
if: |
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request_target' ||
(github.event_name == 'schedule' && github.repository == 'apache/beam') ||
startsWith(github.event.comment.body, 'Run Xlang_Generated_Transforms PreCommit')
steps:
- uses: actions/checkout@v4
- name: Setup repository
uses: ./.github/actions/setup-action
with:
comment_phrase: ${{ matrix.job_phrase }}
github_token: ${{ secrets.GITHUB_TOKEN }}
github_job: ${{ matrix.job_name }} (${{ matrix.job_phrase }}
- name: Setup environment
uses: ./.github/actions/setup-environment-action
with:
java-version: 8
python-version: ${{ matrix.python_version }}
- name: Set PY_VER_CLEAN
id: set_py_ver_clean
run: |
PY_VER=${{ matrix.python_version }}
PY_VER_CLEAN=${PY_VER//.}
echo "py_ver_clean=$PY_VER_CLEAN" >> $GITHUB_OUTPUT
- name: run Cross-Language Wrapper Validation script
uses: ./.github/actions/gradle-command-self-hosted-action
with:
gradle-command: :sdks:python:test-suites:direct:crossLanguageWrapperValidationPreCommit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ sdks/python/**/*.egg
sdks/python/LICENSE
sdks/python/NOTICE
sdks/python/README.md
sdks/python/apache_beam/transforms/xlang/*
sdks/python/apache_beam/portability/api/*
sdks/python/nosetests*.xml
sdks/python/pytest*.xml
Expand Down
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@

* New highly anticipated feature X added to Python SDK ([#X](https://github.com/apache/beam/issues/X)).
* New highly anticipated feature Y added to Java SDK ([#Y](https://github.com/apache/beam/issues/Y)).
* The Python SDK will now include automatically generated wrappers for external Java transforms! ([#29834](https://github.com/apache/beam/pull/29834))

## I/Os

Expand Down
5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,11 @@ tasks.register("checkSetup") {
dependsOn(":examples:java:wordCount")
}

// Generates external transform config
project.tasks.register("generateExternalTransformsConfig") {
dependsOn(":sdks:python:generateExternalTransformsConfig")
}

// Configure the release plugin to do only local work; the release manager determines what, if
// anything, to push. On failure, the release manager can reset the branch without pushing.
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,11 @@ class BeamModulePlugin implements Plugin<Project> {

// A class defining the common properties in a given suite of cross-language tests
// Properties are shared across runners and are used when creating a CrossLanguageUsingJavaExpansionConfiguration object
static class CrossLanguageTaskCommon {
static class CrossLanguageTask {
// Used as the task name for cross-language
String name
// The expansion service's project path (required)
String expansionProjectPath
// List of project paths for required expansion services
List<String> expansionProjectPaths
// Collect Python pipeline tests with this marker
String collectMarker
// Job server startup task.
Expand All @@ -334,6 +334,8 @@ class BeamModulePlugin implements Plugin<Project> {
TaskProvider cleanupJobServer
// any additional environment variables specific to the suite of tests
Map<String,String> additionalEnvs
// Additional Python dependencies to install before running tests
List<String> additionalDeps
}

// A class defining the configuration for CrossLanguageUsingJavaExpansion.
Expand All @@ -355,12 +357,14 @@ class BeamModulePlugin implements Plugin<Project> {
TaskProvider cleanupJobServer
// Number of parallel test runs.
Integer numParallelTests = 1
// Project path for the expansion service to start up
String expansionProjectPath
// List of project paths for required expansion services
List<String> expansionProjectPaths
// Collect Python pipeline tests with this marker
String collectMarker
// any additional environment variables to be exported
Map<String,String> additionalEnvs
// Additional Python dependencies to install before running tests
List<String> additionalDeps
}

// A class defining the configuration for CrossLanguageValidatesRunner.
Expand Down Expand Up @@ -2578,7 +2582,7 @@ class BeamModulePlugin implements Plugin<Project> {
/** ***********************************************************************************************/
// Method to create the createCrossLanguageUsingJavaExpansionTask.
// The method takes CrossLanguageUsingJavaExpansionConfiguration as parameter.
// This method creates a task that runs Python SDK pipeline tests that use Java transforms via an input expansion service
// This method creates a task that runs Python SDK test-suites that use external Java transforms
project.ext.createCrossLanguageUsingJavaExpansionTask = {
// This task won't work if the python build file doesn't exist.
if (!project.project(":sdks:python").buildFile.exists()) {
Expand All @@ -2588,40 +2592,49 @@ class BeamModulePlugin implements Plugin<Project> {
def config = it ? it as CrossLanguageUsingJavaExpansionConfiguration : new CrossLanguageUsingJavaExpansionConfiguration()

project.evaluationDependsOn(":sdks:python")
project.evaluationDependsOn(config.expansionProjectPath)
for (path in config.expansionProjectPaths) {
project.evaluationDependsOn(path)
}
project.evaluationDependsOn(":runners:core-construction-java")
project.evaluationDependsOn(":sdks:java:extensions:python")

// Setting up args to launch the expansion service
def pythonDir = project.project(":sdks:python").projectDir
def javaExpansionPort = -1 // will be populated in setupTask
def expansionJar = project.project(config.expansionProjectPath).shadowJar.archivePath
def javaClassLookupAllowlistFile = project.project(config.expansionProjectPath).projectDir.getPath()
def expansionServiceOpts = [
"group_id": project.name,
"java_expansion_service_jar": expansionJar,
"java_expansion_service_allowlist_file": javaClassLookupAllowlistFile,
]
// initialize all expansion ports to -1. Will be populated in setupTask
def javaExpansionPorts = config.expansionProjectPaths.inject([:]) { map, k -> map[k] = -1; map }

def usesDataflowRunner = config.pythonPipelineOptions.contains("--runner=TestDataflowRunner") || config.pythonPipelineOptions.contains("--runner=DataflowRunner")
def javaContainerSuffix = getSupportedJavaVersion()

// 1. Builds the chosen expansion service jar and launches it
def setupTask = project.tasks.register(config.name+"Setup") {
dependsOn ':sdks:java:container:' + javaContainerSuffix + ':docker'
dependsOn project.project(config.expansionProjectPath).shadowJar.getPath()
for (path in config.expansionProjectPaths) {
dependsOn project.project(path).shadowJar.getPath()
}
dependsOn 'installGcpTest'
if (usesDataflowRunner) {
dependsOn ":sdks:python:test-suites:dataflow:py${project.ext.pythonVersion.replace('.', '')}:initializeForDataflowJob"
}
doLast {
project.exec {
// Prepare a port to use for the expansion service
javaExpansionPort = getRandomPort()
expansionServiceOpts.put("java_port", javaExpansionPort)
// setup test env
def serviceArgs = project.project(':sdks:python').mapToArgString(expansionServiceOpts)
executable 'sh'
args '-c', ". ${project.ext.envdir}/bin/activate && $pythonDir/scripts/run_expansion_services.sh stop --group_id ${project.name} && $pythonDir/scripts/run_expansion_services.sh start $serviceArgs"
// iterate through list of expansion service paths and build each jar
for (path in config.expansionProjectPaths) {
project.exec {
def expansionJar = project.project(path).shadowJar.archivePath
def javaClassLookupAllowlistFile = project.project(path).projectDir.getPath()
def expansionServiceOpts = [
"group_id": project.name,
"java_expansion_service_jar": expansionJar,
"java_expansion_service_allowlist_file": javaClassLookupAllowlistFile,
]
// Prepare a port to use for the expansion service
javaExpansionPorts[path] = getRandomPort()
expansionServiceOpts.put("java_port", javaExpansionPorts[path])
// setup test env
def serviceArgs = project.project(':sdks:python').mapToArgString(expansionServiceOpts)
executable 'sh'
args '-c', ". ${project.ext.envdir}/bin/activate && $pythonDir/scripts/run_expansion_services.sh stop --group_id ${project.name} && $pythonDir/scripts/run_expansion_services.sh start $serviceArgs"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could defer this to a future CL, but possibly we could still use (and test) the auto-jar-expansion-service setup here rather than manually starting the services and injecting all the ports? @chamikaramj

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't do this now, could you at least file a bug and drop a TODO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry I thought this was a question for Cham. I'm unfamiliar with this "auto-jar-expansion-service" term, can you point me to somewhere I can learn about it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@ahmedabu98 ahmedabu98 Feb 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion, it cleaned up quite a bit of unnecessary code.

It's now just building the relevant expansion jars and letting Python start them as needed. Let me know if this works! it's in the let python automatically start up... commit

}
}
}
}
Expand All @@ -2644,13 +2657,27 @@ class BeamModulePlugin implements Plugin<Project> {
def cmdArgs = project.project(':sdks:python').mapToArgString(beamPythonTestPipelineOptions)

project.exec {
environment "EXPANSION_JAR", expansionJar
environment "EXPANSION_PORT", javaExpansionPort
// environment variable name depends on number of running expansion services
if (config.expansionProjectPaths.size() == 1) {
def expansionPath = config.expansionProjectPaths.get(0)
environment "EXPANSION_JAR", project.project(expansionPath).shadowJar.archivePath
environment "EXPANSION_PORT", javaExpansionPorts[expansionPath]
} else {
def expansionJars = config.expansionProjectPaths.collect {expansionPath -> project.project(expansionPath).shadowJar.archivePath}
environment "EXPANSION_JARS", expansionJars
environment "EXPANSION_PORTS", javaExpansionPorts
}
for (envs in config.additionalEnvs){
environment envs.getKey(), envs.getValue()
}
String additionalDependencyCmd = ""
if (config.additionalDeps != null && !config.additionalDeps.isEmpty()){
additionalDependencyCmd = "&& pip install ${config.additionalDeps.join(' ')}"
}
executable 'sh'
args '-c', ". ${project.ext.envdir}/bin/activate && cd $pythonDir && ./scripts/run_integration_test.sh $cmdArgs"
args '-c', ". ${project.ext.envdir}/bin/activate " +
additionalDependencyCmd +
"&& cd $pythonDir && ./scripts/run_integration_test.sh $cmdArgs"
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions scripts/ci/release/test/resources/mass_comment.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Run PythonDocs PreCommit
Run PythonFormatter PreCommit
Run PythonLint PreCommit
Run Python_PVR_Flink PreCommit
Run Python_Xlang_Gcp_Direct PostCommit
Run RAT PreCommit
Run SQL PostCommit
Run SQL PreCommit
Expand All @@ -94,6 +95,7 @@ Run Twister2 ValidatesRunner
Run Typescript PreCommit
Run ULR Loopback ValidatesRunner
Run Whitespace PreCommit
Run Xlang_Generated_Transforms PreCommit
Run XVR_Direct PostCommit
Run XVR_Flink PostCommit
Run XVR_JavaUsingPython_Dataflow PostCommit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public List<String> outputCollectionNames() {
public String description() {
return String.format(
"Outputs a PCollection of Beam Rows, each containing a single INT64 "
+ "number called \"value\". The count is produced from the given \"start\""
+ "number called \"value\". The count is produced from the given \"start\" "
+ "value and either up to the given \"end\" or until 2^63 - 1.%n"
+ "To produce an unbounded PCollection, simply do not specify an \"end\" value. "
+ "Unbounded sequences can specify a \"rate\" for output elements.%n"
Expand Down
1 change: 1 addition & 0 deletions sdks/python/MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#

include gen_protos.py
include gen_xlang_wrappers.py
include README.md
include NOTICE
include LICENSE
Expand Down
Loading
Loading