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
630
0
Share
Japan.R 2018 LT
chengvt
December 01, 2018
Other Decks in Technology
See All in Technology
Azure PortalなどにみるWebアクセシビリティ
tomokusaba
0
250
Zero-Downtime Migration: Moving a Massive, Historic iOS App from CocoaPods to SPM and Tuist without Stopping Feature Delivery
kagemiku
0
240
AI時代に新卒採用、はじめました/junior-engineer-never-die
dmnlk
0
260
明日からドヤれる!超マニアックなAWSセキュリティTips10連発 / 10 Ultra-Niche AWS Security Tips
yuj1osm
0
400
AWS認定資格は本当に意味があるのか?
nrinetcom
PRO
0
180
プロンプトエンジニアリングを超えて:自由と統制のあいだでつくる Platform × Context Engineering
yuriemori
0
190
NOSTR, réseau social et espace de liberté décentralisé
rlifchitz
0
180
Zero Data Loss Autonomous Recovery Service サービス概要
oracle4engineer
PRO
5
14k
CloudSec JP #005 後締め ~ソフトウェアサプライチェーン攻撃から開発者のシークレットを守る~
lhazy
0
190
60分で学ぶ最新Webフロントエンド
mizdra
PRO
33
16k
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
16k
Bluesky Meetup in Tokyo vol.4 - 2023to2026
shinoharata
0
180
Featured
See All Featured
Joys of Absence: A Defence of Solitary Play
codingconduct
1
340
Balancing Empowerment & Direction
lara
5
1k
Making the Leap to Tech Lead
cromwellryan
135
9.8k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.9k
Abbi's Birthday
coloredviolet
2
6.7k
Crafting Experiences
bethany
1
110
Heart Work Chapter 1 - Part 1
lfama
PRO
5
35k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.5k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.9k
Design in an AI World
tapps
0
190
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.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をバッチで回す例を紹介した