supervisely 6.73.406__py3-none-any.whl → 6.73.407__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.
@@ -11,7 +11,7 @@ from typing_extensions import Literal
11
11
 
12
12
  from supervisely._utils import is_community, is_development, take_with_default
13
13
  from supervisely.api.module_api import ApiField
14
- from supervisely.api.task_api import TaskApi
14
+ from supervisely.api.task_api import KubernetesSettings, TaskApi
15
15
 
16
16
  # from supervisely.app.constants import DATA, STATE, CONTEXT, TEMPLATE
17
17
  STATE = "state"
@@ -1682,6 +1682,7 @@ class AppApi(TaskApi):
1682
1682
  proxy_keep_url: bool = False,
1683
1683
  module_id: Optional[int] = None,
1684
1684
  redirect_requests: Dict[str, int] = {},
1685
+ kubernetes_settings: Optional[Union[KubernetesSettings, Dict[str, Any]]] = None,
1685
1686
  ) -> SessionInfo:
1686
1687
  """Start a new application session (task).
1687
1688
 
@@ -1713,6 +1714,8 @@ class AppApi(TaskApi):
1713
1714
  :type module_id: Optional[int]
1714
1715
  :param redirect_requests: For internal usage only in Develop and Debug mode.
1715
1716
  :type redirect_requests: dict
1717
+ :param kubernetes_settings: Kubernetes settings for the task. If not specified, default settings will be used.
1718
+ :type kubernetes_settings: Optional[Union[KubernetesSettings, Dict[str, Any]]]
1716
1719
  :return: SessionInfo object with information about the started task.
1717
1720
  :rtype: SessionInfo
1718
1721
  :raises ValueError: If both app_id and module_id are not provided.
@@ -1747,6 +1750,7 @@ class AppApi(TaskApi):
1747
1750
  proxy_keep_url=proxy_keep_url,
1748
1751
  module_id=module_id,
1749
1752
  redirect_requests=redirect_requests,
1753
+ kubernetes_settings=kubernetes_settings,
1750
1754
  )
1751
1755
  if type(result) is not list:
1752
1756
  result = [result]
@@ -11,6 +11,7 @@ from pathlib import Path
11
11
  from typing import Any, Callable, Dict, List, Literal, NamedTuple, Optional, Union
12
12
 
13
13
  import requests
14
+ from pydantic import BaseModel, Field
14
15
  from requests_toolbelt import MultipartEncoder, MultipartEncoderMonitor
15
16
  from tqdm import tqdm
16
17
 
@@ -31,6 +32,28 @@ from supervisely.io.fs import (
31
32
  )
32
33
 
33
34
 
35
+ class KubernetesSettings(BaseModel):
36
+ """
37
+ KubernetesSettings for application resource limits and requests.
38
+ """
39
+
40
+ use_health_check: Optional[bool] = Field(None, alias="useHealthCheck")
41
+ request_cpus: Optional[int] = Field(None, alias="requestCpus")
42
+ limit_cpus: Optional[int] = Field(None, alias="limitCpus")
43
+ limit_memory_gb: Optional[int] = Field(None, alias="limitMemoryGb")
44
+ limit_shm_gb: Optional[int] = Field(None, alias="limitShmGb")
45
+ limit_storage_gb: Optional[int] = Field(None, alias="limitStorageGb")
46
+ limit_gpus: Optional[int] = Field(None, alias="limitGpus")
47
+ limit_gpu_memory_mb: Optional[int] = Field(None, alias="limitGpuMemoryMb")
48
+ limit_gpu_cores_perc: Optional[int] = Field(None, alias="limitGpuCoresPerc")
49
+
50
+ model_config = {"populate_by_name": True}
51
+
52
+ def to_dict(self) -> Dict[str, Any]:
53
+ """Convert to dict with only non-None values using aliases."""
54
+ return self.model_dump(exclude_none=True, by_alias=True)
55
+
56
+
34
57
  class TaskFinishedWithError(Exception):
35
58
  """TaskFinishedWithError"""
36
59
 
@@ -365,6 +388,7 @@ class TaskApi(ModuleApiBase, ModuleWithStatus):
365
388
  module_id: Optional[int] = None,
366
389
  redirect_requests: Optional[Dict[str, int]] = {},
367
390
  limit_by_workspace: bool = False,
391
+ kubernetes_settings: Optional[Union[KubernetesSettings, Dict[str, Any]]] = None,
368
392
  ) -> Dict[str, Any]:
369
393
  """Starts the application task on the agent.
370
394
 
@@ -401,6 +425,8 @@ class TaskApi(ModuleApiBase, ModuleWithStatus):
401
425
  :param limit_by_workspace: If set to True tasks will be only visible inside of the workspace
402
426
  with specified workspace_id.
403
427
  :type limit_by_workspace: bool, optional
428
+ :param kubernetes_settings: Kubernetes settings for the application.
429
+ :type kubernetes_settings: Union[KubernetesSettings, Dict[str, Any]], optional
404
430
  :return: Task information in JSON format.
405
431
  :rtype: Dict[str, Any]
406
432
 
@@ -439,6 +465,15 @@ class TaskApi(ModuleApiBase, ModuleWithStatus):
439
465
  ApiField.LIMIT_BY_WORKSPACE: limit_by_workspace,
440
466
  }
441
467
 
468
+ if kubernetes_settings is not None:
469
+ if isinstance(kubernetes_settings, KubernetesSettings):
470
+ kubernetes_settings = kubernetes_settings.to_dict()
471
+ if not isinstance(kubernetes_settings, dict):
472
+ raise TypeError(
473
+ f"kubernetes_settings must be a dict or an instance of KubernetesSettings, got {type(kubernetes_settings)}"
474
+ )
475
+ advanced_settings.update(kubernetes_settings)
476
+
442
477
  data = {
443
478
  ApiField.AGENT_ID: agent_id,
444
479
  # "nodeId": agent_id,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supervisely
3
- Version: 6.73.406
3
+ Version: 6.73.407
4
4
  Summary: Supervisely Python SDK.
5
5
  Home-page: https://github.com/supervisely/supervisely
6
6
  Author: Supervisely
@@ -23,7 +23,7 @@ supervisely/api/advanced_api.py,sha256=Nd5cCnHFWc3PSUrCtENxTGtDjS37_lCHXsgXvUI3T
23
23
  supervisely/api/agent_api.py,sha256=8EQBwD6v7KLS0-xKcZ12B7mtzKwG7RRgq1fk1vaN144,8893
24
24
  supervisely/api/annotation_api.py,sha256=U6dHUIOt6Fe8XcbX1MA19z-fg91maOumJAawKG5ZJsk,82876
25
25
  supervisely/api/api.py,sha256=pEgRIWlVqDdtDjAeL_nx2Rwldm6ANwLLacm6kLnyvbE,67723
26
- supervisely/api/app_api.py,sha256=HaltkadXqel7hFBQdwsn5Qvmrx5eEqDXUu6X98nHerk,76226
26
+ supervisely/api/app_api.py,sha256=ghhBVaxca7xO9Bgy2zbexC89BJ9s0k7fVPd6-6F_Wvw,76594
27
27
  supervisely/api/constants.py,sha256=WfqIcEpRnU4Mcfb6q0njeRs2VVSoTAJaIyrqBkBjP8I,253
28
28
  supervisely/api/dataset_api.py,sha256=7idBMFL8jumWNw-wlBAbQWC09RskG-3GlidfPDukq3Q,47930
29
29
  supervisely/api/entities_collection_api.py,sha256=Be13HsfMFLmq9XpiOfQog0Y569kbUn52hXv6x5vX3Vg,22624
@@ -44,7 +44,7 @@ supervisely/api/remote_storage_api.py,sha256=1O4rTIwW8s9gxC00yvFuKbEMGNsa7YSRlZ8
44
44
  supervisely/api/report_api.py,sha256=Om7CGulUbQ4BuJ16eDtz7luLe0JQNqab-LoLpUXu7YE,7123
45
45
  supervisely/api/role_api.py,sha256=c1XAU_wZg6zL4wG2R7iuS9EJOoaHHNGchxa1nYVL7yo,3047
46
46
  supervisely/api/storage_api.py,sha256=VxiflQt-SfyB1OuEOB66JsMkxCosUr4n0WHQ5if3Ltg,13039
47
- supervisely/api/task_api.py,sha256=eRDeUj9vexzJl_vQqW-DDYUkHaWfFqNg_EQI597RE0Y,36678
47
+ supervisely/api/task_api.py,sha256=5Ae3jKWgvvz_Mljk6V1UaIVqDbTvnSD6cpIJ3H3KqT0,38435
48
48
  supervisely/api/team_api.py,sha256=uPsBpDP_Ig9HDQ9Zm6Y-VboLbSYKIV9S_a1S7e4vqvo,19470
49
49
  supervisely/api/user_api.py,sha256=m29GP9tvem8P2fJZgg7DAZ9yhFdBX26ZBcWxCKdnhn4,24943
50
50
  supervisely/api/video_annotation_tool_api.py,sha256=3A9-U8WJzrTShP_n9T8U01M9FzGYdeS51CCBTzUnooo,6686
@@ -1114,9 +1114,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
1114
1114
  supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
1115
1115
  supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
1116
1116
  supervisely_lib/__init__.py,sha256=7-3QnN8Zf0wj8NCr2oJmqoQWMKKPKTECvjH9pd2S5vY,159
1117
- supervisely-6.73.406.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1118
- supervisely-6.73.406.dist-info/METADATA,sha256=696rYpRYkDoHehnuB_Y2ngM5dHHY_hX0qlMyiyZ9PqA,35254
1119
- supervisely-6.73.406.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1120
- supervisely-6.73.406.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1121
- supervisely-6.73.406.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1122
- supervisely-6.73.406.dist-info/RECORD,,
1117
+ supervisely-6.73.407.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1118
+ supervisely-6.73.407.dist-info/METADATA,sha256=fIR2z5kCfeQzldtPPODSuq8z4QQhOoTVLgeZRZokLtU,35254
1119
+ supervisely-6.73.407.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1120
+ supervisely-6.73.407.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1121
+ supervisely-6.73.407.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1122
+ supervisely-6.73.407.dist-info/RECORD,,