supervisely 6.73.255__py3-none-any.whl → 6.73.257__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.

supervisely/api/api.py CHANGED
@@ -69,6 +69,7 @@ from supervisely.io.network_exceptions import (
69
69
  process_requests_exception,
70
70
  process_requests_exception_async,
71
71
  process_unhandled_request,
72
+ RetryableRequestException,
72
73
  )
73
74
  from supervisely.project.project_meta import ProjectMeta
74
75
  from supervisely.sly_logger import logger
@@ -1283,16 +1284,20 @@ class Api:
1283
1284
  Api._raise_for_status_httpx(resp)
1284
1285
 
1285
1286
  hhash = resp.headers.get("x-content-checksum-sha256", None)
1286
- for chunk in resp.iter_raw(chunk_size):
1287
- yield chunk, hhash
1288
- total_streamed += len(chunk)
1287
+ try:
1288
+ for chunk in resp.iter_raw(chunk_size):
1289
+ yield chunk, hhash
1290
+ total_streamed += len(chunk)
1291
+ except Exception as e:
1292
+ raise RetryableRequestException(repr(e))
1293
+
1289
1294
  if expected_size != 0 and total_streamed != expected_size:
1290
1295
  raise ValueError(
1291
1296
  f"Streamed size does not match the expected: {total_streamed} != {expected_size}"
1292
1297
  )
1293
1298
  logger.trace(f"Streamed size: {total_streamed}, expected size: {expected_size}")
1294
1299
  return
1295
- except (httpx.RequestError, httpx.HTTPStatusError) as e:
1300
+ except (httpx.RequestError, httpx.HTTPStatusError, RetryableRequestException) as e:
1296
1301
  if (
1297
1302
  isinstance(e, httpx.HTTPStatusError)
1298
1303
  and resp.status_code == 400
@@ -1531,9 +1536,12 @@ class Api:
1531
1536
 
1532
1537
  # received hash of the content to check integrity of the data stream
1533
1538
  hhash = resp.headers.get("x-content-checksum-sha256", None)
1534
- async for chunk in resp.aiter_raw(chunk_size):
1535
- yield chunk, hhash
1536
- total_streamed += len(chunk)
1539
+ try:
1540
+ async for chunk in resp.aiter_raw(chunk_size):
1541
+ yield chunk, hhash
1542
+ total_streamed += len(chunk)
1543
+ except Exception as e:
1544
+ raise RetryableRequestException(repr(e))
1537
1545
 
1538
1546
  if expected_size != 0 and total_streamed != expected_size:
1539
1547
  raise ValueError(
@@ -1541,7 +1549,7 @@ class Api:
1541
1549
  )
1542
1550
  logger.trace(f"Streamed size: {total_streamed}, expected size: {expected_size}")
1543
1551
  return
1544
- except (httpx.RequestError, httpx.HTTPStatusError) as e:
1552
+ except (httpx.RequestError, httpx.HTTPStatusError, RetryableRequestException) as e:
1545
1553
  if (
1546
1554
  isinstance(e, httpx.HTTPStatusError)
1547
1555
  and resp.status_code == 400
@@ -1623,11 +1631,14 @@ class Api:
1623
1631
  else:
1624
1632
  self._check_https_redirect()
1625
1633
  if self.server_address.startswith("https://"):
1626
- self._semaphore = asyncio.Semaphore(10)
1627
- logger.debug("Setting global API semaphore size to 10 for HTTPS")
1634
+ size = 10
1635
+ if "app.supervise" in self.server_address:
1636
+ size = 7
1637
+ logger.debug(f"Setting global API semaphore size to {size} for HTTPS")
1628
1638
  else:
1629
- self._semaphore = asyncio.Semaphore(5)
1630
- logger.debug("Setting global API semaphore size to 5 for HTTP")
1639
+ size = 5
1640
+ logger.debug(f"Setting global API semaphore size to {size} for HTTP")
1641
+ self._semaphore = asyncio.Semaphore(size)
1631
1642
 
1632
1643
  def set_semaphore_size(self, size: int = None):
1633
1644
  """
@@ -28,6 +28,14 @@ RETRY_STATUS_CODES = {
28
28
  }
29
29
 
30
30
 
31
+ class RetryableRequestException(Exception):
32
+ """Exception that indicates that the request should be retried."""
33
+
34
+ def __init__(self, message, response=None):
35
+ super().__init__(message)
36
+ self.response = response
37
+
38
+
31
39
  async def process_requests_exception_async(
32
40
  external_logger,
33
41
  exc,
@@ -50,6 +58,8 @@ async def process_requests_exception_async(
50
58
  except Exception:
51
59
  pass
52
60
 
61
+ is_retryable_exception = isinstance(exc, RetryableRequestException)
62
+
53
63
  is_connection_error = isinstance(
54
64
  exc,
55
65
  (
@@ -82,7 +92,7 @@ async def process_requests_exception_async(
82
92
  except (AttributeError, ValueError):
83
93
  pass
84
94
 
85
- if is_connection_error or is_server_retryable_error:
95
+ if any([is_connection_error, is_server_retryable_error, is_retryable_exception]):
86
96
  await process_retryable_request_async(
87
97
  external_logger,
88
98
  exc,
@@ -136,6 +146,8 @@ def process_requests_exception(
136
146
  except Exception:
137
147
  pass
138
148
 
149
+ is_retryable_exception = isinstance(exc, RetryableRequestException)
150
+
139
151
  is_connection_error = isinstance(
140
152
  exc,
141
153
  (
@@ -168,7 +180,7 @@ def process_requests_exception(
168
180
  except (AttributeError, ValueError):
169
181
  pass
170
182
 
171
- if is_connection_error or is_server_retryable_error:
183
+ if any([is_connection_error, is_server_retryable_error, is_retryable_exception]):
172
184
  process_retryable_request(
173
185
  external_logger,
174
186
  exc,
@@ -31,6 +31,9 @@ from supervisely.video_annotation.frame import Frame
31
31
  from supervisely.video_annotation.key_id_map import KeyIdMap
32
32
 
33
33
 
34
+ KITTI_ITEM_DIR_NAME = "velodyne"
35
+
36
+
34
37
  class EpisodeItemPaths(NamedTuple):
35
38
  #: :class:`str`: Full pointcloud file path of item
36
39
  pointcloud_path: str
@@ -153,9 +156,10 @@ class PointcloudEpisodeDataset(PointcloudDataset):
153
156
 
154
157
  def _read(self):
155
158
  if not dir_exists(self.item_dir):
156
- raise NotADirectoryError(
157
- f"Cannot read dataset {self.name}: {self.item_dir} directory not found"
158
- )
159
+ message = f"Cannot read dataset '{self.name}': '{self.item_dir}' directory not found"
160
+ if dir_exists(os.path.join(self.directory, KITTI_ITEM_DIR_NAME)):
161
+ message = f"Cannot read dataset '{self.name}'. The item directory '{KITTI_ITEM_DIR_NAME}' was found. This appears to be a KITTI dataset and will be skipped."
162
+ raise NotADirectoryError(message)
159
163
 
160
164
  try:
161
165
  item_paths = sorted(list_files(self.item_dir, filter_fn=self._has_valid_ext))
@@ -504,6 +508,7 @@ class PointcloudEpisodeProject(PointcloudProject):
504
508
  batch_size: Optional[int] = 10,
505
509
  log_progress: bool = True,
506
510
  progress_cb: Optional[Union[tqdm, Callable]] = None,
511
+ **kwargs,
507
512
  ) -> None:
508
513
  """
509
514
  Download pointcloud episodes project from Supervisely to the given directory.
@@ -626,6 +631,12 @@ class PointcloudEpisodeProject(PointcloudProject):
626
631
  progress_cb=progress_cb,
627
632
  )
628
633
 
634
+ @staticmethod
635
+ async def download_async(*args, **kwargs):
636
+ raise NotImplementedError(
637
+ f"Static method 'download_async()' is not supported for PointcloudEpisodeProject class now."
638
+ )
639
+
629
640
 
630
641
  def download_pointcloud_episode_project(
631
642
  api: Api,
@@ -737,6 +737,7 @@ class PointcloudProject(VideoProject):
737
737
  batch_size: Optional[int] = 10,
738
738
  log_progress: bool = True,
739
739
  progress_cb: Optional[Union[tqdm, Callable]] = None,
740
+ **kwargs,
740
741
  ) -> PointcloudProject:
741
742
  """
742
743
  Download pointcloud project from Supervisely to the given directory.
@@ -858,6 +859,12 @@ class PointcloudProject(VideoProject):
858
859
  progress_cb=progress_cb,
859
860
  )
860
861
 
862
+ @staticmethod
863
+ async def download_async(*args, **kwargs):
864
+ raise NotImplementedError(
865
+ f"Static method 'download_async()' is not supported for PointcloudProject class now."
866
+ )
867
+
861
868
 
862
869
  def download_pointcloud_project(
863
870
  api: Api,
@@ -2091,7 +2091,12 @@ class Project:
2091
2091
  OpenMode.READ,
2092
2092
  parents=parents,
2093
2093
  )
2094
- self._datasets = self._datasets.add(current_dataset)
2094
+ if current_dataset.name not in self._datasets._collection:
2095
+ self._datasets = self._datasets.add(current_dataset)
2096
+ else:
2097
+ logger.debug(
2098
+ f"Dataset '{current_dataset.name}' already exists in project '{self.name}'. Skip adding to collection."
2099
+ )
2095
2100
  except Exception as ex:
2096
2101
  logger.warning(ex)
2097
2102
 
@@ -33,7 +33,9 @@ VolumeItemPaths = namedtuple("VolumeItemPaths", ["volume_path", "ann_path"])
33
33
  class VolumeDataset(VideoDataset):
34
34
  item_dir_name = "volume"
35
35
  interpolation_dir = "interpolation"
36
+ interpolation_dir_name = interpolation_dir
36
37
  mask_dir = "mask"
38
+ mask_dir_name = mask_dir
37
39
  annotation_class = VolumeAnnotation
38
40
  item_module = sly_volume
39
41
  paths_tuple = VolumeItemPaths
@@ -147,6 +149,7 @@ class VolumeProject(VideoProject):
147
149
  download_volumes: Optional[bool] = True,
148
150
  log_progress: bool = False,
149
151
  progress_cb: Optional[Union[tqdm, Callable]] = None,
152
+ **kwargs,
150
153
  ) -> None:
151
154
  """
152
155
  Download volume project from Supervisely to the given directory.
@@ -297,6 +300,12 @@ class VolumeProject(VideoProject):
297
300
  f"Static method 'get_train_val_splits_by_tag()' is not supported for VolumeProject class now."
298
301
  )
299
302
 
303
+ @staticmethod
304
+ async def download_async(*args, **kwargs):
305
+ raise NotImplementedError(
306
+ f"Static method 'download_async()' is not supported for VolumeProject class now."
307
+ )
308
+
300
309
 
301
310
  def download_volume_project(
302
311
  api: Api,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supervisely
3
- Version: 6.73.255
3
+ Version: 6.73.257
4
4
  Summary: Supervisely Python SDK.
5
5
  Home-page: https://github.com/supervisely/supervisely
6
6
  Author: Supervisely
@@ -22,7 +22,7 @@ supervisely/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  supervisely/api/advanced_api.py,sha256=Nd5cCnHFWc3PSUrCtENxTGtDjS37_lCHXsgXvUI3Ti8,2054
23
23
  supervisely/api/agent_api.py,sha256=ShWAIlXcWXcyI9fqVuP5GZVCigCMJmjnvdGUfLspD6Y,8890
24
24
  supervisely/api/annotation_api.py,sha256=kB9l0NhQEkunGDC9fWjNzf5DdhqRF1tv-RRnIbkV2k0,64941
25
- supervisely/api/api.py,sha256=A4EY7MtLWw4a29Wd63SjQs2CkS3KAiYkVLyuuZn1LdM,65371
25
+ supervisely/api/api.py,sha256=0dgPx_eizoCEFzfT8YH9uh1kq-OJwjrV5fBGD7uZ7E4,65840
26
26
  supervisely/api/app_api.py,sha256=-T4sISQ7POyR2yirf1kEWj4JaJFpJxCyRWqbf_99Jak,67036
27
27
  supervisely/api/dataset_api.py,sha256=eovT6l62jgjlRyCZ6IvoudUBfDxv9Hjj3Ap8IuCLd7I,41290
28
28
  supervisely/api/file_api.py,sha256=7yWt8lRQ4UfLmnMZ9T18UXzu8jihrtHtcqi6GZJG-0w,83414
@@ -693,7 +693,7 @@ supervisely/io/fs_cache.py,sha256=985gvBGzveLcDudgz10E4EWVjP9jxdU1Pa0GFfCBoCA,65
693
693
  supervisely/io/github_utils.py,sha256=jGmvQJ5bjtACuSFABzrxL0jJdh14SezovrHp8T-9y8g,1779
694
694
  supervisely/io/json.py,sha256=VvyqXZl22nb6_DJK3TUOPetd5xq9xwRFKumWqsGs7iI,8679
695
695
  supervisely/io/multipart_stream_decoder.py,sha256=rCheeSCAGdw2tNyaWEYa4dvoIDuldXOxH86RVB82c78,14417
696
- supervisely/io/network_exceptions.py,sha256=pEhw0jKw_p-Rl42SMOexVU6SW2Z_xIl1kTryNb3EvIQ,8716
696
+ supervisely/io/network_exceptions.py,sha256=XnSmxLRyJmHtGyU7Wn5sZcidRjP3fU8ovRhNkVekU9Q,9153
697
697
  supervisely/labeling_jobs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
698
698
  supervisely/labeling_jobs/constants.py,sha256=GF_pwF9fC9_DGbpD3cAk3llifskAxpDmyuXwxM1f3Hw,104
699
699
  supervisely/labeling_jobs/utils.py,sha256=XOGF2cbnTGbXFdT5jGL1LIPQfiCEJgRkmKNIjTlFois,22656
@@ -990,16 +990,16 @@ supervisely/pointcloud_episodes/pointcloud_episodes.py,sha256=cRXdtw7bMsbsdVQjxf
990
990
  supervisely/project/__init__.py,sha256=hlzdj9Pgy53Q3qdP8LMtGTChvZHQuuShdtui2eRUQeE,2601
991
991
  supervisely/project/data_version.py,sha256=nknaWJSUCwoDyNG9_d1KA-GjzidhV9zd9Cn8cg15DOU,19270
992
992
  supervisely/project/download.py,sha256=zb8sb4XZ6Qi3CP7fmtLRUAYzaxs_W0WnOfe2x3ZVRMs,24639
993
- supervisely/project/pointcloud_episode_project.py,sha256=fcaFAaHVn_VvdiIfHl4IyEFE5-Q3VFGfo7_YoxEma0I,41341
994
- supervisely/project/pointcloud_project.py,sha256=Y8Xhi6Hg-KyztwFncezuDfKTt2FILss96EU_LdXzmrA,49172
995
- supervisely/project/project.py,sha256=Bnp-LHrlQCxOWV7SVbpEcDKdFO9VMKiAgod6Fld8p-E,188388
993
+ supervisely/project/pointcloud_episode_project.py,sha256=yiWdNBQiI6f1O9sr1pg8JHW6O-w3XUB1rikJNn3Oung,41866
994
+ supervisely/project/pointcloud_project.py,sha256=Kx1Vaes-krwG3BiRRtHRLQxb9G5m5bTHPN9IzRqmNWo,49399
995
+ supervisely/project/project.py,sha256=bC6qY1M93pa7kzxOxOuSbCTkzIKXfiKO-ecJrbAX_Ag,188673
996
996
  supervisely/project/project_meta.py,sha256=26s8IiHC5Pg8B1AQi6_CrsWteioJP2in00cRNe8QlW0,51423
997
997
  supervisely/project/project_settings.py,sha256=NLThzU_DCynOK6hkHhVdFyezwprn9UqlnrLDe_3qhkY,9347
998
998
  supervisely/project/project_type.py,sha256=_3RqW2CnDBKFOvSIrQT1RJQaiHirs34_jiQS8CkwCpo,530
999
999
  supervisely/project/readme_template.md,sha256=rGmSLRVUSGjvorjpzl0sZ7YA4sKfDexl95NFtMISj3I,9128
1000
1000
  supervisely/project/upload.py,sha256=AjgHYgVZwUE25ygC5pqvFjdAladbyB8T78mlet5Qpho,3750
1001
1001
  supervisely/project/video_project.py,sha256=8fJeicVWNMbek24PmNRBtbnFhvXsnxPg5dpNrL5VNW4,63739
1002
- supervisely/project/volume_project.py,sha256=LL4IxQyx0DU4acj2imz6diWO3kHHaWnf7QiycTJUTMU,22367
1002
+ supervisely/project/volume_project.py,sha256=Kn9VEvWuKKZvL2nx6B6bjSvHuoZhAOxEc6DvPRexUco,22666
1003
1003
  supervisely/pyscripts_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1004
1004
  supervisely/pyscripts_utils/utils.py,sha256=scEwHJvHRQa8NHIOn2eTwH6-Zc8CGdLoxM-WzH9jcRo,314
1005
1005
  supervisely/report/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -1054,9 +1054,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
1054
1054
  supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
1055
1055
  supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
1056
1056
  supervisely_lib/__init__.py,sha256=7-3QnN8Zf0wj8NCr2oJmqoQWMKKPKTECvjH9pd2S5vY,159
1057
- supervisely-6.73.255.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1058
- supervisely-6.73.255.dist-info/METADATA,sha256=Ifb1c2LAS2PxE8b6tm-M8fAQhtfEB_addqJqjjNoeAk,33573
1059
- supervisely-6.73.255.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
1060
- supervisely-6.73.255.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1061
- supervisely-6.73.255.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1062
- supervisely-6.73.255.dist-info/RECORD,,
1057
+ supervisely-6.73.257.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1058
+ supervisely-6.73.257.dist-info/METADATA,sha256=UyU-S9TnzIcLlXhsvyoWuEMUDL031uxLtqyG_IJvLBs,33573
1059
+ supervisely-6.73.257.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
1060
+ supervisely-6.73.257.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1061
+ supervisely-6.73.257.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1062
+ supervisely-6.73.257.dist-info/RECORD,,