AMP Campをひと通りさらってみる:第1回 IntroductionとGetting Started

AMP Campとは?

AMP CampはBerkeleyのAMP Labによるオープンソースのデータ解析用テクノロジースタックであるBDAS (the Berkeley Data Analytics Stack)のBoot Campみたいです。年1回開催されるようで、すでに2014年開催で5回目のようです。ハンズオンなんかが充実しているのでひと通りさらってみました。

IntroductionとGetting Started

Camp概要と準備

AMP Campの概要です。ざざっと雰囲気が分かりますが、Sparkのエコシステムがひと通りさらえるようです。で、PrerequisitesのAssumptionに"You have experience using the core Spark APIs"とかあって、BootCampのくせに経験者対象かよ、という感じですが、その下にIntroduction to the Scala Shellがありますので、まずはこちらからやりましょう。

SparkはScala/JavaもしくはPythonのインターフェースを備えていますが、Scalaがわかっていた方が何かと便利なはずです。楽せずScalaを見てみます。 順番は前後しますが直前のエントリにて触ってみた話を載せていますので参考までに。

Scala面白いのでもう少し色々と勉強したくなりますが、ぐっとこらえてそのまま進みます。で、読み進めるとGetting Startedをフォローしておけよ、ということで、見てみると、どうやら参加者には必要なソフトウェアやデータ一式が入ったUSBが渡されるようです。Getting Startedのページから一式を取得できるのでゲットしておきます。

下記はremote参加者用のダウンロードURLです。 * software一式 * データ一式

SimpleAppのビルド

software一式はAMPCAMPとか適当な名前のディレクトリを掘って全てそこに入れるようにします。 そして、sbtでビルドします。

$ ../sbt/sbt package
Getting org.scala-sbt sbt 0.13.5 ...
:: retrieving :: org.scala-sbt#boot-app
    confs: [default]
    44 artifacts copied, 0 already retrieved (13482kB/521ms)
Getting Scala 2.10.4 (for sbt)...
:: retrieving :: org.scala-sbt#boot-scala
    confs: [default]
    5 artifacts copied, 0 already retrieved (24459kB/142ms)
[info] Set current project to Simple Project (in build file:/Users/norihiro_shimoda/Work/study/spark/AMPCAMP/simple-app/)
[info] Updating {file:/Users/norihiro_shimoda/Work/study/spark/AMPCAMP/simple-app/}simple-app...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 1 Scala source to /Users/norihiro_shimoda/Work/study/spark/AMPCAMP/simple-app/target/scala-2.10/classes...
[info] Packaging /Users/norihiro_shimoda/Work/study/spark/AMPCAMP/simple-app/target/scala-2.10/simple-project_2.10-1.0.jar ...
[info] Done packaging.
[success] Total time: 10 s, completed 2014/12/31 23:35:42

successということで成功ですね。ビルドしたものを実行します。

$ ../spark/bin/spark-submit --class "SimpleApp" --master local target/scala-2.10/simple-project_2.10-1.0.jar 
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
14/12/31 23:36:35 INFO SecurityManager: Changing view acls to: norihiro_shimoda,
14/12/31 23:36:35 INFO SecurityManager: Changing modify acls to: norihiro_shimoda,
14/12/31 23:36:35 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(norihiro_shimoda, ); users with modify permissions: Set(norihiro_shimoda, )
14/12/31 23:36:36 INFO Slf4jLogger: Slf4jLogger started
14/12/31 23:36:36 INFO Remoting: Starting remoting
14/12/31 23:36:36 INFO Remoting: Remoting started; listening on addresses :[akka.tcp://sparkDriver@192.168.0.6:60528]
...<中略>...
14/12/31 23:36:38 INFO TaskSetManager: Finished task 1.0 in stage 1.0 (TID 3) in 11 ms on localhost (2/2)
14/12/31 23:36:38 INFO DAGScheduler: Stage 1 (count at SimpleApp.scala:13) finished in 0.023 s
14/12/31 23:36:38 INFO TaskSchedulerImpl: Removed TaskSet 1.0, whose tasks have all completed, from pool 
14/12/31 23:36:38 INFO SparkContext: Job finished: count at SimpleApp.scala:13, took 0.044037 s
Lines with a: 83, Lines with b: 38

という感じで出力されます。何やってるんだろうということでAMPCAMP/simple-app/src/main/scala/SimpleApp.scalaを見てみると、sparkのREADME.mdからaとbを含む行をカウントしているのが分かります。シンプルですね。

という感じでgetting startedは完了です。

動画

  • 初回に流れるAMP Labの活動やSpark ecosystemの最近の同行についての動画
    • 英語苦手な人でも最新のSpark事情が分かり、見ておいて損はない動画だと思います。
    • 自分も得意ではないですが、十分理解できる内容でした。


AMP Camp 5: Intro &amp; Overview - Michael Franklin ...