Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn off redundant full scrapes on Friday night #48

Merged
merged 5 commits into from
Apr 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions scripts/la-metro-crontask
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
APPDIR=/home/datamade/scrapers-us-municipal
PUPADIR=/home/datamade/.virtualenvs/opencivicdata/bin/pupa

# --- NIGHTLY ---
# --- SUNDAY THROUGH THURSDAY & SATURDAY ---

# UTC: 12:05 am
# CST: 6:05 pm
# CDT: 7:05 pm

# Full scrape

5 0 * * * datamade /usr/bin/flock /tmp/metrobills.lock /usr/bin/flock /tmp/metroevents.lock $APPDIR/scripts/lametro/full-scrape.sh >> /tmp/lametro.log
5 0 * * 0-4,6 datamade /usr/bin/flock /tmp/metrobills.lock /usr/bin/flock /tmp/metroevents.lock $APPDIR/scripts/lametro/full-scrape.sh >> /tmp/lametro.log

# --- SUNDAY THROUGH THURSDAY ---

Expand Down Expand Up @@ -49,6 +49,14 @@ PUPADIR=/home/datamade/.virtualenvs/opencivicdata/bin/pupa
30,45 0-5 * * 6 datamade /usr/bin/flock -n /tmp/metroevents.lock -c "WINDOW=1 $APPDIR/scripts/lametro/windowed-event-scrape.sh" >> /tmp/lametro.log
35,50 0-5 * * 6 datamade /usr/bin/flock -n /tmp/metrobills.lock -c "WINDOW=1 $APPDIR/scripts/lametro/windowed-bill-scrape.sh" >> /tmp/lametro.log

# UTC: 12:05 am
# CST: 6:05 pm
# CDT: 7:05 pm

# Person scrape, in lieu of nightly full scrape

5 0 * * 5 datamade $APPDIR/scripts/lametro/person-scrape.sh >> /tmp/lametro.log

# --- SATURDAY ---

# UTC: 6:00 am to 11:50 pm Saturday
Expand Down
10 changes: 10 additions & 0 deletions scripts/lametro/person-scrape.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -e

exec 2>&1

cd $APPDIR
$PUPADIR update --datadir=/cache/people/_data/ lametro --scrape people
SHARED_DB=True DATABASE_URL=postgis://datamade@3.93.9.229/lametro $PUPADIR update --datadir=/cache/people/_data/ lametro --import people
SHARED_DB=True DATABASE_URL=postgis://datamade@3.93.9.229/lametro_staging $PUPADIR update --datadir=/cache/people/_data/ lametro --import people
$PUPADIR update --datadir=/cache/people/_data/ lametro --import people