File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import shutil
2- import sqlite3
32import tempfile
43from pathlib import Path
54
1110
1211
1312def create_bucket_if_not_exists (bucket_id : str , private : bool | None = None ) -> None :
14- huggingface_hub .create_bucket (bucket_id , private = private or False , exist_ok = True )
13+ huggingface_hub .create_bucket (bucket_id , private = private , exist_ok = True )
1514
1615
1716def download_bucket_to_trackio_dir (bucket_id : str ) -> None :
@@ -64,14 +63,14 @@ def _local_db_has_data(project: str) -> bool:
6463 db_path = SQLiteStorage .get_project_db_path (project )
6564 if not db_path .exists () or db_path .stat ().st_size == 0 :
6665 return False
67- conn = sqlite3 .connect (str (db_path ), timeout = 5.0 )
6866 try :
69- count = conn .execute ("SELECT COUNT(*) FROM metrics" ).fetchone ()[0 ]
70- return count > 0
67+ with SQLiteStorage ._get_connection (
68+ db_path , configure_pragmas = False , row_factory = None
69+ ) as conn :
70+ count = conn .execute ("SELECT COUNT(*) FROM metrics" ).fetchone ()[0 ]
71+ return count > 0
7172 except Exception :
7273 return False
73- finally :
74- conn .close ()
7574
7675
7776def upload_project_to_bucket_for_static (project : str , bucket_id : str ) -> None :
You can’t perform that action at this time.
0 commit comments