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 incorrect parsing of None value parameters. #24948

Merged
merged 3 commits into from
Jan 17, 2023

Conversation

melaniedc
Copy link
Contributor

@melaniedc melaniedc commented Jan 9, 2023

When a parameter is set as None it gets parsed as the string "None". By not setting the flag in pipeline_options.py we allow it to be set to the default value, which correctly resolves to None.

R: @robertwb
R: @lukecwik


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

  • [ n/a ] 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.
  • [ n/a ] Update CHANGES.md with noteworthy changes.
  • [ n/a ] 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.

@github-actions github-actions bot added the python label Jan 9, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2023

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

R: @AnandInguva for label python.

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

@codecov
Copy link

codecov bot commented Jan 9, 2023

Codecov Report

Merging #24948 (2aabc0b) into master (a803789) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #24948      +/-   ##
==========================================
- Coverage   73.07%   73.06%   -0.02%     
==========================================
  Files         735      735              
  Lines       98133    98135       +2     
==========================================
- Hits        71710    71701       -9     
- Misses      25063    25074      +11     
  Partials     1360     1360              
Flag Coverage Δ
python 82.68% <100.00%> (-0.02%) ⬇️

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

Impacted Files Coverage Δ
...dks/python/apache_beam/options/pipeline_options.py 93.97% <100.00%> (+0.02%) ⬆️
.../python/apache_beam/testing/test_stream_service.py 88.09% <0.00%> (-4.77%) ⬇️
sdks/python/apache_beam/utils/interactive_utils.py 95.12% <0.00%> (-2.44%) ⬇️
...che_beam/runners/interactive/interactive_runner.py 90.50% <0.00%> (-1.27%) ⬇️
sdks/python/apache_beam/internal/metrics/metric.py 93.00% <0.00%> (-1.00%) ⬇️
...hon/apache_beam/runners/direct/test_stream_impl.py 93.28% <0.00%> (-0.75%) ⬇️
sdks/python/apache_beam/transforms/combiners.py 93.05% <0.00%> (-0.39%) ⬇️
...on/apache_beam/runners/dataflow/dataflow_runner.py 81.74% <0.00%> (-0.15%) ⬇️
sdks/python/apache_beam/runners/common.py 88.59% <0.00%> (-0.13%) ⬇️

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

@@ -284,6 +284,10 @@ def from_dictionary(cls, options):
flags.append('--%s=%s' % (k, i))
elif isinstance(v, dict):
flags.append('--%s=%s' % (k, json.dumps(v)))
elif v is None:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also write a small test for this None type args?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a unit test case and confirmed it fails without and passes with my change in my local env.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2023

R: @tvalentyn for final approval

@AnandInguva
Copy link
Contributor

PythonDocs test is unrelated and fix is provided at #25000

Copy link
Contributor

@AnandInguva AnandInguva left a comment

Choose a reason for hiding this comment

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

LGTM once formatting is fixed.

@AnandInguva
Copy link
Contributor

R : @damccorm @jrmccluskey for final review ( Valentyn on vacation)

Copy link
Contributor

@jrmccluskey jrmccluskey left a comment

Choose a reason for hiding this comment

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

LGTM, will wait on tests that required committer approval to get finished ahead of merging.

@damccorm
Copy link
Contributor

Run Python PreCommit

@jrmccluskey jrmccluskey merged commit 8d4c00e into apache:master Jan 17, 2023
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.

4 participants