Remove previous attempt at adding folders, as it doesn't work :( also, remove dataset name from exceptions
Browse files- src/submission_uploader.py +5 -13
src/submission_uploader.py
CHANGED
|
@@ -90,9 +90,6 @@ class SubmissionUploader:
|
|
| 90 |
with open(os.path.join(temp_directory, "request_metadata.json"), "w") as f:
|
| 91 |
json.dump(request_metadata, f)
|
| 92 |
|
| 93 |
-
if task_id not in self._fs.ls(f"datasets/{self._private_dataset_id}"):
|
| 94 |
-
self._fs.makedirs(f"datasets/{self._private_dataset_id}/{task_id}", exist_ok=True)
|
| 95 |
-
|
| 96 |
num_requests_already_present = len(self._fs.ls(f"datasets/{self._private_dataset_id}/{task_id}/"))
|
| 97 |
commit_operations = [
|
| 98 |
CommitOperationAdd(
|
|
@@ -239,14 +236,6 @@ class SubmissionUploader:
|
|
| 239 |
|
| 240 |
task_id = TASKS_PRETTY_REVERSE[task_pretty]
|
| 241 |
|
| 242 |
-
if (
|
| 243 |
-
task_id not in self._fs.ls(f"datasets/{self._dataset_id}")
|
| 244 |
-
or "predictions" not in self._fs.ls(f"datasets/{self._dataset_id}/{task_id}")
|
| 245 |
-
or "results" not in self._fs.ls(f"datasets/{self._dataset_id}/{task_id}")
|
| 246 |
-
):
|
| 247 |
-
self._fs.makedirs(f"datasets/{self._dataset_id}/{task_id}/predictions", exist_ok=True)
|
| 248 |
-
self._fs.makedirs(f"datasets/{self._dataset_id}/{task_id}/results", exist_ok=True)
|
| 249 |
-
|
| 250 |
logging.info("Checking if this request has already been submitted...")
|
| 251 |
if not force:
|
| 252 |
if model_folder in self._fs.ls(f"datasets/{self._dataset_id}/{task_id}/predictions"):
|
|
@@ -319,6 +308,9 @@ class SubmissionUploader:
|
|
| 319 |
|
| 320 |
except Exception as e:
|
| 321 |
logging.exception(e)
|
| 322 |
-
|
| 323 |
-
|
|
|
|
|
|
|
|
|
|
| 324 |
return styled_error("An exception occurred. Please, try again.")
|
|
|
|
| 90 |
with open(os.path.join(temp_directory, "request_metadata.json"), "w") as f:
|
| 91 |
json.dump(request_metadata, f)
|
| 92 |
|
|
|
|
|
|
|
|
|
|
| 93 |
num_requests_already_present = len(self._fs.ls(f"datasets/{self._private_dataset_id}/{task_id}/"))
|
| 94 |
commit_operations = [
|
| 95 |
CommitOperationAdd(
|
|
|
|
| 236 |
|
| 237 |
task_id = TASKS_PRETTY_REVERSE[task_pretty]
|
| 238 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 239 |
logging.info("Checking if this request has already been submitted...")
|
| 240 |
if not force:
|
| 241 |
if model_folder in self._fs.ls(f"datasets/{self._dataset_id}/{task_id}/predictions"):
|
|
|
|
| 308 |
|
| 309 |
except Exception as e:
|
| 310 |
logging.exception(e)
|
| 311 |
+
exception_msg = str(e)
|
| 312 |
+
if exception_msg and os.environ["PRIVATE_DATASET_ID"] in exception_msg:
|
| 313 |
+
exception_msg = exception_msg.replace(os.environ["PRIVATE_DATASET_ID"], "{private_dataset}")
|
| 314 |
+
if exception_msg:
|
| 315 |
+
return styled_error(exception_msg)
|
| 316 |
return styled_error("An exception occurred. Please, try again.")
|