anumaurya114exp commited on
Commit
1fcd9e2
·
1 Parent(s): 68a4e98

bug fixes

Browse files
Files changed (1) hide show
  1. persistStorage.py +7 -7
persistStorage.py CHANGED
@@ -19,7 +19,7 @@ fs = HfFileSystem(token=HUGGING_FACE_TOKEN)
19
  def append_dict_to_csv(file_path, row_data):
20
  fieldnames = row_data.keys()
21
 
22
- with fs.open(file_path, 'a+', newline='\n') as csv_file:
23
  csv_writer = csv.DictWriter(csv_file, fieldnames=fieldnames)
24
 
25
  # Check if the file is empty, and if so, write the header
@@ -28,9 +28,9 @@ def append_dict_to_csv(file_path, row_data):
28
  csv_writer.writerow(row_data)
29
 
30
  def saveLog(message, level='info') -> None:
31
- with scheduler.lock:
32
- current_time = datetime.now(TIMEZONE_OBJ)
33
- message = str(message)
34
- JSON_DATASET_PATH = os.path.join(LOGS_DIR, f"{current_time.strftime('%Y-%m')}.csv")
35
- data_dict = {"time":str(currrent_time), "level": level, "message": message}
36
- append_dict_to_csv(JSON_DATASET_PATH, data_dict)
 
19
  def append_dict_to_csv(file_path, row_data):
20
  fieldnames = row_data.keys()
21
 
22
+ with fs.open(file_path, 'a+') as csv_file:
23
  csv_writer = csv.DictWriter(csv_file, fieldnames=fieldnames)
24
 
25
  # Check if the file is empty, and if so, write the header
 
28
  csv_writer.writerow(row_data)
29
 
30
  def saveLog(message, level='info') -> None:
31
+ current_time = datetime.now(TIMEZONE_OBJ)
32
+ message = str(message)
33
+ log_path = 'spaces/Express-Analytics/QueryHelper/'
34
+ log_file_path = os.path.join(log_path, f"{current_time.strftime('%Y-%m')}.csv")
35
+ data_dict = {"time":str(currrent_time), "level": level, "message": message}
36
+ append_dict_to_csv(log_file_path, data_dict)