ror HF Staff commited on
Commit
949e6ab
·
1 Parent(s): 2c13445

Better error reporting for data loading

Browse files
Files changed (1) hide show
  1. data.py +9 -2
data.py CHANGED
@@ -4,6 +4,7 @@ from utils import logger
4
  import os
5
  from datetime import datetime
6
  import threading
 
7
 
8
  fs = HfFileSystem()
9
 
@@ -97,8 +98,14 @@ class CIResults:
97
  logger.info("Loading distant data...")
98
  new_df = get_distant_data()
99
  except Exception as e:
100
- logger.error(f"Loading data failed: {e}")
101
- logger.warning("Falling back on sample data.")
 
 
 
 
 
 
102
  new_df = get_sample_data()
103
  # Update attributes
104
  self.df = new_df
 
4
  import os
5
  from datetime import datetime
6
  import threading
7
+ import traceback
8
 
9
  fs = HfFileSystem()
10
 
 
98
  logger.info("Loading distant data...")
99
  new_df = get_distant_data()
100
  except Exception as e:
101
+ error_msg = [
102
+ "Loading data failed:",
103
+ "-" * 120,
104
+ traceback.format_exc(),
105
+ "-" * 120,
106
+ "Falling back on sample data."
107
+ ]
108
+ logger.error("\n".join(error_msg))
109
  new_df = get_sample_data()
110
  # Update attributes
111
  self.df = new_df