olehborysevych commented on code in PR #29507: URL: https://github.com/apache/beam/pull/29507#discussion_r1411118848
########## learning/prompts/documentation-lookup/09_basic_triggers.md: ########## @@ -0,0 +1,30 @@ +Prompt: +What are Triggers in Apache Beam? +Response: + +Beam uses triggers to determine when to emit the aggregated results of each [window](https://beam.apache.org/documentation/programming-guide/#windowing) (referred to as a pane) + +Triggers provide two additional capabilities compared to [outputting at the end of a window](https://beam.apache.org/documentation/programming-guide/#default-trigger): allow early results to be output before the end of the window or allow late data to be handled after the end of the window + +This allows you to control the flow of your data and balance between completenes, latency and cost. + +You set the triggers for a PCollection by setting the `trigger` parameter of the WindowInto transform. + +```python + pcollection | WindowInto( + FixedWindows(1 * 60), + trigger=AfterProcessingTime(1 * 60), + accumulation_mode=AccumulationMode.DISCARDING) +``` + +When a trigger fires, it emits the current contents of the window as a pane. Since a trigger can fire multiple times, the accumulation mode determines whether the system accumulates the window panes as the trigger fires, or discards them. This behavior is controlled by the [window accumulation mode](https://beam.apache.org/documentation/programming-guide/#window-accumulation-modes) parameter of the WindowInto transform. + + +Beam provides a number of [built-in triggers](https://beam.apache.org/documentation/programming-guide/#triggers) that you can use to determine when to emit the results of your pipeline’s windowed computations: Review Comment: Done -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
