Better error reporting for data loading
Browse files
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 |
-
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|