Apache Beamノートブックからパイプラインを作ってみました。単純にGCSからファイルを取得し文字数を計算するパイプラインとなります。所感としてはとっても使いやすかったです。JavaだとEclipseを使うことになりますが、データの収集からデバッグまでノートブック上で作れるのは非常に簡単でした。単純にEclipseを使い慣れてないせいもありますが、、ここまで手軽に使えるなら分析用途でも流行りそうですね。Pythonベースなのでパフォーマンスさえ問題にならなければ、既存のJavaベースのものからPythonに変えたいですねー。
import apache_beam as beam from apache_beam.runners.interactive.interactive_runner import InteractiveRunner import apache_beam.runners.interactive.interactive_beam as ib from apache_beam.options import pipeline_options from apache_beam.options.pipeline_options import GoogleCloudOptions import google.auth ib.options.recording_duration = '10m' # Set the recording size limit to 1 GB. ib.options.recording_size_limit = 1e9 options = pipeline_options.PipelineOptions() # Set the pipeline mode to stream the data from Pub/Sub. options.view_as(pipeline_options.StandardOptions).streaming = True p = beam.Pipeline(InteractiveRunner(), options=options) words = p | "read" >> beam.io.ReadFromText('gs://dataflow-samples/shakespeare/kinglear.txt') words_counts = (words | "count" >>beam.combiners.Count.PerElement()) ib.show(words_counts, include_window_info=True)