Spaces:
Running
Running
Commit
·
35f05ef
1
Parent(s):
46a36a9
debug for backend.py
Browse files- src/backend.py +9 -14
src/backend.py
CHANGED
@@ -107,6 +107,7 @@ def get_zip_file_path(zip_file_name: str):
|
|
107 |
zip_file_path = None
|
108 |
for root, _, files in os.walk(ZIP_CACHE_DIR):
|
109 |
for file in files:
|
|
|
110 |
if file == zip_file_name:
|
111 |
zip_file_path = os.path.abspath(os.path.join(root, file))
|
112 |
break
|
@@ -183,21 +184,15 @@ def pull_search_results(
|
|
183 |
file_name = os.path.basename(metadata_file_path).split('.')[0]
|
184 |
zip_file_name = f"{file_name}.zip"
|
185 |
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
)
|
194 |
-
except Exception as e:
|
195 |
-
print("----")
|
196 |
-
print(e)
|
197 |
-
print("----")
|
198 |
-
logger.error(f"Failed to download the zip file `{zip_file_name}`: {e}")
|
199 |
-
continue
|
200 |
zip_file_path = get_zip_file_path(zip_file_name)
|
|
|
201 |
|
202 |
# try:
|
203 |
# API.snapshot_download(
|
|
|
107 |
zip_file_path = None
|
108 |
for root, _, files in os.walk(ZIP_CACHE_DIR):
|
109 |
for file in files:
|
110 |
+
print(file)
|
111 |
if file == zip_file_name:
|
112 |
zip_file_path = os.path.abspath(os.path.join(root, file))
|
113 |
break
|
|
|
184 |
file_name = os.path.basename(metadata_file_path).split('.')[0]
|
185 |
zip_file_name = f"{file_name}.zip"
|
186 |
|
187 |
+
API.snapshot_download(
|
188 |
+
repo_id=SEARCH_RESULTS_REPO,
|
189 |
+
repo_type="dataset",
|
190 |
+
local_dir=ZIP_CACHE_DIR,
|
191 |
+
etag_timeout=30,
|
192 |
+
allow_patterns=[zip_file_name]
|
193 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
zip_file_path = get_zip_file_path(zip_file_name)
|
195 |
+
assert zip_file_path is not None, f"Failed to find the zip file `{zip_file_name}`"
|
196 |
|
197 |
# try:
|
198 |
# API.snapshot_download(
|