mlops-python-sdk 0.0.1__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.
Files changed (36) hide show
  1. mlops/__init__.py +46 -0
  2. mlops/api/client/__init__.py +8 -0
  3. mlops/api/client/api/__init__.py +1 -0
  4. mlops/api/client/api/tasks/__init__.py +1 -0
  5. mlops/api/client/api/tasks/cancel_task.py +196 -0
  6. mlops/api/client/api/tasks/delete_task.py +204 -0
  7. mlops/api/client/api/tasks/get_task.py +196 -0
  8. mlops/api/client/api/tasks/list_tasks.py +255 -0
  9. mlops/api/client/api/tasks/submit_task.py +188 -0
  10. mlops/api/client/client.py +268 -0
  11. mlops/api/client/errors.py +16 -0
  12. mlops/api/client/models/__init__.py +33 -0
  13. mlops/api/client/models/error_response.py +68 -0
  14. mlops/api/client/models/message_response.py +59 -0
  15. mlops/api/client/models/task.py +1629 -0
  16. mlops/api/client/models/task_alloc_tres_type_0.py +49 -0
  17. mlops/api/client/models/task_gres_detail_type_0_item.py +44 -0
  18. mlops/api/client/models/task_job_resources_type_0.py +49 -0
  19. mlops/api/client/models/task_list_response.py +102 -0
  20. mlops/api/client/models/task_resources_type_0.py +49 -0
  21. mlops/api/client/models/task_status.py +15 -0
  22. mlops/api/client/models/task_submit_request.py +640 -0
  23. mlops/api/client/models/task_submit_request_environment_type_0.py +49 -0
  24. mlops/api/client/models/task_submit_response.py +78 -0
  25. mlops/api/client/models/task_tres_type_0.py +49 -0
  26. mlops/api/client/models/task_tres_used_type_0.py +49 -0
  27. mlops/api/client/py.typed +1 -0
  28. mlops/api/client/types.py +54 -0
  29. mlops/connection_config.py +106 -0
  30. mlops/exceptions.py +82 -0
  31. mlops/task/__init__.py +10 -0
  32. mlops/task/client.py +146 -0
  33. mlops/task/task.py +464 -0
  34. mlops_python_sdk-0.0.1.dist-info/METADATA +416 -0
  35. mlops_python_sdk-0.0.1.dist-info/RECORD +36 -0
  36. mlops_python_sdk-0.0.1.dist-info/WHEEL +4 -0
@@ -0,0 +1,49 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ T = TypeVar("T", bound="TaskAllocTresType0")
8
+
9
+
10
+ @_attrs_define
11
+ class TaskAllocTresType0:
12
+ """Allocated Trackable Resources
13
+
14
+ Example:
15
+ {'cpu': 4, 'mem': 8589934592}
16
+
17
+ """
18
+
19
+ additional_properties: dict[str, int] = _attrs_field(init=False, factory=dict)
20
+
21
+ def to_dict(self) -> dict[str, Any]:
22
+ field_dict: dict[str, Any] = {}
23
+ field_dict.update(self.additional_properties)
24
+
25
+ return field_dict
26
+
27
+ @classmethod
28
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
29
+ d = dict(src_dict)
30
+ task_alloc_tres_type_0 = cls()
31
+
32
+ task_alloc_tres_type_0.additional_properties = d
33
+ return task_alloc_tres_type_0
34
+
35
+ @property
36
+ def additional_keys(self) -> list[str]:
37
+ return list(self.additional_properties.keys())
38
+
39
+ def __getitem__(self, key: str) -> int:
40
+ return self.additional_properties[key]
41
+
42
+ def __setitem__(self, key: str, value: int) -> None:
43
+ self.additional_properties[key] = value
44
+
45
+ def __delitem__(self, key: str) -> None:
46
+ del self.additional_properties[key]
47
+
48
+ def __contains__(self, key: str) -> bool:
49
+ return key in self.additional_properties
@@ -0,0 +1,44 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ T = TypeVar("T", bound="TaskGresDetailType0Item")
8
+
9
+
10
+ @_attrs_define
11
+ class TaskGresDetailType0Item:
12
+ """ """
13
+
14
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
15
+
16
+ def to_dict(self) -> dict[str, Any]:
17
+ field_dict: dict[str, Any] = {}
18
+ field_dict.update(self.additional_properties)
19
+
20
+ return field_dict
21
+
22
+ @classmethod
23
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
24
+ d = dict(src_dict)
25
+ task_gres_detail_type_0_item = cls()
26
+
27
+ task_gres_detail_type_0_item.additional_properties = d
28
+ return task_gres_detail_type_0_item
29
+
30
+ @property
31
+ def additional_keys(self) -> list[str]:
32
+ return list(self.additional_properties.keys())
33
+
34
+ def __getitem__(self, key: str) -> Any:
35
+ return self.additional_properties[key]
36
+
37
+ def __setitem__(self, key: str, value: Any) -> None:
38
+ self.additional_properties[key] = value
39
+
40
+ def __delitem__(self, key: str) -> None:
41
+ del self.additional_properties[key]
42
+
43
+ def __contains__(self, key: str) -> bool:
44
+ return key in self.additional_properties
@@ -0,0 +1,49 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ T = TypeVar("T", bound="TaskJobResourcesType0")
8
+
9
+
10
+ @_attrs_define
11
+ class TaskJobResourcesType0:
12
+ """Job resources (nodes, allocated CPUs, etc.)
13
+
14
+ Example:
15
+ {'allocated_cpus': 4, 'nodes': ['node001']}
16
+
17
+ """
18
+
19
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
20
+
21
+ def to_dict(self) -> dict[str, Any]:
22
+ field_dict: dict[str, Any] = {}
23
+ field_dict.update(self.additional_properties)
24
+
25
+ return field_dict
26
+
27
+ @classmethod
28
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
29
+ d = dict(src_dict)
30
+ task_job_resources_type_0 = cls()
31
+
32
+ task_job_resources_type_0.additional_properties = d
33
+ return task_job_resources_type_0
34
+
35
+ @property
36
+ def additional_keys(self) -> list[str]:
37
+ return list(self.additional_properties.keys())
38
+
39
+ def __getitem__(self, key: str) -> Any:
40
+ return self.additional_properties[key]
41
+
42
+ def __setitem__(self, key: str, value: Any) -> None:
43
+ self.additional_properties[key] = value
44
+
45
+ def __delitem__(self, key: str) -> None:
46
+ del self.additional_properties[key]
47
+
48
+ def __contains__(self, key: str) -> bool:
49
+ return key in self.additional_properties
@@ -0,0 +1,102 @@
1
+ from collections.abc import Mapping
2
+ from typing import TYPE_CHECKING, Any, TypeVar, Union
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ from ..types import UNSET, Unset
8
+
9
+ if TYPE_CHECKING:
10
+ from ..models.task import Task
11
+
12
+
13
+ T = TypeVar("T", bound="TaskListResponse")
14
+
15
+
16
+ @_attrs_define
17
+ class TaskListResponse:
18
+ """
19
+ Attributes:
20
+ page (Union[Unset, int]): Example: 1.
21
+ page_size (Union[Unset, int]): Example: 20.
22
+ tasks (Union[Unset, list['Task']]): List of tasks
23
+ total (Union[Unset, int]): Total number of tasks Example: 100.
24
+ """
25
+
26
+ page: Union[Unset, int] = UNSET
27
+ page_size: Union[Unset, int] = UNSET
28
+ tasks: Union[Unset, list["Task"]] = UNSET
29
+ total: Union[Unset, int] = UNSET
30
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
31
+
32
+ def to_dict(self) -> dict[str, Any]:
33
+ page = self.page
34
+
35
+ page_size = self.page_size
36
+
37
+ tasks: Union[Unset, list[dict[str, Any]]] = UNSET
38
+ if not isinstance(self.tasks, Unset):
39
+ tasks = []
40
+ for tasks_item_data in self.tasks:
41
+ tasks_item = tasks_item_data.to_dict()
42
+ tasks.append(tasks_item)
43
+
44
+ total = self.total
45
+
46
+ field_dict: dict[str, Any] = {}
47
+ field_dict.update(self.additional_properties)
48
+ field_dict.update({})
49
+ if page is not UNSET:
50
+ field_dict["page"] = page
51
+ if page_size is not UNSET:
52
+ field_dict["page_size"] = page_size
53
+ if tasks is not UNSET:
54
+ field_dict["tasks"] = tasks
55
+ if total is not UNSET:
56
+ field_dict["total"] = total
57
+
58
+ return field_dict
59
+
60
+ @classmethod
61
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
62
+ from ..models.task import Task
63
+
64
+ d = dict(src_dict)
65
+ page = d.pop("page", UNSET)
66
+
67
+ page_size = d.pop("page_size", UNSET)
68
+
69
+ tasks = []
70
+ _tasks = d.pop("tasks", UNSET)
71
+ for tasks_item_data in _tasks or []:
72
+ tasks_item = Task.from_dict(tasks_item_data)
73
+
74
+ tasks.append(tasks_item)
75
+
76
+ total = d.pop("total", UNSET)
77
+
78
+ task_list_response = cls(
79
+ page=page,
80
+ page_size=page_size,
81
+ tasks=tasks,
82
+ total=total,
83
+ )
84
+
85
+ task_list_response.additional_properties = d
86
+ return task_list_response
87
+
88
+ @property
89
+ def additional_keys(self) -> list[str]:
90
+ return list(self.additional_properties.keys())
91
+
92
+ def __getitem__(self, key: str) -> Any:
93
+ return self.additional_properties[key]
94
+
95
+ def __setitem__(self, key: str, value: Any) -> None:
96
+ self.additional_properties[key] = value
97
+
98
+ def __delitem__(self, key: str) -> None:
99
+ del self.additional_properties[key]
100
+
101
+ def __contains__(self, key: str) -> bool:
102
+ return key in self.additional_properties
@@ -0,0 +1,49 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ T = TypeVar("T", bound="TaskResourcesType0")
8
+
9
+
10
+ @_attrs_define
11
+ class TaskResourcesType0:
12
+ """Resource requirements (JSON format)
13
+
14
+ Example:
15
+ {'cpu': 4, 'gpu': 1, 'memory': '8GB'}
16
+
17
+ """
18
+
19
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
20
+
21
+ def to_dict(self) -> dict[str, Any]:
22
+ field_dict: dict[str, Any] = {}
23
+ field_dict.update(self.additional_properties)
24
+
25
+ return field_dict
26
+
27
+ @classmethod
28
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
29
+ d = dict(src_dict)
30
+ task_resources_type_0 = cls()
31
+
32
+ task_resources_type_0.additional_properties = d
33
+ return task_resources_type_0
34
+
35
+ @property
36
+ def additional_keys(self) -> list[str]:
37
+ return list(self.additional_properties.keys())
38
+
39
+ def __getitem__(self, key: str) -> Any:
40
+ return self.additional_properties[key]
41
+
42
+ def __setitem__(self, key: str, value: Any) -> None:
43
+ self.additional_properties[key] = value
44
+
45
+ def __delitem__(self, key: str) -> None:
46
+ del self.additional_properties[key]
47
+
48
+ def __contains__(self, key: str) -> bool:
49
+ return key in self.additional_properties
@@ -0,0 +1,15 @@
1
+ from enum import Enum
2
+
3
+
4
+ class TaskStatus(str, Enum):
5
+ CANCELLED = "cancelled"
6
+ COMPLETED = "completed"
7
+ CREATED = "created"
8
+ FAILED = "failed"
9
+ PENDING = "pending"
10
+ QUEUED = "queued"
11
+ RUNNING = "running"
12
+ SUCCEEDED = "succeeded"
13
+
14
+ def __str__(self) -> str:
15
+ return str(self.value)