You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "lostluck (via GitHub)" <gi...@apache.org> on 2024/03/04 23:52:13 UTC
[PR] [#30083] Add processing time to prism. [beam]
lostluck opened a new pull request, #30492:
URL: https://github.com/apache/beam/pull/30492
Add a ProcessingTime queue to Prism's element manager, that can be appropriately controlled by the TestStream notion of time.
Basic design is that the queue doesn't contain the elements, but instead manages which stage needs to be notified when to inject queue elements into processing, and in particular, syncing it with existing watermark processing, which decides when elements are ready to be processed anyway. This allows continuing to have each stage maintain all the state for the stage, instead of splitting it between the element manager and the stages.
------------------------
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
- [ ] 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://github.com/apache/beam/blob/master/CONTRIBUTING.md#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)
------------------------------------------------------------------------------------------------
[](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
[](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 or the [workflows README](https://github.com/apache/beam/blob/master/.github/workflows/README.md) to see a list of phrases to trigger workflows.
--
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
Re: [PR] [#30083] Add synthetic processing time to prism. [beam]
Posted by "lostluck (via GitHub)" <gi...@apache.org>.
lostluck commented on PR #30492:
URL: https://github.com/apache/beam/pull/30492#issuecomment-2136437211
> LGTM pending the latest check re-run passes; nothing really stood out for me accept for the couple of comments.
The only failure was the Dataflow run of the ProcessingTime_Bounded test, which I had not filtered out. Dataflow only properly handles processing time in Streaming pipelines,and that test pipeline executes as "batch".
--
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
Re: [PR] [#30083] Add synthetic processing time to prism. [beam]
Posted by "lostluck (via GitHub)" <gi...@apache.org>.
lostluck commented on code in PR #30492:
URL: https://github.com/apache/beam/pull/30492#discussion_r1618121829
##########
sdks/go/pkg/beam/runners/prism/internal/stage.go:
##########
@@ -55,15 +55,16 @@ type link struct {
// account, but all serialization boundaries remain since the pcollections
// would continue to get serialized.
type stage struct {
- ID string
- transforms []string
- primaryInput string // PCollection used as the parallel input.
- outputs []link // PCollections that must escape this stage.
- sideInputs []engine.LinkID // Non-parallel input PCollections and their consumers
- internalCols []string // PCollections that escape. Used for precise coder sending.
- envID string
- stateful bool
- hasTimers []string
+ ID string
+ transforms []string
+ primaryInput string // PCollection used as the parallel input.
+ outputs []link // PCollections that must escape this stage.
+ sideInputs []engine.LinkID // Non-parallel input PCollections and their consumers
+ internalCols []string // PCollections that escape. Used for precise coder sending.
+ envID string
+ stateful bool
+ hasTimers []string
+ processingTimeTimers map[string]bool
Review Comment:
There are only two time domains (Event, and Processing), and since event time was implemented first, it was the default, while processing time needs to be called out specifically.
There's certainly improvements we can make to how these are handled, but ultimately we need a mapping from timer names, to their domains in the element manager.
--
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
Re: [PR] [#30083] Add synthetic processing time to prism. [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #30492:
URL: https://github.com/apache/beam/pull/30492#issuecomment-2135874520
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
Re: [PR] [#30083] Add processing time to prism. [beam]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #30492:
URL: https://github.com/apache/beam/pull/30492#issuecomment-2013683295
## [Codecov](https://app.codecov.io/gh/apache/beam/pull/30492?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
Attention: Patch coverage is `82.55814%` with `15 lines` in your changes are missing coverage. Please review.
> Project coverage is 38.55%. Comparing base [(`6406cfe`)](https://app.codecov.io/gh/apache/beam/commit/6406cfe3c9b613e3a5aef334c458d7e20c5502c2?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`275e307`)](https://app.codecov.io/gh/apache/beam/pull/30492?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
> Report is 145 commits behind head on master.
| [Files](https://app.codecov.io/gh/apache/beam/pull/30492?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...am/runners/prism/internal/engine/elementmanager.go](https://app.codecov.io/gh/apache/beam/pull/30492?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2Rrcy9nby9wa2cvYmVhbS9ydW5uZXJzL3ByaXNtL2ludGVybmFsL2VuZ2luZS9lbGVtZW50bWFuYWdlci5nbw==) | 26.66% | [10 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/beam/pull/30492?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [sdks/go/pkg/beam/runners/prism/internal/stage.go](https://app.codecov.io/gh/apache/beam/pull/30492?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2Rrcy9nby9wa2cvYmVhbS9ydW5uZXJzL3ByaXNtL2ludGVybmFsL3N0YWdlLmdv) | 85.18% | [2 Missing and 2 partials :warning: ](https://app.codecov.io/gh/apache/beam/pull/30492?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #30492 +/- ##
==========================================
+ Coverage 38.52% 38.55% +0.02%
==========================================
Files 698 699 +1
Lines 102374 102439 +65
==========================================
+ Hits 39442 39497 +55
- Misses 61302 61307 +5
- Partials 1630 1635 +5
```
| [Flag](https://app.codecov.io/gh/apache/beam/pull/30492/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [go](https://app.codecov.io/gh/apache/beam/pull/30492/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `54.37% <82.55%> (+0.05%)` | :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=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/beam/pull/30492?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
--
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
Re: [PR] [#30083] Add processing time to prism. [beam]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #30492:
URL: https://github.com/apache/beam/pull/30492#issuecomment-2071003838
## [Codecov](https://app.codecov.io/gh/apache/beam/pull/30492?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
Attention: Patch coverage is `82.55814%` with `15 lines` in your changes are missing coverage. Please review.
> Project coverage is 38.55%. Comparing base [(`8dcbf96`)](https://app.codecov.io/gh/apache/beam/commit/8dcbf967a1a692da4aef7dec79922795e83013dc?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`275e307`)](https://app.codecov.io/gh/apache/beam/pull/30492?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
> Report is 6 commits behind head on master.
> :exclamation: Current head 275e307 differs from pull request most recent head f434d46. Consider uploading reports for the commit f434d46 to get more accurate results
| [Files](https://app.codecov.io/gh/apache/beam/pull/30492?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...am/runners/prism/internal/engine/elementmanager.go](https://app.codecov.io/gh/apache/beam/pull/30492?src=pr&el=tree&filepath=sdks%2Fgo%2Fpkg%2Fbeam%2Frunners%2Fprism%2Finternal%2Fengine%2Felementmanager.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2Rrcy9nby9wa2cvYmVhbS9ydW5uZXJzL3ByaXNtL2ludGVybmFsL2VuZ2luZS9lbGVtZW50bWFuYWdlci5nbw==) | 26.66% | [10 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/beam/pull/30492?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [sdks/go/pkg/beam/runners/prism/internal/stage.go](https://app.codecov.io/gh/apache/beam/pull/30492?src=pr&el=tree&filepath=sdks%2Fgo%2Fpkg%2Fbeam%2Frunners%2Fprism%2Finternal%2Fstage.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c2Rrcy9nby9wa2cvYmVhbS9ydW5uZXJzL3ByaXNtL2ludGVybmFsL3N0YWdlLmdv) | 85.18% | [2 Missing and 2 partials :warning: ](https://app.codecov.io/gh/apache/beam/pull/30492?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #30492 +/- ##
===========================================
+ Coverage 0 38.55% +38.55%
===========================================
Files 0 699 +699
Lines 0 102439 +102439
===========================================
+ Hits 0 39497 +39497
- Misses 0 61307 +61307
- Partials 0 1635 +1635
```
| [Flag](https://app.codecov.io/gh/apache/beam/pull/30492/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [go](https://app.codecov.io/gh/apache/beam/pull/30492/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `54.37% <82.55%> (?)` | |
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=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/beam/pull/30492?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
--
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
Re: [PR] [#30083] Add processing time to prism. [beam]
Posted by "lostluck (via GitHub)" <gi...@apache.org>.
lostluck commented on PR #30492:
URL: https://github.com/apache/beam/pull/30492#issuecomment-2135869842
R: @damondouglas
--
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
Re: [PR] [#30083] Add synthetic processing time to prism. [beam]
Posted by "lostluck (via GitHub)" <gi...@apache.org>.
lostluck commented on code in PR #30492:
URL: https://github.com/apache/beam/pull/30492#discussion_r1618123753
##########
sdks/go/pkg/beam/runners/prism/internal/engine/elementmanager.go:
##########
@@ -305,8 +312,13 @@ func (em *ElementManager) Bundles(ctx context.Context, nextBundID func() string)
for {
em.refreshCond.L.Lock()
+ // Check if processing time has advanced before the wait loop.
+ emNow := em.ProcessingTimeNow()
+ ptRefreshed := em.processTimeEvents.AdvanceTo(emNow)
+ em.watermarkRefreshes.merge(ptRefreshed)
+
// If there are no watermark refreshes available, we wait until there are.
- for len(em.watermarkRefreshes) == 0 {
+ for len(em.watermarkRefreshes)+len(ptRefreshed) == 0 { // TODO Add processing time event condition instead of piggybacking on watermarks?
Review Comment:
In this case, it's a leftover comment. The "ProcessingTime event condition" is basically rthat list of stages that have been triggered by the Processing time queue. I originally was keeping everything in the watermark refreshes instead, but that didn't work as cleanly as I hoped.
Old comment removed, other comment clarified.
--
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
Re: [PR] [#30083] Add synthetic processing time to prism. [beam]
Posted by "damondouglas (via GitHub)" <gi...@apache.org>.
damondouglas commented on code in PR #30492:
URL: https://github.com/apache/beam/pull/30492#discussion_r1618025133
##########
sdks/go/pkg/beam/runners/prism/internal/stage.go:
##########
@@ -55,15 +55,16 @@ type link struct {
// account, but all serialization boundaries remain since the pcollections
// would continue to get serialized.
type stage struct {
- ID string
- transforms []string
- primaryInput string // PCollection used as the parallel input.
- outputs []link // PCollections that must escape this stage.
- sideInputs []engine.LinkID // Non-parallel input PCollections and their consumers
- internalCols []string // PCollections that escape. Used for precise coder sending.
- envID string
- stateful bool
- hasTimers []string
+ ID string
+ transforms []string
+ primaryInput string // PCollection used as the parallel input.
+ outputs []link // PCollections that must escape this stage.
+ sideInputs []engine.LinkID // Non-parallel input PCollections and their consumers
+ internalCols []string // PCollections that escape. Used for precise coder sending.
+ envID string
+ stateful bool
+ hasTimers []string
+ processingTimeTimers map[string]bool
Review Comment:
Is https://github.com/lostluck/beam/blob/beam30083ProcessingTimme/sdks/go/pkg/beam/runners/prism/internal/engine/elementmanager.go#L843 the reason why we only have a map of processing time timers and not event time timers?
##########
sdks/go/pkg/beam/runners/prism/internal/engine/engine_test.go:
##########
@@ -221,3 +221,46 @@ func TestTestStream(t *testing.T) {
}
}
}
+
+// TestProcessingTime is the suite for validating behaviors around ProcessingTime.
+// Separate from the TestStream, Timers, and Triggers tests due to the unique nature
+// of the time domain.
+func TestProcessingTime(t *testing.T) {
+ initRunner(t)
+
+ tests := []struct {
+ pipeline func(s beam.Scope)
+ }{
+ {pipeline: primitives.TimersProcessingTimeTestStream_Infinity},
+ {pipeline: primitives.TimersProcessingTime_Bounded},
+ {pipeline: primitives.TimersProcessingTime_Unbounded},
+ }
+
+ configs := []struct {
+ name string
+ OneElementPerKey, OneKeyPerBundle bool
+ }{
+ {"Greedy", false, false},
+ {"AllElementsPerKey", false, true},
+ {"OneElementPerKey", true, false},
+ // {"OneElementPerBundle", true, true}, // Reveals flaky behavior
Review Comment:
Not PR blocking and not sure if this might be problematic for the AllElementsPerKey and OneElementPerKey cases in the future. I commented out this flakey OneElementPerBundle case and inserted log statements after https://github.com/lostluck/beam/blob/beam30083ProcessingTimme/sdks/go/test/integration/primitives/timers.go#L197 and after https://github.com/lostluck/beam/blob/beam30083ProcessingTimme/sdks/go/test/integration/primitives/timers.go#L210. I observed that the key associated with the panic here: https://github.com/lostluck/beam/blob/beam30083ProcessingTimme/sdks/go/test/integration/primitives/timers.go#L213 never appeared in the aforementioned logged steps. I haven't yet figured out why this is but wanted to relay my findings.
##########
sdks/go/pkg/beam/runners/prism/internal/engine/elementmanager.go:
##########
@@ -305,8 +312,13 @@ func (em *ElementManager) Bundles(ctx context.Context, nextBundID func() string)
for {
em.refreshCond.L.Lock()
+ // Check if processing time has advanced before the wait loop.
+ emNow := em.ProcessingTimeNow()
+ ptRefreshed := em.processTimeEvents.AdvanceTo(emNow)
+ em.watermarkRefreshes.merge(ptRefreshed)
+
// If there are no watermark refreshes available, we wait until there are.
- for len(em.watermarkRefreshes) == 0 {
+ for len(em.watermarkRefreshes)+len(ptRefreshed) == 0 { // TODO Add processing time event condition instead of piggybacking on watermarks?
Review Comment:
Non PR blocking but curious what "processing time event condition" means and especially with respect to the "instead of" in the TODO statement.
--
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
Re: [PR] [#30083] Add synthetic processing time to prism. [beam]
Posted by "lostluck (via GitHub)" <gi...@apache.org>.
lostluck commented on code in PR #30492:
URL: https://github.com/apache/beam/pull/30492#discussion_r1618120893
##########
sdks/go/pkg/beam/runners/prism/internal/engine/engine_test.go:
##########
@@ -221,3 +221,46 @@ func TestTestStream(t *testing.T) {
}
}
}
+
+// TestProcessingTime is the suite for validating behaviors around ProcessingTime.
+// Separate from the TestStream, Timers, and Triggers tests due to the unique nature
+// of the time domain.
+func TestProcessingTime(t *testing.T) {
+ initRunner(t)
+
+ tests := []struct {
+ pipeline func(s beam.Scope)
+ }{
+ {pipeline: primitives.TimersProcessingTimeTestStream_Infinity},
+ {pipeline: primitives.TimersProcessingTime_Bounded},
+ {pipeline: primitives.TimersProcessingTime_Unbounded},
+ }
+
+ configs := []struct {
+ name string
+ OneElementPerKey, OneKeyPerBundle bool
+ }{
+ {"Greedy", false, false},
+ {"AllElementsPerKey", false, true},
+ {"OneElementPerKey", true, false},
+ // {"OneElementPerBundle", true, true}, // Reveals flaky behavior
Review Comment:
I had not observed that specific behavior (the key not being in the logs in an earlier part of the same call). Very interesting. The latter log is designed to catch that specific flake a bit more clearly than the downstream handling. We'll get it! I believe in us.
--
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
Re: [PR] [#30083] Add synthetic processing time to prism. [beam]
Posted by "lostluck (via GitHub)" <gi...@apache.org>.
lostluck merged PR #30492:
URL: https://github.com/apache/beam/pull/30492
--
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