Task 20 – Implementing SportTrackerMotivation in the Python SDK
The last task we will implement in this chapter is a well-known task that we have used multiple times in Chapter 4, Structuring Code for Reusability – for example, in Task 11. First, let's restate the problem definition.
Problem definition
Calculate two per-user running averages over the stream of artificial GPS coordinates that were generated for Task 5. One computation will be the average pace over a longer (5-minute) interval, while the other will be over a shorter (1-minute) interval. Every minute, for each user, output information will be provided about whether the user's current 1-minute pace is over or under the longer average if the short average differs by more than 10%.
We implemented this task in several versions while using a playground to demonstrate various aspects of the Java SDK. In this case, we will implement only one version and use the CoGroupByKey
transform to join...