Skip to content

Commit

Permalink
Upload feed to s3 when not present (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
devinmatte authored Sep 13, 2024
1 parent 413644e commit 714ce29
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mbta-performance/chalicelib/gtfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def fetch_stop_times_from_gtfs(trip_ids: Iterable[str], service_date: date) -> p
feed = mbta_gtfs.get_feed_for_date(service_date)
feed.download_or_build()
session = feed.create_sqlite_session()
exists_remotely = feed.exists_remotely()

gtfs_stops = []
for start in range(0, len(trip_ids), MAX_QUERY_DEPTH):
Expand All @@ -38,4 +39,8 @@ def fetch_stop_times_from_gtfs(trip_ids: Iterable[str], service_date: date) -> p
dtype={"direction_id": "int16"},
)
)

if not exists_remotely:
print(f"[{feed.key}] Uploading GTFS feed to S3")
feed.upload_to_s3()
return pd.concat(gtfs_stops)

0 comments on commit 714ce29

Please sign in to comment.