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

Fix PipelineOptionTest.test_display_data #25007

Merged
merged 1 commit into from
Jan 17, 2023
Merged

Conversation

Abacn
Copy link
Contributor

@Abacn Abacn commented Jan 13, 2023

Fixes #21116

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:

  • 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.

@codecov
Copy link

codecov bot commented Jan 13, 2023

Codecov Report

Merging #25007 (8e14be3) into master (6de4d5f) will increase coverage by 7.91%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master   #25007      +/-   ##
==========================================
+ Coverage   65.20%   73.12%   +7.91%     
==========================================
  Files         735      735              
  Lines       98146    98146              
==========================================
+ Hits        64000    71769    +7769     
+ Misses      32782    25013    -7769     
  Partials     1364     1364              
Flag Coverage Δ
python 82.67% <0.00%> (+11.46%) ⬆️

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

Impacted Files Coverage Δ
...s/python/apache_beam/examples/snippets/snippets.py 76.70% <0.00%> (ø)
...hon/apache_beam/runners/direct/test_stream_impl.py 93.28% <0.00%> (-0.75%) ⬇️
sdks/python/apache_beam/transforms/util.py 96.24% <0.00%> (-0.16%) ⬇️
...ks/python/apache_beam/runners/worker/operations.py 74.32% <0.00%> (+0.14%) ⬆️
sdks/python/apache_beam/transforms/environments.py 88.26% <0.00%> (+0.29%) ⬆️
...eam/runners/interactive/interactive_environment.py 92.02% <0.00%> (+0.30%) ⬆️
...ks/python/apache_beam/runners/worker/sdk_worker.py 89.08% <0.00%> (+0.48%) ⬆️
...python/apache_beam/runners/worker/worker_status.py 75.33% <0.00%> (+0.66%) ⬆️
sdks/python/apache_beam/internal/dill_pickler.py 84.17% <0.00%> (+0.71%) ⬆️
sdks/python/apache_beam/runners/common.py 88.59% <0.00%> (+0.72%) ⬆️
... and 159 more

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

@Abacn Abacn force-pushed the tryfixdisplaydata branch from 2ff7c08 to ae0b68c Compare January 13, 2023 22:09
@Abacn
Copy link
Contributor Author

Abacn commented Jan 13, 2023

ref: https://stackoverflow.com/questions/52428679/how-to-remove-classes-from-subclasses

tested this approach should work. Code snippet:

from apache_beam.options.pipeline_options import PipelineOptions

class PipelineOptionTest:
  class UserDefinedOptions(PipelineOptions):
    @classmethod
    def _add_argparse_args(cls, parser):
      parser.add_value_provider_argument('--gcs_location')

  @classmethod
  def setUpClass(cls):
    cls.UserDefinedOptions = PipelineOptionTest.UserDefinedOptions

  def tearDown(self):
    # Unset the option added in setupClass to avoid interfere with other tests
    del PipelineOptionTest.UserDefinedOptions
    import gc
    gc.collect()

  def run(self):
    print(PipelineOptions.__subclasses__())
    x = PipelineOptions().get_all_options()
    print(x)

if __name__ == '__main__':
  test_instance = PipelineOptionTest()
  test_instance.setUpClass()
  test_instance.run()
  test_instance.tearDown()
  test_instance.run()

output:

{'runner': None, ... 's3_region_name': None, 's3_api_version': None, 's3_verify': None, 's3_disable_ssl': False, 'gcs_location': <apache_beam.options.value_provider.RuntimeValueProvider object at 0x1288d3c70>}
{'runner': None, ... 's3_region_name': None, 's3_api_version': None, 's3_verify': None, 's3_disable_ssl': False}

as can be seen the second run there is no longer --gcs_location

@Abacn Abacn marked this pull request as ready for review January 13, 2023 22:14
@Abacn Abacn force-pushed the tryfixdisplaydata branch from ae0b68c to 8e14be3 Compare January 13, 2023 22:50
@github-actions
Copy link
Contributor

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

R: @damccorm for label python.
R: @ahmedabu98 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 Jan 17, 2023

R: @damccorm

@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

@damccorm damccorm left a comment

Choose a reason for hiding this comment

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

Nice find!

@Abacn Abacn merged commit bb7b64a into apache:master Jan 17, 2023
@Abacn Abacn deleted the tryfixdisplaydata branch January 17, 2023 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python PreCommit flaking in PipelineOptionsTest.test_display_data
2 participants