Skip to content

Commit

Permalink
prervent division by zero error
Browse files Browse the repository at this point in the history
  • Loading branch information
denniswittich committed Aug 30, 2024
1 parent 7f1e1c9 commit e561789
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions learning_loop_node/data_exchanger.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ async def download_images(self, image_uuids: List[str], image_folder: str, chunk

paths, _ = create_resource_paths(self.context.organization, self.context.project, new_image_uuids)
num_new_image_ids = len(new_image_uuids)
if num_new_image_ids == 0:
logging.info('All images are already downloaded. Nothing to do.')
self.progress = 1.0
return

logging.info(f'Downloading {num_new_image_ids} new images to {image_folder}..')
os.makedirs(image_folder, exist_ok=True)

progress_factor = 0.5 / num_new_image_ids # second 50% of progress is for downloading images
Expand Down

0 comments on commit e561789

Please sign in to comment.