You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/11/07 21:59:38 UTC
[GitHub] [beam] TheNeuralBit opened a new pull request, #24022: [WIP] Add error reporting for BatchConverters
TheNeuralBit opened a new pull request, #24022:
URL: https://github.com/apache/beam/pull/24022
Fixes #21654
TODO:
- Handle bad dtypes in pytorch
- Add tests for pytorch
GitHub Actions Tests Status (on master branch)
------------------------------------------------------------------------------------------------
[![Build python source distribution and wheels](https://github.com/apache/beam/workflows/Build%20python%20source%20distribution%20and%20wheels/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
[![Python tests](https://github.com/apache/beam/workflows/Python%20tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
[![Java tests](https://github.com/apache/beam/workflows/Java%20Tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
[![Go tests](https://github.com/apache/beam/workflows/Go%20tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Go+tests%22+branch%3Amaster+event%3Aschedule)
See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] github-actions[bot] commented on pull request #24022: Add error reporting for BatchConverter match failure
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #24022:
URL: https://github.com/apache/beam/pull/24022#issuecomment-1308160084
Assigning reviewers. If you would like to opt out of this review, comment `assign to next reviewer`:
R: @pabloem 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).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] TheNeuralBit merged pull request #24022: Add error reporting for BatchConverter match failure
Posted by GitBox <gi...@apache.org>.
TheNeuralBit merged PR #24022:
URL: https://github.com/apache/beam/pull/24022
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] robertwb commented on a diff in pull request #24022: Add error reporting for BatchConverter match failure
Posted by GitBox <gi...@apache.org>.
robertwb commented on code in PR #24022:
URL: https://github.com/apache/beam/pull/24022#discussion_r1021950368
##########
sdks/python/apache_beam/typehints/batch.py:
##########
@@ -72,26 +74,36 @@ def estimate_byte_size(self, batch):
raise NotImplementedError
@staticmethod
- def register(
- batch_converter_constructor: Callable[[type, type], 'BatchConverter']):
- BATCH_CONVERTER_REGISTRY.append(batch_converter_constructor)
- return batch_converter_constructor
+ def register(*, name: str):
+ def do_registration(
+ batch_converter_constructor: Callable[[type, type], 'BatchConverter']):
+ if name in BATCH_CONVERTER_REGISTRY:
+ raise AssertionError(
+ f"Attempted to register two batch converters with name {name}")
+
+ BATCH_CONVERTER_REGISTRY[name] = batch_converter_constructor
+ return batch_converter_constructor
+
+ return do_registration
@staticmethod
def from_typehints(*, element_type, batch_type) -> 'BatchConverter':
element_type = typehints.normalize(element_type)
batch_type = typehints.normalize(batch_type)
- for constructor in BATCH_CONVERTER_REGISTRY:
- result = constructor(element_type, batch_type)
- if result is not None:
+ errors = {}
+ for name, constructor in BATCH_CONVERTER_REGISTRY.items():
+ try:
+ result = constructor(element_type, batch_type)
+ except TypeError as e:
+ errors[name] = e.args[0]
+ else:
return result
Review Comment:
It's fine to just `return constructor(element_type, batch_type)` in the try clause rather than have an else clause here, as the act of returning can't raise a TypeError.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] TheNeuralBit commented on pull request #24022: Add error reporting for BatchConverter match failure
Posted by GitBox <gi...@apache.org>.
TheNeuralBit commented on PR #24022:
URL: https://github.com/apache/beam/pull/24022#issuecomment-1315657394
Run Python PreCommit
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] TheNeuralBit commented on pull request #24022: Add error reporting for BatchConverter match failure
Posted by GitBox <gi...@apache.org>.
TheNeuralBit commented on PR #24022:
URL: https://github.com/apache/beam/pull/24022#issuecomment-1308025723
CC: @robertwb
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] codecov[bot] commented on pull request #24022: [WIP] Add error reporting for BatchConverters
Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #24022:
URL: https://github.com/apache/beam/pull/24022#issuecomment-1306315990
# [Codecov](https://codecov.io/gh/apache/beam/pull/24022?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#24022](https://codecov.io/gh/apache/beam/pull/24022?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (180ff0c) into [master](https://codecov.io/gh/apache/beam/commit/380d4730d3c52b5c2165bdb84aac11d0feccfe4f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (380d473) will **increase** coverage by `0.00%`.
> The diff coverage is `81.66%`.
```diff
@@ Coverage Diff @@
## master #24022 +/- ##
=======================================
Coverage 73.39% 73.40%
=======================================
Files 710 710
Lines 96122 96134 +12
=======================================
+ Hits 70553 70567 +14
+ Misses 24253 24251 -2
Partials 1316 1316
```
| Flag | Coverage Δ | |
|---|---|---|
| python | `83.20% <81.66%> (+<0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/beam/pull/24022?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...pache\_beam/typehints/pytorch\_type\_compatibility.py](https://codecov.io/gh/apache/beam/pull/24022/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdHlwZWhpbnRzL3B5dG9yY2hfdHlwZV9jb21wYXRpYmlsaXR5LnB5) | `0.00% <0.00%> (ø)` | |
| [sdks/python/apache\_beam/typehints/batch.py](https://codecov.io/gh/apache/beam/pull/24022/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdHlwZWhpbnRzL2JhdGNoLnB5) | `92.21% <93.54%> (+1.13%)` | :arrow_up: |
| [.../apache\_beam/typehints/arrow\_type\_compatibility.py](https://codecov.io/gh/apache/beam/pull/24022/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdHlwZWhpbnRzL2Fycm93X3R5cGVfY29tcGF0aWJpbGl0eS5weQ==) | `86.82% <100.00%> (+0.57%)` | :arrow_up: |
| [...apache\_beam/typehints/pandas\_type\_compatibility.py](https://codecov.io/gh/apache/beam/pull/24022/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdHlwZWhpbnRzL3BhbmRhc190eXBlX2NvbXBhdGliaWxpdHkucHk=) | `98.29% <100.00%> (+2.49%)` | :arrow_up: |
| [.../python/apache\_beam/testing/test\_stream\_service.py](https://codecov.io/gh/apache/beam/pull/24022/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdGVzdGluZy90ZXN0X3N0cmVhbV9zZXJ2aWNlLnB5) | `88.09% <0.00%> (-4.77%)` | :arrow_down: |
| [.../python/apache\_beam/transforms/periodicsequence.py](https://codecov.io/gh/apache/beam/pull/24022/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdHJhbnNmb3Jtcy9wZXJpb2RpY3NlcXVlbmNlLnB5) | `97.01% <0.00%> (-1.50%)` | :arrow_down: |
| [...che\_beam/runners/interactive/interactive\_runner.py](https://codecov.io/gh/apache/beam/pull/24022/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vcnVubmVycy9pbnRlcmFjdGl2ZS9pbnRlcmFjdGl2ZV9ydW5uZXIucHk=) | `90.50% <0.00%> (-1.27%)` | :arrow_down: |
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] TheNeuralBit commented on a diff in pull request #24022: Add error reporting for BatchConverter match failure
Posted by GitBox <gi...@apache.org>.
TheNeuralBit commented on code in PR #24022:
URL: https://github.com/apache/beam/pull/24022#discussion_r1022097094
##########
sdks/python/apache_beam/typehints/batch.py:
##########
@@ -72,26 +74,36 @@ def estimate_byte_size(self, batch):
raise NotImplementedError
@staticmethod
- def register(
- batch_converter_constructor: Callable[[type, type], 'BatchConverter']):
- BATCH_CONVERTER_REGISTRY.append(batch_converter_constructor)
- return batch_converter_constructor
+ def register(*, name: str):
+ def do_registration(
+ batch_converter_constructor: Callable[[type, type], 'BatchConverter']):
+ if name in BATCH_CONVERTER_REGISTRY:
+ raise AssertionError(
+ f"Attempted to register two batch converters with name {name}")
+
+ BATCH_CONVERTER_REGISTRY[name] = batch_converter_constructor
+ return batch_converter_constructor
+
+ return do_registration
@staticmethod
def from_typehints(*, element_type, batch_type) -> 'BatchConverter':
element_type = typehints.normalize(element_type)
batch_type = typehints.normalize(batch_type)
- for constructor in BATCH_CONVERTER_REGISTRY:
- result = constructor(element_type, batch_type)
- if result is not None:
+ errors = {}
+ for name, constructor in BATCH_CONVERTER_REGISTRY.items():
+ try:
+ result = constructor(element_type, batch_type)
+ except TypeError as e:
+ errors[name] = e.args[0]
+ else:
return result
Review Comment:
Done, thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org