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

Support google-cloud-spanner v3 and fixes broken unit tests #23365

Merged
merged 5 commits into from
Sep 28, 2022

Conversation

Abacn
Copy link
Contributor

@Abacn Abacn commented Sep 25, 2022

The native python spannerio was proposed to be deprecated by Q4 but not happens. Still need some maintenance.

Fixes #20529
Fixes #21198

  • Fix spannerio read unit test actually not assert anything

  • Loose upperbound of spanner client library

Please add a meaningful description for your change here


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI.

@Abacn
Copy link
Contributor Author

Abacn commented Sep 25, 2022

Run SpannerIO Read 2GB Performance Test Python

@Abacn
Copy link
Contributor Author

Abacn commented Sep 25, 2022

Run Python 3.7 PostCommit

@codecov
Copy link

codecov bot commented Sep 25, 2022

Codecov Report

Merging #23365 (5b42e71) into master (19f5e62) will increase coverage by 0.01%.
The diff coverage is 66.66%.

❗ Current head 5b42e71 differs from pull request most recent head 55cc71e. Consider uploading reports for the commit 55cc71e to get more accurate results

@@            Coverage Diff             @@
##           master   #23365      +/-   ##
==========================================
+ Coverage   73.40%   73.42%   +0.01%     
==========================================
  Files         718      718              
  Lines       95620    95652      +32     
==========================================
+ Hits        70194    70230      +36     
+ Misses      24115    24111       -4     
  Partials     1311     1311              
Flag Coverage Δ
python 83.18% <66.66%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
sdks/python/apache_beam/metrics/execution.py 87.96% <ø> (ø)
...ython/apache_beam/io/gcp/experimental/spannerio.py 86.93% <66.66%> (+4.78%) ⬆️
...s/interactive/dataproc/dataproc_cluster_manager.py 71.72% <0.00%> (-5.70%) ⬇️
sdks/python/apache_beam/utils/interactive_utils.py 95.12% <0.00%> (-2.44%) ⬇️
...eam/runners/portability/fn_api_runner/execution.py 92.44% <0.00%> (-0.65%) ⬇️
...pache_beam/runners/interactive/interactive_beam.py 81.70% <0.00%> (-0.64%) ⬇️
sdks/python/apache_beam/transforms/combiners.py 93.05% <0.00%> (-0.39%) ⬇️
...eam/runners/interactive/interactive_environment.py 91.71% <0.00%> (-0.31%) ⬇️
sdks/python/apache_beam/metrics/cells.py 82.11% <0.00%> (ø)
sdks/python/apache_beam/transforms/util.py 96.06% <0.00%> (ø)
... and 6 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions
Copy link
Contributor

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @yeandy for label python.
R: @chamikaramj for label io.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@Abacn
Copy link
Contributor Author

Abacn commented Sep 25, 2022

Run SpannerIO Read 2GB Performance Test Python

@Abacn
Copy link
Contributor Author

Abacn commented Sep 25, 2022

Run Python 3.7 PostCommit

@Abacn
Copy link
Contributor Author

Abacn commented Sep 25, 2022

Run SpannerIO Read 2GB Performance Test Python

@Abacn
Copy link
Contributor Author

Abacn commented Sep 25, 2022

Run Python 3.7 PostCommit

* Fix spannerio read unit test actually not assert anything

* Loose upperbound of spanner client library
@Abacn
Copy link
Contributor Author

Abacn commented Sep 25, 2022

Run SpannerIO Read 2GB Performance Test Python

@Abacn
Copy link
Contributor Author

Abacn commented Sep 25, 2022

Run Python 3.7 PostCommit

@Abacn
Copy link
Contributor Author

Abacn commented Sep 25, 2022

apache_beam/runners/worker/sdk_worker_test.py::SdkWorkerTest::test_harness_monitoring_infos_and_metadata
will fail if runs after
apache_beam/io/gcp/experimental/spannerio_test.py::SpannerReadTest::test_read_with_index
or
apache_beam/io/gcp/experimental/spannerio_test.py::SpannerReadTest::test_read_with_table_batch

Looks like not appropriate teardown/setup for tests

@Abacn
Copy link
Contributor Author

Abacn commented Sep 25, 2022

Run Python 3.7 PostCommit

@Abacn
Copy link
Contributor Author

Abacn commented Sep 25, 2022

Run SpannerIO Read 2GB Performance Test Python

@github-actions
Copy link
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control

Copy link
Contributor

@johnjcasey johnjcasey left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -289,7 +289,8 @@ def get_portability_package_data():
'google-cloud-bigquery-storage>=2.6.3,<2.14',
'google-cloud-core>=0.28.1,<3',
'google-cloud-bigtable>=0.31.1,<2',
'google-cloud-spanner>=1.13.0,<2',
# google-cloud-spanner 2.x causes dependency parsing backoff
'google-cloud-spanner>=1.13.0,!=2,<=3.21.0',
Copy link
Contributor

@tvalentyn tvalentyn Sep 28, 2022

Choose a reason for hiding this comment

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

  1. We shouldn't use <= in the upper bound, it precludes us from asking someone to issue a patch release that could still be picked up by the constraints.
    So we can use <3.22.0 or <4.

  2. I think this is server-side dependency only, so using <4 should be safe as we do with other GCP dependencies at this time. We'll decide soon whether we want to cap upper bounds tighter for all IO.

  3. Can you please run PostCommit integration tests with google-cloud-spanner>=3.0.0 requirement if you haven't ? Unless we specify that requirement, postcommit tests will not pick up the new dependency. We can still merge the PR as is with both V1 and V3 bounds. It's also fine to switch the lower bound to V3, as going forward we won't be testing V1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(1,2) Yes we should set 'google-cloud-spanner<4' as other cloud dependencies

(3) I ran this when debugging (got some error and fixed it). From logging it shows version 3.21.0 is picked by pypi:

15:20:37 Collecting google-cloud-spanner!=2,<=3.21.0,>=1.13.0
15:20:37   Using cached google_cloud_spanner-3.21.0-py2.py3-none-any.whl (291 kB)

also

installed: apache-beam @ file:///app/sdks/python/target/.tox/.tmp/package/1/apache-beam-2.43.0.dev0.zip,cachetools==4.2.4,...,google-cloud-recommendations-ai==0.7.1,google-cloud-spanner==3.21.0,...

jenkins already cached v3.21.0 and is using it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, change applied.

@tvalentyn
Copy link
Contributor

cc: @BjornPrime

@Abacn
Copy link
Contributor Author

Abacn commented Sep 28, 2022

Run Python 3.7 PostCommit

@Abacn
Copy link
Contributor Author

Abacn commented Sep 28, 2022

Run SpannerIO Read 2GB Performance Test Python

@Abacn
Copy link
Contributor Author

Abacn commented Sep 28, 2022

Integration test and performance test passed with cloud-spanner v3.22.0. Could revert back the last commit

@tvalentyn tvalentyn closed this Sep 28, 2022
@tvalentyn tvalentyn reopened this Sep 28, 2022
@tvalentyn tvalentyn changed the title Python SpannerIO Fixes Support google-cloud-spanner v3 and fixes broken unit tests Sep 28, 2022
@tvalentyn tvalentyn merged commit 1427b7d into apache:master Sep 28, 2022
@Abacn Abacn deleted the bumpspannerioversion branch September 28, 2022 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants