Skip to content

Commit d1162bf

Browse files
authored
Merge branch 'main' into experiment-with-lamp-for-bus
2 parents 956315a + 3600816 commit d1162bf

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

mbta-performance/chalicelib/gtfs.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,16 @@ def fetch_stop_times_from_gtfs(
3838
raise
3939
logger.info("GTFS feed ready")
4040

41+
if not feed.exists_remotely():
42+
logger.info(f"Uploading GTFS feed {feed.key} to S3...")
43+
try:
44+
feed.upload_to_s3()
45+
except Exception as e:
46+
logger.exception(f"Failed to upload GTFS feed {feed.key} to S3: {e}")
47+
raise
48+
logger.info(f"GTFS feed {feed.key} uploaded to S3")
49+
4150
session = feed.create_sqlite_session()
42-
exists_remotely = feed.exists_remotely()
4351

4452
gtfs_stops = []
4553
num_batches = (len(trip_ids) + MAX_QUERY_DEPTH - 1) // MAX_QUERY_DEPTH
@@ -59,15 +67,6 @@ def fetch_stop_times_from_gtfs(
5967
)
6068
)
6169

62-
if not exists_remotely:
63-
logger.info(f"Uploading GTFS feed {feed.key} to S3...")
64-
try:
65-
feed.upload_to_s3()
66-
except Exception as e:
67-
logger.exception(f"Failed to upload GTFS feed {feed.key} to S3: {e}")
68-
raise
69-
logger.info(f"GTFS feed {feed.key} uploaded to S3")
70-
7170
result = pd.concat(gtfs_stops)
7271
logger.info(f"Fetched {len(result)} GTFS stop times")
7372
return result

0 commit comments

Comments
 (0)