[Prism] Support injecting triggered bundle for a batch of elements. - #36219
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #36219 +/- ##
============================================
+ Coverage 36.09% 36.12% +0.02%
Complexity 1618 1618
============================================
Files 1057 1057
Lines 164358 164415 +57
Branches 1165 1165
============================================
+ Hits 59331 59388 +57
- Misses 102871 102874 +3
+ Partials 2156 2153 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fb51d27 to
3e1d66e
Compare
3e1d66e to
bc648d5
Compare
|
The test
Looks like we need to install go in that workflow. |
56c4e68 to
88b78ac
Compare
|
I am not able to re-enable the pipelines with unsafe triggers to run on prism.
When things are resolved, we can pick up the commit to re-enable and rebenchmark: bc648d5. |
88b78ac to
6093a72
Compare
This reverts commit bc648d5.
1e91a85 to
a62e312
Compare
|
Assigning reviewers: R: @jrmccluskey for label python. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
| func (ss *stageState) buildTriggeredBundle(em *ElementManager, key []byte, win typex.Window) int { | ||
| func (ss *stageState) buildTriggeredBundle(em *ElementManager, key string, win typex.Window) int { | ||
| var toProcess []element | ||
| dnt := ss.pendingByKeys[string(key)] |
There was a problem hiding this comment.
I'll note that Go does some magic when passing a string cast []byte as a map key inline, which avoids allocating. That's why this method took in a []byte for the key, instead of eagerly converting it.
| func() string { return rb.BundleID }, | ||
| toProcess, | ||
| ss.input, | ||
| singleSet(string(key)), |
There was a problem hiding this comment.
But this over here probably made the string(key) (when key is []byte) moot anyway.
Previously, Prism's streaming-first design checked trigger criteria for each element and triggered bundles immediately. This resulted in behavior that diverged from the Dataflow and FnApi runners in batch mode.
To address this, this PR introduces the ability to process and inject triggered bundles in batches, a behavior toggled by the
--streamingpipeline option.However, this change has surfaced issues with unsafe triggers, leading to two failing tests after re-enabling prism on pipelines with unsafe triggers.
apache_beam.transforms.trigger_test.TriggerPipelineTest testMethod=test_after_count.beam/sdks/python/apache_beam/transforms/trigger_test.py
Lines 661 to 669 in da57e58
apache_beam/examples/complete/game/leader_board_test.pyLeaderBoardTest.test_leader_board_usersbeam/sdks/python/apache_beam/examples/complete/game/leader_board_test.py
Lines 62 to 68 in da57e58
The two test failures are caused by differences in the window "closing behavior," which determines if a final pane is emitted when a window expires.
beam/model/pipeline/src/main/proto/org/apache/beam/model/pipeline/v1/beam_runner_api.proto
Lines 1210 to 1220 in da57e58
The Python SDK defaults to EMIT_ALWAYS, with a TODO to support
EMIT_IF_NONEMPTY.beam/sdks/python/apache_beam/transforms/core.py
Lines 3781 to 3782 in da57e58
This PR's changes try to align Prism's output with the Dataflow runner's behavior, and I believe the two failing tests will need to be re-benchmarked.