-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add @yields_batches and @yields_elements #19268
Conversation
Despite the inlining this PR seems to have a minor effect (
This PR:
|
Codecov Report
@@ Coverage Diff @@
## master #19268 +/- ##
==========================================
- Coverage 74.09% 74.02% -0.07%
==========================================
Files 697 698 +1
Lines 91986 92209 +223
==========================================
+ Hits 68154 68258 +104
- Misses 22583 22702 +119
Partials 1249 1249
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
The "per element" line seems to be missing from the benchmarks. What is the relative difference? |
Apologies, somehow the formatting was such that the per-element line was hidden after a bunch of spaces. It's there now. |
Thanks. The difference looks more like 0.01-0.02 microseconds, or a couple percent, which is more acceptable. |
retest this please |
Run Portable_Python PreCommit |
Run PythonDocker PreCommit |
1 similar comment
Run PythonDocker PreCommit |
Run Portable_Python PreCommit |
* Add yields_batches and yields_elements decorators * Handle timestamp propagation for element-to-batch and batch-to-element * fixup! Handle timestamp propagation for element-to-batch and batch-to-element
This PR adds two new decorators,
@yields_batches
and@yields_elements
, which override the default interpretation for the output ofDoFn.process
andDoFn.process_batch
. These decorators are handled via changes toOutputProcessor
(now renamed toOutputHandler
for clarity), which branches depending on whether batches or elements are expected in theresults
iterable.Where possible, common logic in
OutputHandler
was extracted into private helper methods that are re-used. The .pxd definition for these methods indicates they should be inlined in cython-generated code so they don't affect performance.Fixes #21656
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI.