-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[BEAM-2085] Fixups for Python resource hints. #14605
Conversation
R: @robertwb |
@@ -134,6 +134,8 @@ def _parse_storage_size_str(value): | |||
raise ValueError() | |||
|
|||
suffix = match.group(1) | |||
if suffix not in units: | |||
raise ValueError() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's put a more informative message here (e.g. ValueError("Unknown unit: %s" % suffix). Similarly above.
Also, do we want suffixes to be case sensitive. E.g. should we be rejecting "4gb"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is one interpretation where lowercase b means bits.. so wanted to avoid this confusion just in case even though unlikely
https://en.wikipedia.org/wiki/JEDEC_memory_standards#Unit_prefixes_for_semiconductor_storage_capacity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proper error will be generated in https://github.com/tvalentyn/beam/blob/3d01befb49d5c213e62e44aaccca76c4b809ea61/sdks/python/apache_beam/transforms/resources.py#L184
The keyerror was confusing that logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I suppose we can always loosen it up later more easily than tighten it up.
Even though errors are caught and re-raised, I prefer messages here, but will leave this up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see, sure, that wouldn't hurt and is more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Codecov Report
@@ Coverage Diff @@
## master #14605 +/- ##
=======================================
Coverage 83.66% 83.67%
=======================================
Files 446 446
Lines 59239 59253 +14
=======================================
+ Hits 49565 49582 +17
+ Misses 9674 9671 -3
Continue to review full report at Codecov.
|
precommit failure unrealted:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username
).[BEAM-XXX] Fixes bug in ApproximateQuantiles
, where you replaceBEAM-XXX
with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.CHANGES.md
with noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
ValidatesRunner
compliance status (on master branch)Examples testing status on various runners
Post-Commit SDK/Transform Integration Tests Status (on master branch)
Pre-Commit Tests Status (on master branch)
See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI.