File tree Expand file tree Collapse file tree
mbta-performance/chalicelib Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments