supervisely 6.73.272__py3-none-any.whl → 6.73.274__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of supervisely might be problematic. Click here for more details.

@@ -4432,23 +4432,29 @@ async def _download_project_async(
4432
4432
  switch_size = kwargs.get("switch_size", 1.28 * 1024 * 1024)
4433
4433
  # batch size for bulk download
4434
4434
  batch_size = kwargs.get("batch_size", 100)
4435
- # number of workers
4436
- num_workers = kwargs.get("num_workers", 5)
4437
4435
 
4438
4436
  if semaphore is None:
4439
4437
  semaphore = api.get_default_semaphore()
4440
4438
 
4441
- async def worker(queue: asyncio.Queue, semaphore: asyncio.Semaphore):
4442
- while True:
4439
+ # number of workers
4440
+ num_workers = min(kwargs.get("num_workers", semaphore._value), 10)
4441
+
4442
+ async def worker(queue: asyncio.Queue, stop_event: asyncio.Event):
4443
+ while not stop_event.is_set():
4443
4444
  task = await queue.get()
4444
4445
  if task is None:
4445
4446
  break
4446
- async with semaphore:
4447
+ try:
4447
4448
  await task
4448
- queue.task_done()
4449
+ except Exception as e:
4450
+ logger.error(f"Error in _download_project_async worker: {e}")
4451
+ stop_event.set()
4452
+ finally:
4453
+ queue.task_done()
4449
4454
 
4450
4455
  queue = asyncio.Queue()
4451
- workers = [asyncio.create_task(worker(queue, semaphore)) for _ in range(num_workers)]
4456
+ stop_event = asyncio.Event()
4457
+ workers = [asyncio.create_task(worker(queue, stop_event)) for _ in range(num_workers)]
4452
4458
 
4453
4459
  dataset_ids = set(dataset_ids) if (dataset_ids is not None) else None
4454
4460
  project_fs = None
@@ -4494,9 +4500,11 @@ async def _download_project_async(
4494
4500
  )
4495
4501
  small_images = []
4496
4502
  large_images = []
4503
+ dataset_images = []
4497
4504
  async for image_batch in all_images:
4498
4505
  for image in image_batch:
4499
4506
  if images_ids is None or image.id in images_ids:
4507
+ dataset_images.append(image)
4500
4508
  if image.size < switch_size:
4501
4509
  small_images.append(image)
4502
4510
  else:
@@ -4523,13 +4531,12 @@ async def _download_project_async(
4523
4531
  try:
4524
4532
  existing = dataset_fs.get_item_info(image.name)
4525
4533
  except:
4526
- pass
4534
+ to_download.append(image)
4527
4535
  else:
4528
- if existing.updated_at == image.updated_at:
4529
- if ds_progress is not None:
4530
- ds_progress(1)
4531
- continue
4532
- to_download.append(image)
4536
+ if existing.updated_at != image.updated_at:
4537
+ to_download.append(image)
4538
+ elif ds_progress is not None:
4539
+ ds_progress(1)
4533
4540
  return to_download
4534
4541
 
4535
4542
  small_images = await check_items(small_images)
@@ -4568,11 +4575,9 @@ async def _download_project_async(
4568
4575
 
4569
4576
  await queue.join()
4570
4577
 
4571
- all_images = small_images + large_images
4572
-
4573
4578
  if save_image_meta:
4574
4579
  meta_dir = dataset_fs.meta_dir
4575
- for image_info in all_images:
4580
+ for image_info in dataset_images:
4576
4581
  if image_info.meta:
4577
4582
  sly.fs.mkdir(meta_dir)
4578
4583
  sly.json.dump_json_file(
@@ -4580,7 +4585,7 @@ async def _download_project_async(
4580
4585
  )
4581
4586
 
4582
4587
  # delete redundant items
4583
- items_names_set = set([img.name for img in all_images])
4588
+ items_names_set = set([img.name for img in dataset_images])
4584
4589
  for item_name in dataset_fs.get_items_names():
4585
4590
  if item_name not in items_names_set:
4586
4591
  dataset_fs.delete_item(item_name)
@@ -4588,6 +4593,10 @@ async def _download_project_async(
4588
4593
  for _ in range(num_workers):
4589
4594
  await queue.put(None)
4590
4595
  await asyncio.gather(*workers)
4596
+
4597
+ if stop_event.is_set():
4598
+ raise RuntimeError("Download process was stopped due to an error in one of the workers.")
4599
+
4591
4600
  try:
4592
4601
  create_readme(dest_dir, project_id, api)
4593
4602
  except Exception as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supervisely
3
- Version: 6.73.272
3
+ Version: 6.73.274
4
4
  Summary: Supervisely Python SDK.
5
5
  Home-page: https://github.com/supervisely/supervisely
6
6
  Author: Supervisely
@@ -1000,7 +1000,7 @@ supervisely/project/data_version.py,sha256=nknaWJSUCwoDyNG9_d1KA-GjzidhV9zd9Cn8c
1000
1000
  supervisely/project/download.py,sha256=zb8sb4XZ6Qi3CP7fmtLRUAYzaxs_W0WnOfe2x3ZVRMs,24639
1001
1001
  supervisely/project/pointcloud_episode_project.py,sha256=yiWdNBQiI6f1O9sr1pg8JHW6O-w3XUB1rikJNn3Oung,41866
1002
1002
  supervisely/project/pointcloud_project.py,sha256=Kx1Vaes-krwG3BiRRtHRLQxb9G5m5bTHPN9IzRqmNWo,49399
1003
- supervisely/project/project.py,sha256=W9KraDLPE4u5EilHgxHndSmK_8xwrAmjkUQSS1TAyRg,188731
1003
+ supervisely/project/project.py,sha256=6E3DqWF7T5XJWywuna2gAeGVb9CaK8dU3QFcrOQMLRU,189109
1004
1004
  supervisely/project/project_meta.py,sha256=26s8IiHC5Pg8B1AQi6_CrsWteioJP2in00cRNe8QlW0,51423
1005
1005
  supervisely/project/project_settings.py,sha256=NLThzU_DCynOK6hkHhVdFyezwprn9UqlnrLDe_3qhkY,9347
1006
1006
  supervisely/project/project_type.py,sha256=_3RqW2CnDBKFOvSIrQT1RJQaiHirs34_jiQS8CkwCpo,530
@@ -1062,9 +1062,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
1062
1062
  supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
1063
1063
  supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
1064
1064
  supervisely_lib/__init__.py,sha256=7-3QnN8Zf0wj8NCr2oJmqoQWMKKPKTECvjH9pd2S5vY,159
1065
- supervisely-6.73.272.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1066
- supervisely-6.73.272.dist-info/METADATA,sha256=tBPWJYLXQq7WFB62t_mg4YimISZvWTDSS6DcGVVV-LI,33573
1067
- supervisely-6.73.272.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
1068
- supervisely-6.73.272.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1069
- supervisely-6.73.272.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1070
- supervisely-6.73.272.dist-info/RECORD,,
1065
+ supervisely-6.73.274.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1066
+ supervisely-6.73.274.dist-info/METADATA,sha256=PHTIEhW0ErGXlcajujh7MS3qSy4cq8TDdAIhh_eIY7U,33573
1067
+ supervisely-6.73.274.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
1068
+ supervisely-6.73.274.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1069
+ supervisely-6.73.274.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1070
+ supervisely-6.73.274.dist-info/RECORD,,