Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
The Final Crontab
Selena Deckelmann
May 06, 2014
Technology
3
7.4k
The Final Crontab
About crontabber:
https://github.com/mozilla/crontabber
Selena Deckelmann
May 06, 2014
Tweet
Share
More Decks by Selena Deckelmann
See All by Selena Deckelmann
Our privacy and the web
selenamarie
0
310
Postgres: an intro for new developers
selenamarie
0
100
Alembic and SQLAlchemy: sane schema management
selenamarie
0
160
code4lib - What beginners teach us
selenamarie
0
870
What beginners teach us - New Relic FutureTalk
selenamarie
0
170
Cost of 100% processing and crashstorage options for Socorro
selenamarie
0
87
Socorro, crash-stats.mozilla.com and Postgres
selenamarie
0
250
What beginners teach us - Passion Projects
selenamarie
6
1.8k
Sane Schema Management with Alembic
selenamarie
2
1.2k
Other Decks in Technology
See All in Technology
スクラムのスケールとチームトポロジー / Scaled Scrum and Team Topologies
daiksy
1
460
現状のFedCMの動作解説と OIDCとの親和性について- OpenID TechNight vol.19
ritou
2
460
The Fractal Geometry of Software Design
vladikk
1
1.3k
Camp Digital 2022: tailored advice
kyliehavelock
0
150
データエンジニアと作るデータ文化
yuki_saito
4
1.7k
UIKitのアップデート #WWDC22
akatsuki174
4
350
【配布資料】複数データソースのデータを仮想化してまとめて分析してみよう(AWS、IBM Cloud)
tkhresk
0
100
Oracle Cloud Infrastructure:2022年6月度サービス・アップデート
oracle4engineer
PRO
0
170
プログラマがオブジェクト指向しても幸せになれない理由
shirayanagiryuji
0
160
データ分析で切り拓け! エンジニアとしてのデータ分析職キャリア戦略
ksnt
0
180
ドメイン知識の蓄積が開発に起こす100のこと
codmoninc
0
110
MRTK3 - DataBinding and Theming 入門
futo23
0
200
Featured
See All Featured
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
315
19k
The Mythical Team-Month
searls
209
39k
Git: the NoSQL Database
bkeepers
PRO
415
59k
Scaling GitHub
holman
451
140k
Fontdeck: Realign not Redesign
paulrobertlloyd
73
4.1k
What's new in Ruby 2.0
geeforr
336
30k
The Language of Interfaces
destraynor
148
20k
Statistics for Hackers
jakevdp
781
210k
A Modern Web Designer's Workflow
chriscoyier
689
180k
Raft: Consensus for Rubyists
vanstee
126
5.5k
Thoughts on Productivity
jonyablonski
43
2.3k
Art, The Web, and Tiny UX
lynnandtonic
280
17k
Transcript
The Final Crontab Selena Deckelmann Data Architect, Mozilla @selenamarie http://chesnok.com/
crontabber
None
None
socorro1 socorro3 WAL Socorro1 .dev Socorro1. stage base_backup copy Sunday
noon PT streaming rep Prod socorro2 backup4 base_backup & pg_dump backup reporting1 WAL socorro-db-zeus-rw socorro-db-zeus-ro very architecture very architecture such replicas such replicas wow wow
None
None
None
None
None
Tons more at: http://lqbs.fr/suchcomments/
None
http://github.com/mozilla/socorro
http://bit.ly/1fOgBSB
*/5 * * * * socorro crontabber.sh
image by @CoryLoftis
Motivating factors
#ThreeWordHorrorStories
No unit tests
No unit tests
Bespoke shell scripts
Postgres stored procedures
Email from cron
0 5000 10000 15000 20000 25000 Dec 5, 2010 May
5, 2011 Oct 5, 2011 Mar 5, 2012 Aug 5, 2012 Jan 5, 2013 Jun 5, 2013 Nov 5, 2013 Apr 5, 2014 Cron alert messages
None
Email from cron that you need to read.
None
Cron, what is it good for? • birthday reminders •
status updates for a website • doxygen output for manuals every 12 hours • email nags about bugs filed wrong • ETL • Postgres -> Cloudwatch • Batch processing • Backups of RO DB • Machine heartbeat • “sweet fuck all” • “auto” updates • logging laptop IP • check for abandoned twitter accounts
Running jobs on a predictable schedule
How Socorro uses cron • Time-dependent reports or maintenance •
“Simple” event detection and triggers • Status logging
Our use cases • Stored procedures for materialized views in
Postgres • Daily map-reduces (largely deprecated) • FTP Scraping into Postgres • Bulk email responses to crash submissions pulled from Elastic Search
Jobs that don’t lend themselves to queue management because of
time-dependencies, fragility or complexity.
crontabber https://github.com/mozilla/crontabber
On Github: Peter Bengtsson @peterbe & Lars Lohn @twobraids
pip install crontabber
Our crontabber jobs
None
None
None
None
configman https://github.com/mozilla/configman
Our config https://github.com/mozilla/socorro/blob/ master/config/crontabber.ini-dist
None
No more shell scripts
#!/bin/bash . /etc/socorro/socorrorc NAME=`basename $0 .sh` lock --ignore-existing $NAME ${PYTHON}
${APPDIR}/socorro/cron/crontabber.py \ --admin.conf=/etc/socorro/crontabber.ini \ >> /var/log/socorro/crontabber.log 2>&1 EXIT_CODE=$? unlock $NAME exit $EXIT_CODE
Retries on failure
Waits to run if a dependency fails
Nagios alerts
15:58 < nagios-phx1> | Sun 15:58:44 PDT [1085] socorroadm.stage.private.phx1.mozilla.com: Socorro
Admin - crontab is CRITICAL: CRITICAL - correlations-addon-matview (CorrelationsAddonCronApp) (http://m.mozilla.org/Socorro+Admin+-+crontab)
Allow configurable number of failures before CRITICAL
Unit test framework for all jobs
Documented dependencies
None
None
Config can get hairy
One-off runs aren’t simple
Parallel execution coming soon! or...
*/5 * * * * socorro crontabber \ --admin.conf=/etc/crontabber1.ini */5
* * * * socorro crontabber \ --admin.conf=/etc/crontabber2.ini */5 * * * * socorro crontabber \ --admin.conf=/etc/crontabber3.ini
crontabber as a module is running in our stage environment
Dependencies • Python 2.6 or higher • Postgres 9.2 or
higher •
https://github.com/mozilla/crontabber Ping us in #breakpad on irc.mozilla.org Tune in: Tuesday
June 10th at 7pm PDT at air.mozilla.com!
The Final Crontab Selena Deckelmann Data Architect, Mozilla @selenamarie http://chesnok.com/