Spaces:
Runtime error
Runtime error
da03
commited on
Commit
·
9147f8e
1
Parent(s):
93c5e4d
- online_data_generation.py +12 -0
online_data_generation.py
CHANGED
|
@@ -640,6 +640,18 @@ def main():
|
|
| 640 |
complete_sessions = [f for f in log_files if is_session_complete(f)]
|
| 641 |
logger.info(f"Found {len(complete_sessions)} complete sessions")
|
| 642 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 643 |
# Filter for sessions not yet processed
|
| 644 |
conn = sqlite3.connect(DB_FILE)
|
| 645 |
cursor = conn.cursor()
|
|
|
|
| 640 |
complete_sessions = [f for f in log_files if is_session_complete(f)]
|
| 641 |
logger.info(f"Found {len(complete_sessions)} complete sessions")
|
| 642 |
|
| 643 |
+
# Sort sessions by the numeric timestamp in the filename (session_<timestamp>_*.jsonl)
|
| 644 |
+
def _extract_ts(path):
|
| 645 |
+
"""Return int timestamp from session_<ts>_<n>.jsonl; fallback to 0 if parse fails."""
|
| 646 |
+
try:
|
| 647 |
+
basename = os.path.basename(path) # session_1750138392_3.jsonl
|
| 648 |
+
ts_part = basename.split('_')[1] # '1750138392'
|
| 649 |
+
return int(ts_part)
|
| 650 |
+
except Exception: # noqa: E722
|
| 651 |
+
return 0
|
| 652 |
+
|
| 653 |
+
complete_sessions.sort(key=_extract_ts)
|
| 654 |
+
|
| 655 |
# Filter for sessions not yet processed
|
| 656 |
conn = sqlite3.connect(DB_FILE)
|
| 657 |
cursor = conn.cursor()
|