supervisely 6.73.262__py3-none-any.whl → 6.73.263__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/__init__.py CHANGED
@@ -309,4 +309,4 @@ except Exception as e:
309
309
  # If new changes in Supervisely Python SDK require upgrade of the Supervisely instance
310
310
  # set a new value for the environment variable MINIMUM_INSTANCE_VERSION_FOR_SDK, otherwise
311
311
  # users can face compatibility issues, if the instance version is lower than the SDK version.
312
- os.environ["MINIMUM_INSTANCE_VERSION_FOR_SDK"] = "6.12.12"
312
+ os.environ["MINIMUM_INSTANCE_VERSION_FOR_SDK"] = "6.12.17"
@@ -1212,17 +1212,80 @@ class AppApi(TaskApi):
1212
1212
 
1213
1213
  def get_list(
1214
1214
  self,
1215
- team_id,
1216
- filter=None,
1217
- context=None,
1218
- repository_key=None,
1219
- show_disabled=False,
1220
- integrated_into=None,
1221
- session_tags=None,
1222
- only_running=False,
1223
- with_shared=True,
1215
+ team_id: int,
1216
+ filter: Optional[List[dict]] = None,
1217
+ context: Optional[List[str]] = None,
1218
+ repository_key: Optional[str] = None,
1219
+ show_disabled: bool = False,
1220
+ integrated_into: Optional[List[str]] = None,
1221
+ session_tags: Optional[List[str]] = None,
1222
+ only_running: bool = False,
1223
+ with_shared: bool = True,
1224
+ force_all_sessions: bool = True,
1224
1225
  ) -> List[AppInfo]:
1225
- """get_list"""
1226
+ """
1227
+ Get list of applications for the specified team.
1228
+
1229
+ :param team_id: team id
1230
+ :type team_id: int
1231
+ :param filter: list of filters
1232
+ :type filter: Optional[List[dict]]
1233
+ :param context: list of application contexts
1234
+ :type context: Optional[List[str]]
1235
+ :param repository_key: repository key
1236
+ :type repository_key: Optional[str]
1237
+ :param show_disabled: show disabled applications
1238
+ :type show_disabled: bool
1239
+ :param integrated_into: destination of the application.
1240
+ Available values: "panel", "files", "standalone", "data_commander",
1241
+ "image_annotation_tool", "video_annotation_tool",
1242
+ "dicom_annotation_tool", "pointcloud_annotation_tool"
1243
+ :type integrated_into: Optional[List[str]]
1244
+ :param session_tags: list of session tags
1245
+ :type session_tags: Optional[List[str]]
1246
+ :param only_running: show only running applications (status is one of "queued"/"consumed"/"started"/"deployed")
1247
+ :type only_running: bool
1248
+ :param with_shared: include shared applications
1249
+ :type with_shared: bool
1250
+ :param force_all_sessions: force to get all sessions (tasks) for each application.
1251
+ Works only if only_running is False.
1252
+ Note that it can be a long operation.
1253
+ :type force_all_sessions: bool
1254
+
1255
+ :return: list of applications
1256
+ :rtype: List[AppInfo]
1257
+
1258
+
1259
+ :Usage example:
1260
+
1261
+ .. code-block:: python
1262
+
1263
+ import supervisely as sly
1264
+
1265
+ os.environ['SERVER_ADDRESS'] = 'https://app.supervisely.com'
1266
+ os.environ['API_TOKEN'] = 'Your Supervisely API Token'
1267
+ api = sly.Api.from_env()
1268
+
1269
+ team_id = 447
1270
+
1271
+ # Get list of all applications (including all tasks in `tasks` field)
1272
+ apps = api.app.get_list(team_id=team_id)
1273
+
1274
+ # Get list of all applications (only running tasks included in `tasks` field)
1275
+ apps = api.app.get_list(team_id=team_id, force_all_sessions=False)
1276
+
1277
+ # Get list of only running applications
1278
+ apps = api.app.get_list(team_id=team_id, only_running=True)
1279
+
1280
+ # Get list of applications with specific filters
1281
+ filter = [{"field": "moduleId", "operator": "=", "value": 428}]
1282
+ apps = api.app.get_list(team_id=team_id, filter=filter)
1283
+ """
1284
+
1285
+ if only_running is True:
1286
+ # no need to get all sessions if only running sessions are requested
1287
+ # (`force_all_sessions` has higher priority than only_running)
1288
+ force_all_sessions = False
1226
1289
 
1227
1290
  return self.get_list_all_pages(
1228
1291
  method="apps.list",
@@ -1240,6 +1303,7 @@ class AppApi(TaskApi):
1240
1303
  "onlyRunning": only_running,
1241
1304
  "showDisabled": show_disabled,
1242
1305
  "withShared": with_shared,
1306
+ "forceAllSessions": force_all_sessions,
1243
1307
  },
1244
1308
  )
1245
1309
 
@@ -1479,49 +1543,105 @@ class AppApi(TaskApi):
1479
1543
 
1480
1544
  def get_sessions(
1481
1545
  self,
1482
- team_id,
1483
- module_id,
1484
- # only_running=False,
1485
- show_disabled=False,
1486
- session_name=None,
1487
- statuses: List[TaskApi.Status] = None,
1546
+ team_id: int,
1547
+ module_id: int,
1548
+ show_disabled: bool = False,
1549
+ session_name: Optional[str] = None,
1550
+ statuses: Optional[List[TaskApi.Status]] = None,
1551
+ with_shared: bool = False,
1488
1552
  ) -> List[SessionInfo]:
1489
- infos_json = self.get_list_all_pages(
1490
- method="apps.list",
1491
- data={
1492
- "teamId": team_id,
1493
- "filter": [{"field": "moduleId", "operator": "=", "value": module_id}],
1494
- # "onlyRunning": only_running,
1495
- "showDisabled": show_disabled,
1496
- },
1497
- convert_json_info_cb=lambda x: x,
1498
- # validate_total=False,
1553
+ """
1554
+ Get list of sessions (tasks) for the specified team and module.
1555
+
1556
+ :param team_id: team id
1557
+ :type team_id: int
1558
+ :param module_id: application module id
1559
+ :type module_id: int
1560
+ :param show_disabled: show disabled applications
1561
+ :type show_disabled: bool
1562
+ :param session_name: session name to filter sessions
1563
+ :type session_name: Optional[str]
1564
+ :param statuses: list of statuses to filter sessions
1565
+ :type statuses: Optional[List[TaskApi.Status]]
1566
+ :param with_shared: include shared application sessions
1567
+ :type with_shared: bool
1568
+
1569
+ :return: list of sessions
1570
+ :rtype: List[SessionInfo]
1571
+
1572
+ :Usage example:
1573
+
1574
+ .. code-block:: python
1575
+
1576
+ import supervisely as sly
1577
+
1578
+ os.environ['SERVER_ADDRESS'] = 'https://app.supervisely.com'
1579
+ os.environ['API_TOKEN'] = 'Your Supervisely API Token'
1580
+ api = sly.Api.from_env()
1581
+
1582
+ team_id = 447
1583
+ module_id = 428
1584
+
1585
+ # Get list of all sessions for the specified team and module ID
1586
+ sessions = api.app.get_sessions(team_id, module_id)
1587
+
1588
+ # Get list of sessions with specific statuses
1589
+ from supervisely.api.task_api import TaskApi
1590
+
1591
+ statuses = [TaskApi.Status.STARTED]
1592
+ sessions = api.app.get_sessions(team_id, module_id, statuses=statuses)
1593
+ """
1594
+
1595
+ infos_json = self.get_list(
1596
+ team_id,
1597
+ filter=[
1598
+ {
1599
+ ApiField.FIELD: ApiField.MODULE_ID,
1600
+ ApiField.OPERATOR: "=",
1601
+ ApiField.VALUE: module_id,
1602
+ }
1603
+ ],
1604
+ with_shared=with_shared,
1605
+ only_running=False,
1606
+ force_all_sessions=False,
1499
1607
  )
1500
- if len(infos_json) == 0:
1501
- # raise KeyError(f"App [module_id = {module_id}] not found in team {team_id}")
1502
- return []
1503
- if len(infos_json) > 1:
1608
+ if len(infos_json) > 1 and with_shared is False:
1504
1609
  raise KeyError(
1505
1610
  f"Apps list in team is broken: app [module_id = {module_id}] added to team {team_id} multiple times"
1506
1611
  )
1507
- dev_tasks = []
1508
- sessions = infos_json[0]["tasks"]
1509
-
1510
- str_statuses = []
1511
- if statuses is not None:
1512
- for s in statuses:
1513
- str_statuses.append(str(s))
1514
-
1612
+ sessions = []
1613
+ for app in infos_json:
1614
+ data = {
1615
+ ApiField.TEAM_ID: team_id,
1616
+ ApiField.APP_ID: app.id,
1617
+ # ApiField.ONLY_RUNNING: False,
1618
+ ApiField.SHOW_DISABLED: show_disabled,
1619
+ ApiField.WITH_SHARED: with_shared,
1620
+ ApiField.SORT: ApiField.STARTED_AT,
1621
+ ApiField.SORT_ORDER: "desc",
1622
+ }
1623
+ if statuses is not None:
1624
+ data[ApiField.FILTER] = [
1625
+ {
1626
+ ApiField.FIELD: ApiField.STATUS,
1627
+ ApiField.OPERATOR: "in",
1628
+ ApiField.VALUE: [str(s) for s in statuses],
1629
+ }
1630
+ ]
1631
+ sessions.extend(
1632
+ self.get_list_all_pages(
1633
+ method="apps.tasks.list",
1634
+ data=data,
1635
+ convert_json_info_cb=lambda x: x,
1636
+ )
1637
+ )
1638
+ session_infos = []
1515
1639
  for session in sessions:
1516
- to_add = True
1517
1640
  if session_name is not None and session["meta"]["name"] != session_name:
1518
- to_add = False
1519
- if statuses is not None and session["status"] not in str_statuses:
1520
- to_add = False
1521
- if to_add is True:
1522
- session["moduleId"] = module_id
1523
- dev_tasks.append(SessionInfo.from_json(session))
1524
- return dev_tasks
1641
+ continue
1642
+ session["moduleId"] = module_id
1643
+ session_infos.append(SessionInfo.from_json(session))
1644
+ return session_infos
1525
1645
 
1526
1646
  def start(
1527
1647
  self,
@@ -596,6 +596,12 @@ class ApiField:
596
596
  """"""
597
597
  CLEAR_LOCAL_DATA_SOURCE = "clearLocalDataSource"
598
598
  """"""
599
+ ONLY_RUNNING = "onlyRunning"
600
+ """"""
601
+ SHOW_DISABLED = "showDisabled"
602
+ """"""
603
+ WITH_SHARED = "withShared"
604
+ """"""
599
605
 
600
606
 
601
607
  def _get_single_item(items):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supervisely
3
- Version: 6.73.262
3
+ Version: 6.73.263
4
4
  Summary: Supervisely Python SDK.
5
5
  Home-page: https://github.com/supervisely/supervisely
6
6
  Author: Supervisely
@@ -1,5 +1,5 @@
1
1
  supervisely/README.md,sha256=XM-DiMC6To3I9RjQZ0c61905EFRR_jnCUx2q3uNR-X8,3331
2
- supervisely/__init__.py,sha256=AV335r212Ln_vTroiucb5T6yFuAlMKxKzldjMbW3gA8,10800
2
+ supervisely/__init__.py,sha256=x83gx4W-dVuR8-6vthw5nZptfR0k_1FLQfXs7H36c3Q,10800
3
3
  supervisely/_utils.py,sha256=I4nZ0L7NS6144r-CQ2VJvLeUJZ1bCi4pYXH4Gxo3-D4,15763
4
4
  supervisely/function_wrapper.py,sha256=R5YajTQ0GnRp2vtjwfC9hINkzQc0JiyGsu8TER373xY,1912
5
5
  supervisely/sly_logger.py,sha256=LG1wTyyctyEKuCuKM2IKf_SMPH7BzkTsFdO-0tnorzg,6225
@@ -23,7 +23,7 @@ supervisely/api/advanced_api.py,sha256=Nd5cCnHFWc3PSUrCtENxTGtDjS37_lCHXsgXvUI3T
23
23
  supervisely/api/agent_api.py,sha256=ShWAIlXcWXcyI9fqVuP5GZVCigCMJmjnvdGUfLspD6Y,8890
24
24
  supervisely/api/annotation_api.py,sha256=kB9l0NhQEkunGDC9fWjNzf5DdhqRF1tv-RRnIbkV2k0,64941
25
25
  supervisely/api/api.py,sha256=0dgPx_eizoCEFzfT8YH9uh1kq-OJwjrV5fBGD7uZ7E4,65840
26
- supervisely/api/app_api.py,sha256=-T4sISQ7POyR2yirf1kEWj4JaJFpJxCyRWqbf_99Jak,67036
26
+ supervisely/api/app_api.py,sha256=RsbVej8WxWVn9cNo5s3Fqd1symsCdsfOaKVBKEUapRY,71927
27
27
  supervisely/api/dataset_api.py,sha256=eovT6l62jgjlRyCZ6IvoudUBfDxv9Hjj3Ap8IuCLd7I,41290
28
28
  supervisely/api/file_api.py,sha256=7yWt8lRQ4UfLmnMZ9T18UXzu8jihrtHtcqi6GZJG-0w,83414
29
29
  supervisely/api/github_api.py,sha256=NIexNjEer9H5rf5sw2LEZd7C1WR-tK4t6IZzsgeAAwQ,623
@@ -32,7 +32,7 @@ supervisely/api/image_api.py,sha256=2cki-IzA5jnN3QqqdSIbIbHJhDWxFGYxXY94WqBOoio,
32
32
  supervisely/api/import_storage_api.py,sha256=BDCgmR0Hv6OoiRHLCVPKt3iDxSVlQp1WrnKhAK_Zl84,460
33
33
  supervisely/api/issues_api.py,sha256=BqDJXmNoTzwc3xe6_-mA7FDFC5QQ-ahGbXk_HmpkSeQ,17925
34
34
  supervisely/api/labeling_job_api.py,sha256=odnzZjp29yM16Gq-FYkv-OA4WFMNJCLFo4qSikW2A7c,56280
35
- supervisely/api/module_api.py,sha256=ajVPU5bH1sB-l2PwWq_xtFxSmZIBikflousOxiAYmW4,43141
35
+ supervisely/api/module_api.py,sha256=8z7K6K77fa9oijnix4vnCADJwe5nZtsDiWKZTWc_yuI,43273
36
36
  supervisely/api/neural_network_api.py,sha256=ktPVRO4Jeulougio8F0mioJJHwRJcX250Djp1wBoQ9c,7620
37
37
  supervisely/api/object_class_api.py,sha256=-rQcKwhBw3iL9KNH9c1ROgoimgWM1ls6Wi_tb1R-MzY,7683
38
38
  supervisely/api/plugin_api.py,sha256=TlfrosdRuYG4NUxk92QiQoVaOdztFspPpygyVa3M3zk,5283
@@ -1057,9 +1057,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
1057
1057
  supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
1058
1058
  supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
1059
1059
  supervisely_lib/__init__.py,sha256=7-3QnN8Zf0wj8NCr2oJmqoQWMKKPKTECvjH9pd2S5vY,159
1060
- supervisely-6.73.262.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1061
- supervisely-6.73.262.dist-info/METADATA,sha256=aMuL624leouIzMWfrL4bx-4A0hXHCT1hTTSHd9YYVbw,33573
1062
- supervisely-6.73.262.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
1063
- supervisely-6.73.262.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1064
- supervisely-6.73.262.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1065
- supervisely-6.73.262.dist-info/RECORD,,
1060
+ supervisely-6.73.263.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1061
+ supervisely-6.73.263.dist-info/METADATA,sha256=M3YKXXtM4dpAgiB1GET6JjPaejX6M-qq4mmSAu4wis8,33573
1062
+ supervisely-6.73.263.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
1063
+ supervisely-6.73.263.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1064
+ supervisely-6.73.263.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1065
+ supervisely-6.73.263.dist-info/RECORD,,