Skip to content

Commit

Permalink
Ensure GTFS ingest (#100)
Browse files Browse the repository at this point in the history
* GTFS ingest should have a week lookback

* Run at 8am UTC instead of 7
  • Loading branch information
devinmatte authored May 15, 2024
1 parent 4701471 commit f488486
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.env.local
**/__pycache__
.python-version
.temp
.temp
feeds
15 changes: 8 additions & 7 deletions ingestor/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,6 @@ def update_delivered_trip_metrics_yesterday(event):
daily_speeds.update_daily_table(two_days_ago)


# 7am UTC -> 2/3am ET
@app.schedule(Cron(0, 7, "*", "*", "?", "*"))
def update_gtfs(event):
today = date.today()
gtfs.ingest_gtfs_feeds_to_dynamo_and_s3(date_range=(today, today))


# 7:10am UTC -> 2:10/3:10am ET every day
@app.schedule(Cron(10, 7, "*", "*", "?", "*"))
def update_ridership(event):
Expand All @@ -129,6 +122,14 @@ def update_time_predictions(event):
predictions.update_predictions()


# 8:00am UTC -> 3:00/4:00am ET every day
@app.schedule(Cron(0, 8, "*", "*", "?", "*"))
def update_gtfs(event):
today = datetime.now()
last_week = (today - timedelta(days=7)).date()
gtfs.ingest_gtfs_feeds_to_dynamo_and_s3(date_range=(last_week, today.date()))


# 4:40am UTC -> 2:40/3:40am ET every day
@app.schedule(Cron(40, 7, "*", "*", "?", "*"))
def update_trip_metrics(event):
Expand Down
2 changes: 1 addition & 1 deletion ingestor/chalicelib/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def ls(bucket, prefix):
return all_keys


def clear_cf_cache(distribution, keys):
def clear_cf_cache(distribution: str, keys: list[str]):
cloudfront.create_invalidation(
DistributionId=distribution,
InvalidationBatch={
Expand Down
4 changes: 2 additions & 2 deletions ingestor/chalicelib/trip_metrics/backfill.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

from .ingest import ingest_trip_metrics, get_date_ranges

START_DATE = date(2023, 8, 29)
END_DATE = date(2023, 8, 30)
START_DATE = date(2024, 3, 1)
END_DATE = date(2024, 5, 14)
MAX_RANGE_SIZE = 90

if __name__ == "__main__":
Expand Down

0 comments on commit f488486

Please sign in to comment.