Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Japan.R 2018 LT
chengvt
December 01, 2018
Technology
0
320
Japan.R 2018 LT
chengvt
December 01, 2018
Tweet
Share
Other Decks in Technology
See All in Technology
データチームの境界を考える
yummydum
0
170
#JP_Stripes Sapporo Stripeの活用例を色々ご紹介します!
miu_crescent
0
100
ひとりでも安定して 組織を変える活動を続けていくための ストレスマネジメント
pastelinc
0
770
ログ基盤をCloudWatchLogからNewRelic Logs + S3に変えたら 利便性も上がってコストも下がった話
onohiroshi1
0
170
Build 2022で発表されたWindowsアプリ開発のあれこれ振り返ろう
hatsunea
1
360
JUnit5.7, 5.8の新機能紹介 #jjug_ccc #jjug_ccc_b / junit 5.7, 5.8 new features
kyonmm
PRO
2
400
セキュリティ 開運研修2022 / security 2022
cybozuinsideout
PRO
2
3.3k
History of the ML system in KARTE
kargo113
0
560
IoTLT88-NTKanazawa-laundry-dry
yukima0707
0
200
Target SDK Versionを上げない Notification runtime permission対応
napplecomputer
0
120
1人目QAエンジニアよもやま話 / QA Test Talk Vol.1
nametake
4
220
ウォーターフォールとアジャイルと楽楽明細/Waterfall×Agile×Rakurakumeisai
whitefox_73
1
350
Featured
See All Featured
Web development in the modern age
philhawksworth
197
9.3k
JazzCon 2018 Closing Keynote - Leadership for the Reluctant Leader
reverentgeek
172
8.4k
Build The Right Thing And Hit Your Dates
maggiecrowley
19
1.2k
Principles of Awesome APIs and How to Build Them.
keavy
113
15k
Building Your Own Lightsaber
phodgson
94
4.6k
What’s in a name? Adding method to the madness
productmarketing
11
1.6k
Navigating Team Friction
lara
175
11k
Raft: Consensus for Rubyists
vanstee
126
5.4k
Building Applications with DynamoDB
mza
83
4.7k
Designing with Data
zakiwarfel
91
3.9k
How to name files
jennybc
40
60k
Building Adaptive Systems
keathley
25
1.1k
Transcript
でRをバッチで回す Japan.R 2018 LT 2018.12.01 @chengvt り
自己紹介 nickname: チェン job: メディア系会社で二年目のアナリスト hobby:登山 R package: chengvt/MovingBubbles
Motivation • アドホック分析用データ作成+モデルを周期的に回すため、定型処理 をバッチ化したくなる • 手元のサーバで以前cron使いましたが、digdagというワークフロー エンジンに乗り換えました • 本日はdigdagでR処理を回す例を紹介
デモ やりたいこと 今年8月に生まれたパンダちゃんの 最新体重の推移を知りたい (名前投票受付中らしい)
パンダちゃんの体重はツイッター で毎日公開されています @aws_official
Rスクリプトを用意する • get_panda.R – twitterから最新情報を取得し、ファイルに保存 • plot_panda.R – 体重推移をプロットし、ファイルに保存
定形処理をバッチ化 で楽な作業に! スクリプトがあっても定期的 に実行するのは大変
digdagをサーバにインストール 詳細:https://www.digdag.io/
digファイルを書く 日本時間を使ってね 毎日17時に回してね これらのRスクリプト回 してね
ワークフローの登録 * セークレット利用やもっとカスタマイズする場合はdigdag schedulerではなくて、digdag server + digdag pushが良さそう * 「nohup
コマンド &」で端末を閉じてもログアウトしても処理を続ける digdag scheduler -n 1234 -b 127.0.0.1 Runs a workflow scheduler that runs schedules periodically. This picks up all workflow definition files named with .dig suffix at the current directory. ポート アドレス ワーキングフォルダー で実行して完了
UIがあって、Webブラウザで見れるよ 設定したアドレスとポートでアクセス 例: http://127.0.0.0:1234
便利なプラグインもあるよ • digdag-slack https://github.com/szyn/digdag-slack
まとめ • digdagでRをバッチで回す例を紹介した