MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / benchmark_reset

Function benchmark_reset

scripts/clear_database.py:258–284  ·  view source on GitHub ↗

Clear benchmark state while preserving the fixed paper collection.

(
    db_path: Path = DB_PATH,
    roles_path: Path = ROLES_FILE,
    backup_dir: Path = BACKUP_DIR,
    roles: Optional[Iterable[str]] = None,
)

Source from the content-addressed store, hash-verified

256
257
258def benchmark_reset(
259 db_path: Path = DB_PATH,
260 roles_path: Path = ROLES_FILE,
261 backup_dir: Path = BACKUP_DIR,
262 roles: Optional[Iterable[str]] = None,
263) -> Dict[str, Any]:
264 """Clear benchmark state while preserving the fixed paper collection."""
265 backup_path = backup_database(db_path=db_path, backup_dir=backup_dir)
266 roles_meta = load_roles_meta(roles_path=roles_path)
267
268 conn = get_connection(db_path=db_path)
269 try:
270 before_counts = get_table_counts(conn)
271 clear_tables(conn, ("behavior_logs", "task_status"))
272 seeded_profiles = reset_user_profiles(conn, roles_meta, roles=roles)
273 reset_sqlite_sequences(conn, ("profiles", "behavior_logs", "task_status"))
274 conn.commit()
275 after_counts = get_table_counts(conn)
276 finally:
277 conn.close()
278
279 return {
280 "backup_path": str(backup_path),
281 "before_counts": before_counts,
282 "after_counts": after_counts,
283 "seeded_profiles": seeded_profiles,
284 }
285
286
287def parse_args() -> argparse.Namespace:

Callers 1

mainFunction · 0.85

Calls 8

backup_databaseFunction · 0.85
get_table_countsFunction · 0.85
clear_tablesFunction · 0.85
reset_user_profilesFunction · 0.85
reset_sqlite_sequencesFunction · 0.85
load_roles_metaFunction · 0.70
get_connectionFunction · 0.70
closeMethod · 0.45

Tested by

no test coverage detected