Skip to content

Commit f49f4e4

Browse files
Upd progress
1 parent e144220 commit f49f4e4

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

labelbox/schema/annotation_import.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,15 @@ def wait_until_done(self, sleep_time_seconds: int = 10, show_progress: bool = Tr
8787
sleep_time_seconds (int): a time to block between subsequent API calls
8888
show_progress (bool): should show progress bar
8989
"""
90-
with tqdm(total=100) as pbar:
91-
while self.state.value == AnnotationImportState.RUNNING.value:
92-
logger.info(f"Sleeping for {sleep_time_seconds} seconds...")
93-
time.sleep(sleep_time_seconds)
94-
self.__backoff_refresh()
95-
if self.progress:
96-
pbar.update(self.progress)
97-
90+
pbar = tqdm(total=100) if show_progress else None
91+
while self.state.value == AnnotationImportState.RUNNING.value:
92+
logger.info(f"Sleeping for {sleep_time_seconds} seconds...")
93+
time.sleep(sleep_time_seconds)
94+
self.__backoff_refresh()
95+
if self.progress and pbar:
96+
pbar.update(self.progress)
97+
98+
if pbar:
9899
pbar.update(100)
99100

100101
@backoff.on_exception(

0 commit comments

Comments
 (0)