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 25 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
95 changes: 95 additions & 0 deletions .github/workflows/beam_PostCommit_Python_Xlang_IO_Direct.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# 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: PostCommit Python Xlang IO Direct

on:
schedule:
- cron: '30 5/6 * * *'
pull_request_target:
paths: ['release/trigger_all_tests.json', '.github/trigger_files/beam_PostCommit_Python_Xlang_IO_Direct.json']
tvalentyn marked this conversation as resolved.
Show resolved Hide resolved
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: write
checks: write
contents: read
deployments: read
id-token: none
issues: write
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.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_PostCommit_Python_Xlang_IO_Direct:
if: |
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request_target' ||
(github.event_name == 'schedule' && github.repository == 'apache/beam') ||
github.event.comment.body == 'Run Python_Xlang_IO_Direct PostCommit'
runs-on: [self-hosted, ubuntu-20.04, main]
timeout-minutes: 100
name: ${{ matrix.job_name }} (${{ matrix.job_phrase }})
strategy:
matrix:
job_name: ["beam_PostCommit_Python_Xlang_IO_Direct"]
job_phrase: ["Run Python_Xlang_IO_Direct PostCommit"]
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:
python-version: |
3.8
3.11
- name: run PostCommit Python Xlang IO Direct script
uses: ./.github/actions/gradle-command-self-hosted-action
with:
gradle-command: :sdks:python:test-suites:direct:ioCrossLanguagePostCommit
- name: Archive Python Test Results
uses: actions/upload-artifact@v3
if: failure()
with:
name: Python Test Results
path: '**/pytest*.xml'
- name: Publish Python Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
commit: '${{ env.prsha || env.GITHUB_SHA }}'
comment_mode: ${{ github.event_name == 'issue_comment' && 'always' || 'off' }}
files: '**/pytest*.xml'
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/**/*_et.py
sdks/python/apache_beam/portability/api/*
sdks/python/nosetests*.xml
sdks/python/pytest*.xml
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
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ class ExternalSchemaTransformProvider:
"""Dynamically discovers Schema-aware external transforms from a given list
of expansion services and provides them as ready PTransforms.

A :class:`ExternalSchemaTransform` subclass is generated for each external
An :class:`ExternalSchemaTransform` subclass is generated for each external
transform, and is named based on what can be inferred from the URN
(see :param urn_pattern).
(see the `urn_pattern` parameter).

These classes are generated when :class:`ExternalSchemaTransformProvider` is
initialized. We need to give it one or more expansion service addresses that
Expand Down Expand Up @@ -256,7 +256,7 @@ def _create_wrappers(self):

if skipped_urns:
logging.info(
"Skipped URN(s) in %s that don't follow the pattern [%s]: %s",
"Skipped URN(s) in %s that don't follow the pattern \"%s\": %s",
target,
self._urn_pattern,
skipped_urns)
Expand All @@ -268,6 +268,10 @@ def get_available(self) -> List[Tuple[str, str]]:
"""Get a list of available ExternalSchemaTransform names and identifiers"""
return list(self._name_to_urn.items())

def get_all(self) -> Dict[str, ExternalSchemaTransform]:
"""Get all ExternalSchemaTransforms"""
return self._transforms

def get(self, name) -> ExternalSchemaTransform:
"""Get an ExternalSchemaTransform by its inferred class name"""
return self._transforms[self._name_to_urn[name]]
Expand Down
Loading
Loading