Getting started with Python and Apache Flink

Apache Flink built on top of the distributed streaming dataflow architecture, which helps to crunch massive velocity and volume data sets. With version 1.0 it provided python API, learn how to write a simple Flink application in python.

After my last post about the breadth of big-data / machine learning projects currently in Apache, I decided to experiment with some of the bigger ones. This post serves as a minimal guide to getting started using the brand-brand new python API into Apache Flink. Flink is a very similar project to Spark at the high level, but underneath it is a true streaming platform (as opposed to Spark’s small and fast batch approach to streaming). This gives rise to a number of interesting use cases where massive velocity and volume of data needs to be processed quickly and in complex ways.

The basic idea is a code streaming platform upon which sits two processing APIs and a collection of libraries.

Fig. 1 The Flink architecture.

With version 1.0 of Flink, a python API will be available, again, similarly to Spark. While it is present in pre-1.0 releases, there are known bugs present that make its use difficult or impossible. So to start with, we need to build the master branch (unless you are reading this since the v1.0 release, if that’s the case just follow Flink’s instructions to build).

git clone https://github.com/apache/flink

cd flink
mvn clean install -DskipTests

At this point the bleeding edge Flink build will be symlinked at build-target in the flink directory. You can start up Flink with the commands.

And there you go, totally minimal example to get up and running with python in Apache Flink. The code is up here: https://github.com/wdm0006/flink-python-examples, and I will add in more advanced examples both in the repo and explained here as we move along.

Bio: Will McGinnis, @WillMcGinnis, has degrees in Mechanical Engineering from Auburn, but mostly writes software now. He was the first employee at Predikto, and currently helps build out the premiere platform for predictive maintenance in heavy industry there. When not working on that, he is generally working on something related to python, flask, scikit-learn or cycling.