Skip to content

Commit 48ba5d1

Browse files
author
Johannes Hötter
committed
re-arrange prints
1 parent 1cf0181 commit 48ba5d1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

refinery/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ def __monitor_task(self, upload_task_id: str) -> None:
236236
do_monitoring = True
237237
idx = 0
238238
last_progress = 0.0
239+
print_success_message = False
239240
with tqdm(
240241
total=100.00,
241242
colour="green",
@@ -252,16 +253,17 @@ def __monitor_task(self, upload_task_id: str) -> None:
252253
pbar.update(progress)
253254
pbar.set_description_str(desc=task_state, refresh=True)
254255
if task_state == "DONE" or task_state == "FAILED":
255-
if task_state == "DONE":
256-
msg.good("Upload successful.")
257-
else:
258-
msg.fail("Upload failed. Please look into the UI notification center for more details.")
256+
print_success_message = task_state == "DONE"
259257
do_monitoring = False
260258
if idx >= 100:
261259
raise exceptions.FileImportError(
262260
"Timeout while upload, please check the upload progress in the UI."
263261
)
264262
time.sleep(0.5)
263+
if print_success_message:
264+
msg.good("File upload successful.")
265+
else:
266+
msg.fail("Upload failed. Please look into the UI notification center for more details.")
265267

266268
def __get_task(self, upload_task_id: str) -> Dict[str, Any]:
267269
api_response = api_calls.get_request(

0 commit comments

Comments
 (0)