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/08/24 00:20:00 UTC

[GitHub] [beam] robertwb opened a new pull request, #22834: [BEAM-22723] Yield BatchElement batches at end of window.

robertwb opened a new pull request, #22834:
URL: https://github.com/apache/beam/pull/22834

   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [ ] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`).
    - [ ] 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](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://beam.apache.org/contribute/get-started-contributing/#make-the-reviewers-job-easier).
   
   To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](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](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] robertwb merged pull request #22834: Yield BatchElement batches at end of window.

Posted by GitBox <gi...@apache.org>.
robertwb merged PR #22834:
URL: https://github.com/apache/beam/pull/22834


-- 
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] scwhittle commented on a diff in pull request #22834: [BEAM-22723] Yield BatchElement batches at end of window.

Posted by GitBox <gi...@apache.org>.
scwhittle commented on code in PR #22834:
URL: https://github.com/apache/beam/pull/22834#discussion_r953465739


##########
sdks/python/apache_beam/transforms/util.py:
##########
@@ -541,15 +541,15 @@ def process(self, element):
     self._running_batch_size += self._element_size_fn(element)
     if self._running_batch_size >= self._target_batch_size:
       with self._batch_size_estimator.record_time(self._running_batch_size):
-        yield self._batch
+        yield window.GlobalWindows.windowed_value_at_end_of_window(self._batch)

Review Comment:
   This makes it consistent, but do you think that it will cause issues?
   By doing this we're losing insight into the watermark, any produced element from the batch will automatically inherit the end of global window timestamp.
   Should we allow configuring this behavior with a TimestampCombiner?
   



-- 
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 pull request #22834: [BEAM-22723] Yield BatchElement batches at end of window.

Posted by GitBox <gi...@apache.org>.
robertwb commented on PR #22834:
URL: https://github.com/apache/beam/pull/22834#issuecomment-1225017574

   R: @TheNeuralBit CC: @scwhittle 


-- 
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 #22834: Yield BatchElement batches at end of window.

Posted by GitBox <gi...@apache.org>.
robertwb commented on code in PR #22834:
URL: https://github.com/apache/beam/pull/22834#discussion_r954367518


##########
sdks/python/apache_beam/transforms/window.py:
##########
@@ -376,6 +376,10 @@ def windowed_value(
     # type: (...) -> WindowedValue
     return WindowedValue(value, timestamp, (GlobalWindow(), ), pane_info)
 
+  @classmethod
+  def windowed_value_at_end_of_window(cls, value):
+    return cls.windowed_value(value, GlobalWindow().max_timestamp())

Review Comment:
   `end` is the exclusive end. We do want this to lie in the window in question, so max_timestamp is correct. 



-- 
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 #22834: [BEAM-22723] Yield BatchElement batches at end of window.

Posted by GitBox <gi...@apache.org>.
robertwb commented on code in PR #22834:
URL: https://github.com/apache/beam/pull/22834#discussion_r954117756


##########
sdks/python/apache_beam/transforms/util.py:
##########
@@ -541,15 +541,15 @@ def process(self, element):
     self._running_batch_size += self._element_size_fn(element)
     if self._running_batch_size >= self._target_batch_size:
       with self._batch_size_estimator.record_time(self._running_batch_size):
-        yield self._batch
+        yield window.GlobalWindows.windowed_value_at_end_of_window(self._batch)

Review Comment:
   We could allow configuration of this with a TimestampCombiner, but I'd consider that more a feature request than a bug fix. This seems, by default, the safest thing to do in the global window. (Even if we preserved the latest timestamp, there's no limit to how far back the earliest dropped timestamp might be.)



-- 
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 #22834: [BEAM-22723] Yield BatchElement batches at end of window.

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #22834:
URL: https://github.com/apache/beam/pull/22834#issuecomment-1225032847

   # [Codecov](https://codecov.io/gh/apache/beam/pull/22834?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 [#22834](https://codecov.io/gh/apache/beam/pull/22834?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (754de46) into [master](https://codecov.io/gh/apache/beam/commit/0474afbe608cc6e43f8acc3464005e98c8ff4555?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0474afb) will **decrease** coverage by `0.00%`.
   > The diff coverage is `100.00%`.
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #22834      +/-   ##
   ==========================================
   - Coverage   73.93%   73.93%   -0.01%     
   ==========================================
     Files         713      713              
     Lines       94151    94154       +3     
   ==========================================
     Hits        69612    69612              
   - Misses      23253    23256       +3     
     Partials     1286     1286              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | python | `83.50% <100.00%> (-0.01%)` | :arrow_down: |
   
   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/22834?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [sdks/python/apache\_beam/transforms/util.py](https://codecov.io/gh/apache/beam/pull/22834/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-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdHJhbnNmb3Jtcy91dGlsLnB5) | `96.06% <100.00%> (ø)` | |
   | [sdks/python/apache\_beam/transforms/window.py](https://codecov.io/gh/apache/beam/pull/22834/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-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdHJhbnNmb3Jtcy93aW5kb3cucHk=) | `87.35% <100.00%> (+0.14%)` | :arrow_up: |
   | [sdks/python/apache\_beam/transforms/combiners.py](https://codecov.io/gh/apache/beam/pull/22834/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-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vdHJhbnNmb3Jtcy9jb21iaW5lcnMucHk=) | `93.05% <0.00%> (-0.39%)` | :arrow_down: |
   | [...hon/apache\_beam/runners/worker/bundle\_processor.py](https://codecov.io/gh/apache/beam/pull/22834/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-c2Rrcy9weXRob24vYXBhY2hlX2JlYW0vcnVubmVycy93b3JrZXIvYnVuZGxlX3Byb2Nlc3Nvci5weQ==) | `93.42% <0.00%> (-0.13%)` | :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 #22834: Yield BatchElement batches at end of window.

Posted by GitBox <gi...@apache.org>.
TheNeuralBit commented on code in PR #22834:
URL: https://github.com/apache/beam/pull/22834#discussion_r954299525


##########
sdks/python/apache_beam/transforms/util_test.py:
##########
@@ -228,6 +228,23 @@ def test_windowed_batches(self):
               7,  # elements in [30, 47)
           ]))
 
+  def test_global_batch_timestamps(self):
+    # Assumes a single bundle, in order...

Review Comment:
   Since you erase the values with `len` and `equal_to` is order-agnostic, doesn't this not actually care about order?
   ```suggestion
       # Assumes a single bundle
   ```



##########
sdks/python/apache_beam/transforms/window.py:
##########
@@ -376,6 +376,10 @@ def windowed_value(
     # type: (...) -> WindowedValue
     return WindowedValue(value, timestamp, (GlobalWindow(), ), pane_info)
 
+  @classmethod
+  def windowed_value_at_end_of_window(cls, value):
+    return cls.windowed_value(value, GlobalWindow().max_timestamp())

Review Comment:
   should this be `end` instead of `max_timestamp`?



-- 
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 #22834: [BEAM-22723] Yield BatchElement batches at end of window.

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #22834:
URL: https://github.com/apache/beam/pull/22834#issuecomment-1225018225

   Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control


-- 
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 #22834: Yield BatchElement batches at end of window.

Posted by GitBox <gi...@apache.org>.
TheNeuralBit commented on code in PR #22834:
URL: https://github.com/apache/beam/pull/22834#discussion_r954298403


##########
sdks/python/apache_beam/transforms/util.py:
##########
@@ -541,15 +541,15 @@ def process(self, element):
     self._running_batch_size += self._element_size_fn(element)
     if self._running_batch_size >= self._target_batch_size:
       with self._batch_size_estimator.record_time(self._running_batch_size):
-        yield self._batch
+        yield window.GlobalWindows.windowed_value_at_end_of_window(self._batch)

Review Comment:
   Agree that feels like a new feature, I filed #22853



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