Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Japan.R 2018 LT
Search
chengvt
December 01, 2018
Technology
0
600
Japan.R 2018 LT
chengvt
December 01, 2018
Tweet
Share
Other Decks in Technology
See All in Technology
AI駆動で進める依存ライブラリ更新 ─ Vue プロジェクトの品質向上と開発スピード改善の実践録
sayn0
1
290
頭部ふわふわ浄酔器
uyupun
0
110
ゼロコード計装導入後のカスタム計装でさらに可観測性を高めよう
sansantech
PRO
1
330
デザインとエンジニアリングの架け橋を目指す OPTiMのデザインシステム「nucleus」の軌跡と広げ方
optim
0
110
AI時代の開発を加速する組織づくり - ブログでは書けなかったリアル
hiro8ma
1
310
「最速」で Gemini CLI を使いこなそう! 〜Cloud Shell/Cloud Run の活用〜 / The Fastest Way to Master the Gemini CLI — with Cloud Shell and Cloud Run
aoto
PRO
1
170
[VPoE Global Summit] サービスレベル目標による信頼性への投資最適化
satos
0
240
NLPコロキウム20251022_超効率化への挑戦: LLM 1bit量子化のロードマップ
yumaichikawa
2
430
What's new in OpenShift 4.20
redhatlivestreaming
0
220
Okta Identity Governanceで実現する最小権限の原則 / Implementing the Principle of Least Privilege with Okta Identity Governance
tatsumin39
0
170
コンパウンド組織のCRE #cre_meetup
layerx
PRO
1
260
Wasmの気になる最新情報
askua
0
190
Featured
See All Featured
Writing Fast Ruby
sferik
630
62k
Context Engineering - Making Every Token Count
addyosmani
8
300
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
23
1.5k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.5k
Bash Introduction
62gerente
615
210k
Making Projects Easy
brettharned
120
6.4k
Building a Modern Day E-commerce SEO Strategy
aleyda
44
7.8k
Building Adaptive Systems
keathley
44
2.8k
Rails Girls Zürich Keynote
gr2m
95
14k
Become a Pro
speakerdeck
PRO
29
5.6k
Intergalactic Javascript Robots from Outer Space
tanoku
272
27k
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をバッチで回す例を紹介した