@@ -61,7 +61,7 @@ def _load_json(self, file_name: str) -> Tuple[List[Dict], storage.Blob]:
6161 )
6262 except Exception as e :
6363 logging .warning (
64- f "Unable to convert data to DataFrame using Pandas: { e } "
64+ "Unable to convert data to DataFrame using Pandas: %s" , e
6565 )
6666 return json .loads (json_data ), blob
6767 return [], blob
@@ -72,13 +72,13 @@ def _save_blob(blob: storage.Blob, data: List[Dict]) -> None:
7272 # Convert the data to JSON format
7373 json_data = pd .DataFrame (data ).to_json (orient = "records" , date_format = "iso" )
7474 except Exception as e :
75- logging .warning (f "Unable to convert data to JSON using Pandas: { e } " )
75+ logging .warning ("Unable to convert data to JSON using Pandas: %s" , e )
7676 json_data = json .dumps (data , default = str )
7777
7878 # Save the JSON file to the specified GCS bucket
7979 blob .upload_from_string (json_data , content_type = "application/json" )
8080 blob .make_public ()
81- logging .info (f" { blob . name } saved to bucket" )
81+ logging .info ("%s saved to bucket", blob . name )
8282
8383 def _save_json (self , file_name : str , data : List [Dict ]) -> None :
8484 # Save the JSON file to the specified GCS bucket
@@ -90,7 +90,7 @@ def aggregate_summary_files(
9090 ) -> None :
9191 blobs = self .analytics_bucket .list_blobs (prefix = "summary/summary_" )
9292 for blob in blobs :
93- logging .info (f "Aggregating data from { blob .name } " )
93+ logging .info ("Aggregating data from %s" , blob .name )
9494 summary_data , _ = self ._load_json (blob .name )
9595 for key , new_data in summary_data .items ():
9696 if key in metrics_file_data :
@@ -129,7 +129,7 @@ def save_analytics(self) -> None:
129129 file_name = f"analytics_{ self .run_date .strftime ('%Y-%m-%d' )} .json"
130130 self ._save_json (file_name , self .data )
131131 self .save ()
132- logging .info (f "Analytics saved to bucket as { file_name } " )
132+ logging .info ("Analytics saved to bucket as %s" , file_name )
133133
134134 @with_db_session
135135 def run (self , db_session : Session ) -> None :
@@ -139,16 +139,16 @@ def run(self, db_session: Session) -> None:
139139 self .save_summary ()
140140 self .save_analytics ()
141141 self .update_analytics_files ()
142- logging .info (f "Finished running analytics for date: { self .run_date } " )
142+ logging .info ("Finished running analytics for date: %s" , self .run_date )
143143
144144 def _get_data (self , db_session : Session ):
145145 query = self .get_latest_data (db_session )
146146 all_results = query .all ()
147147 if len (all_results ) == 0 :
148148 raise NoFeedDataException ("No feed data found" )
149- logging .info (f "Loaded { len ( all_results ) } feeds to process" )
149+ logging .info ("Loaded %s feeds to process" , len ( all_results ) )
150150 unique_feeds = {result [0 ].stable_id : result for result in all_results }
151- logging .info (f "Nb of unique feeds loaded: { len (unique_feeds )} " )
151+ logging .info ("Nb of unique feeds loaded: %s" , len (unique_feeds ))
152152 return [(result [0 ], result [1 ]) for result in unique_feeds .values ()]
153153
154154 def update_analytics_files (self ) -> None :
@@ -189,4 +189,4 @@ def update_analytics_files(self) -> None:
189189 )
190190
191191 except Exception as e :
192- logging .error (f "Error updating analytics files: { e } " )
192+ logging .error ("Error updating analytics files: %s" , e )
0 commit comments