Windowing & Streaming⏱️ ~20 mins
23. Tumbling Fixed Event-Time Windowing
Enterprise Architecture Context
In production stream-processing architectures (Google Cloud Dataflow / Flink), pipeline stages must handle parallel transformations without data loss, managing schema mutations and aggregations across distributed worker workers.
Problem Statement
### Business Context
Operational metrics dashboards aggregate server HTTP requests into discrete 10-second non-overlapping tumbling time windows.
### Problem Statement
Write a function `window_ten(input_pcoll)` that assigns streaming elements into fixed event-time windows of duration **10 seconds** using `beam.WindowInto(FixedWindows(10))`.
Key Learning Objectives
- Understand distributed Apache Beam execution DAG stages and pipeline lifecycle.
- Apply idiomatic functional Python transforms using the pipe operator
|. - Ensure data consistency and idempotency across distributed stream workers.
Sample Data Fixtures
Sample Example 1
Input Stream:
[10, 20, 30]
Expected Output:
[10, 20, 30]
Sample Example 2
Input Stream:
[5]
Expected Output:
[5]
Topics:#Windowing#Streaming
solution.pyPython 3.11 (Apache Beam)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Input PCollection3 elements
| # | Element / Payload |
|---|---|
| 1 | 10 |
| 2 | 20 |
| 3 | 30 |
Expected Output PCollection3 elements
| # | Output Element |
|---|---|
| 1 | 10 |
| 2 | 20 |
| 3 | 30 |
Windowing & Streaming⏱️ ~20 mins
23. Tumbling Fixed Event-Time Windowing
Enterprise Architecture Context
In production stream-processing architectures (Google Cloud Dataflow / Flink), pipeline stages must handle parallel transformations without data loss, managing schema mutations and aggregations across distributed worker workers.
Problem Statement
### Business Context
Operational metrics dashboards aggregate server HTTP requests into discrete 10-second non-overlapping tumbling time windows.
### Problem Statement
Write a function `window_ten(input_pcoll)` that assigns streaming elements into fixed event-time windows of duration **10 seconds** using `beam.WindowInto(FixedWindows(10))`.
Key Learning Objectives
- Understand distributed Apache Beam execution DAG stages and pipeline lifecycle.
- Apply idiomatic functional Python transforms using the pipe operator
|. - Ensure data consistency and idempotency across distributed stream workers.
Sample Data Fixtures
Sample Example 1
Input Stream:
[10, 20, 30]
Expected Output:
[10, 20, 30]
Sample Example 2
Input Stream:
[5]
Expected Output:
[5]
Topics:#Windowing#Streaming