mlops-python-sdk 0.0.1__py3-none-any.whl → 1.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.
- mlops/__init__.py +3 -3
- mlops/api/client/api/storage/__init__.py +1 -0
- mlops/api/client/api/storage/get_storage_presign_download.py +175 -0
- mlops/api/client/api/storage/get_storage_presign_upload.py +175 -0
- mlops/api/client/api/tasks/cancel_task.py +14 -14
- mlops/api/client/api/tasks/delete_task.py +14 -14
- mlops/api/client/api/tasks/get_task.py +15 -15
- mlops/api/client/api/tasks/get_task_by_task_id.py +204 -0
- mlops/api/client/api/tasks/get_task_logs.py +300 -0
- mlops/api/client/api/tasks/list_tasks.py +14 -14
- mlops/api/client/models/__init__.py +22 -0
- mlops/api/client/models/get_storage_presign_download_response_200.py +60 -0
- mlops/api/client/models/get_storage_presign_upload_response_200.py +79 -0
- mlops/api/client/models/get_task_logs_direction.py +9 -0
- mlops/api/client/models/get_task_logs_log_type.py +10 -0
- mlops/api/client/models/job_spec.py +273 -0
- mlops/api/client/models/job_spec_env.py +44 -0
- mlops/api/client/models/job_spec_master_strategy.py +8 -0
- mlops/api/client/models/log_pagination.py +90 -0
- mlops/api/client/models/task_log_entry.py +105 -0
- mlops/api/client/models/task_log_entry_log_type.py +9 -0
- mlops/api/client/models/task_logs_response.py +112 -0
- mlops/api/client/models/task_submit_request.py +24 -6
- mlops/connection_config.py +4 -11
- mlops/exceptions.py +10 -10
- mlops/task/__init__.py +1 -1
- mlops/task/client.py +11 -35
- mlops/task/task.py +186 -40
- {mlops_python_sdk-0.0.1.dist-info → mlops_python_sdk-1.0.1.dist-info}/METADATA +21 -30
- mlops_python_sdk-1.0.1.dist-info/RECORD +52 -0
- mlops_python_sdk-0.0.1.dist-info/RECORD +0 -36
- {mlops_python_sdk-0.0.1.dist-info → mlops_python_sdk-1.0.1.dist-info}/WHEEL +0 -0
|
@@ -18,7 +18,7 @@ def _get_kwargs(
|
|
|
18
18
|
status: Union[Unset, TaskStatus] = UNSET,
|
|
19
19
|
user_id: Union[Unset, int] = UNSET,
|
|
20
20
|
team_id: Union[Unset, int] = UNSET,
|
|
21
|
-
|
|
21
|
+
cluster_name: Union[Unset, str] = UNSET,
|
|
22
22
|
) -> dict[str, Any]:
|
|
23
23
|
params: dict[str, Any] = {}
|
|
24
24
|
|
|
@@ -36,7 +36,7 @@ def _get_kwargs(
|
|
|
36
36
|
|
|
37
37
|
params["team_id"] = team_id
|
|
38
38
|
|
|
39
|
-
params["
|
|
39
|
+
params["cluster_name"] = cluster_name
|
|
40
40
|
|
|
41
41
|
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
42
42
|
|
|
@@ -89,7 +89,7 @@ def sync_detailed(
|
|
|
89
89
|
status: Union[Unset, TaskStatus] = UNSET,
|
|
90
90
|
user_id: Union[Unset, int] = UNSET,
|
|
91
91
|
team_id: Union[Unset, int] = UNSET,
|
|
92
|
-
|
|
92
|
+
cluster_name: Union[Unset, str] = UNSET,
|
|
93
93
|
) -> Response[Union[ErrorResponse, TaskListResponse]]:
|
|
94
94
|
"""Get task list
|
|
95
95
|
|
|
@@ -101,7 +101,7 @@ def sync_detailed(
|
|
|
101
101
|
status (Union[Unset, TaskStatus]): Task status Example: pending.
|
|
102
102
|
user_id (Union[Unset, int]):
|
|
103
103
|
team_id (Union[Unset, int]):
|
|
104
|
-
|
|
104
|
+
cluster_name (Union[Unset, str]):
|
|
105
105
|
|
|
106
106
|
Raises:
|
|
107
107
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
@@ -117,7 +117,7 @@ def sync_detailed(
|
|
|
117
117
|
status=status,
|
|
118
118
|
user_id=user_id,
|
|
119
119
|
team_id=team_id,
|
|
120
|
-
|
|
120
|
+
cluster_name=cluster_name,
|
|
121
121
|
)
|
|
122
122
|
|
|
123
123
|
response = client.get_httpx_client().request(
|
|
@@ -135,7 +135,7 @@ def sync(
|
|
|
135
135
|
status: Union[Unset, TaskStatus] = UNSET,
|
|
136
136
|
user_id: Union[Unset, int] = UNSET,
|
|
137
137
|
team_id: Union[Unset, int] = UNSET,
|
|
138
|
-
|
|
138
|
+
cluster_name: Union[Unset, str] = UNSET,
|
|
139
139
|
) -> Optional[Union[ErrorResponse, TaskListResponse]]:
|
|
140
140
|
"""Get task list
|
|
141
141
|
|
|
@@ -147,7 +147,7 @@ def sync(
|
|
|
147
147
|
status (Union[Unset, TaskStatus]): Task status Example: pending.
|
|
148
148
|
user_id (Union[Unset, int]):
|
|
149
149
|
team_id (Union[Unset, int]):
|
|
150
|
-
|
|
150
|
+
cluster_name (Union[Unset, str]):
|
|
151
151
|
|
|
152
152
|
Raises:
|
|
153
153
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
@@ -164,7 +164,7 @@ def sync(
|
|
|
164
164
|
status=status,
|
|
165
165
|
user_id=user_id,
|
|
166
166
|
team_id=team_id,
|
|
167
|
-
|
|
167
|
+
cluster_name=cluster_name,
|
|
168
168
|
).parsed
|
|
169
169
|
|
|
170
170
|
|
|
@@ -176,7 +176,7 @@ async def asyncio_detailed(
|
|
|
176
176
|
status: Union[Unset, TaskStatus] = UNSET,
|
|
177
177
|
user_id: Union[Unset, int] = UNSET,
|
|
178
178
|
team_id: Union[Unset, int] = UNSET,
|
|
179
|
-
|
|
179
|
+
cluster_name: Union[Unset, str] = UNSET,
|
|
180
180
|
) -> Response[Union[ErrorResponse, TaskListResponse]]:
|
|
181
181
|
"""Get task list
|
|
182
182
|
|
|
@@ -188,7 +188,7 @@ async def asyncio_detailed(
|
|
|
188
188
|
status (Union[Unset, TaskStatus]): Task status Example: pending.
|
|
189
189
|
user_id (Union[Unset, int]):
|
|
190
190
|
team_id (Union[Unset, int]):
|
|
191
|
-
|
|
191
|
+
cluster_name (Union[Unset, str]):
|
|
192
192
|
|
|
193
193
|
Raises:
|
|
194
194
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
@@ -204,7 +204,7 @@ async def asyncio_detailed(
|
|
|
204
204
|
status=status,
|
|
205
205
|
user_id=user_id,
|
|
206
206
|
team_id=team_id,
|
|
207
|
-
|
|
207
|
+
cluster_name=cluster_name,
|
|
208
208
|
)
|
|
209
209
|
|
|
210
210
|
response = await client.get_async_httpx_client().request(**kwargs)
|
|
@@ -220,7 +220,7 @@ async def asyncio(
|
|
|
220
220
|
status: Union[Unset, TaskStatus] = UNSET,
|
|
221
221
|
user_id: Union[Unset, int] = UNSET,
|
|
222
222
|
team_id: Union[Unset, int] = UNSET,
|
|
223
|
-
|
|
223
|
+
cluster_name: Union[Unset, str] = UNSET,
|
|
224
224
|
) -> Optional[Union[ErrorResponse, TaskListResponse]]:
|
|
225
225
|
"""Get task list
|
|
226
226
|
|
|
@@ -232,7 +232,7 @@ async def asyncio(
|
|
|
232
232
|
status (Union[Unset, TaskStatus]): Task status Example: pending.
|
|
233
233
|
user_id (Union[Unset, int]):
|
|
234
234
|
team_id (Union[Unset, int]):
|
|
235
|
-
|
|
235
|
+
cluster_name (Union[Unset, str]):
|
|
236
236
|
|
|
237
237
|
Raises:
|
|
238
238
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
@@ -250,6 +250,6 @@ async def asyncio(
|
|
|
250
250
|
status=status,
|
|
251
251
|
user_id=user_id,
|
|
252
252
|
team_id=team_id,
|
|
253
|
-
|
|
253
|
+
cluster_name=cluster_name,
|
|
254
254
|
)
|
|
255
255
|
).parsed
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
"""Contains all the data models used in inputs/outputs"""
|
|
2
2
|
|
|
3
3
|
from .error_response import ErrorResponse
|
|
4
|
+
from .get_storage_presign_download_response_200 import GetStoragePresignDownloadResponse200
|
|
5
|
+
from .get_storage_presign_upload_response_200 import GetStoragePresignUploadResponse200
|
|
6
|
+
from .get_task_logs_direction import GetTaskLogsDirection
|
|
7
|
+
from .get_task_logs_log_type import GetTaskLogsLogType
|
|
8
|
+
from .job_spec import JobSpec
|
|
9
|
+
from .job_spec_env import JobSpecEnv
|
|
10
|
+
from .job_spec_master_strategy import JobSpecMasterStrategy
|
|
11
|
+
from .log_pagination import LogPagination
|
|
4
12
|
from .message_response import MessageResponse
|
|
5
13
|
from .task import Task
|
|
6
14
|
from .task_alloc_tres_type_0 import TaskAllocTresType0
|
|
7
15
|
from .task_gres_detail_type_0_item import TaskGresDetailType0Item
|
|
8
16
|
from .task_job_resources_type_0 import TaskJobResourcesType0
|
|
9
17
|
from .task_list_response import TaskListResponse
|
|
18
|
+
from .task_log_entry import TaskLogEntry
|
|
19
|
+
from .task_log_entry_log_type import TaskLogEntryLogType
|
|
20
|
+
from .task_logs_response import TaskLogsResponse
|
|
10
21
|
from .task_resources_type_0 import TaskResourcesType0
|
|
11
22
|
from .task_status import TaskStatus
|
|
12
23
|
from .task_submit_request import TaskSubmitRequest
|
|
@@ -17,12 +28,23 @@ from .task_tres_used_type_0 import TaskTresUsedType0
|
|
|
17
28
|
|
|
18
29
|
__all__ = (
|
|
19
30
|
"ErrorResponse",
|
|
31
|
+
"GetStoragePresignDownloadResponse200",
|
|
32
|
+
"GetStoragePresignUploadResponse200",
|
|
33
|
+
"GetTaskLogsDirection",
|
|
34
|
+
"GetTaskLogsLogType",
|
|
35
|
+
"JobSpec",
|
|
36
|
+
"JobSpecEnv",
|
|
37
|
+
"JobSpecMasterStrategy",
|
|
38
|
+
"LogPagination",
|
|
20
39
|
"MessageResponse",
|
|
21
40
|
"Task",
|
|
22
41
|
"TaskAllocTresType0",
|
|
23
42
|
"TaskGresDetailType0Item",
|
|
24
43
|
"TaskJobResourcesType0",
|
|
25
44
|
"TaskListResponse",
|
|
45
|
+
"TaskLogEntry",
|
|
46
|
+
"TaskLogEntryLogType",
|
|
47
|
+
"TaskLogsResponse",
|
|
26
48
|
"TaskResourcesType0",
|
|
27
49
|
"TaskStatus",
|
|
28
50
|
"TaskSubmitRequest",
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import 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
|
+
T = TypeVar("T", bound="GetStoragePresignDownloadResponse200")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@_attrs_define
|
|
13
|
+
class GetStoragePresignDownloadResponse200:
|
|
14
|
+
"""
|
|
15
|
+
Attributes:
|
|
16
|
+
url (Union[Unset, str]): The presigned URL for downloading the file Example:
|
|
17
|
+
https://s3.example.com/bucket/uploads/20230101/123000_1234_test.zip?signature=....
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
url: Union[Unset, str] = UNSET
|
|
21
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
22
|
+
|
|
23
|
+
def to_dict(self) -> dict[str, Any]:
|
|
24
|
+
url = self.url
|
|
25
|
+
|
|
26
|
+
field_dict: dict[str, Any] = {}
|
|
27
|
+
field_dict.update(self.additional_properties)
|
|
28
|
+
field_dict.update({})
|
|
29
|
+
if url is not UNSET:
|
|
30
|
+
field_dict["url"] = url
|
|
31
|
+
|
|
32
|
+
return field_dict
|
|
33
|
+
|
|
34
|
+
@classmethod
|
|
35
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
36
|
+
d = dict(src_dict)
|
|
37
|
+
url = d.pop("url", UNSET)
|
|
38
|
+
|
|
39
|
+
get_storage_presign_download_response_200 = cls(
|
|
40
|
+
url=url,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
get_storage_presign_download_response_200.additional_properties = d
|
|
44
|
+
return get_storage_presign_download_response_200
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def additional_keys(self) -> list[str]:
|
|
48
|
+
return list(self.additional_properties.keys())
|
|
49
|
+
|
|
50
|
+
def __getitem__(self, key: str) -> Any:
|
|
51
|
+
return self.additional_properties[key]
|
|
52
|
+
|
|
53
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
54
|
+
self.additional_properties[key] = value
|
|
55
|
+
|
|
56
|
+
def __delitem__(self, key: str) -> None:
|
|
57
|
+
del self.additional_properties[key]
|
|
58
|
+
|
|
59
|
+
def __contains__(self, key: str) -> bool:
|
|
60
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import 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
|
+
T = TypeVar("T", bound="GetStoragePresignUploadResponse200")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@_attrs_define
|
|
13
|
+
class GetStoragePresignUploadResponse200:
|
|
14
|
+
"""
|
|
15
|
+
Attributes:
|
|
16
|
+
key (Union[Unset, str]): Object key Example: uploads/20230101/123000_1234_test.zip.
|
|
17
|
+
s3_url (Union[Unset, str]): S3 URL (s3://bucket/key) in S3 Example: s3://my-
|
|
18
|
+
bucket/uploads/20230101/123000_1234_test.zip.
|
|
19
|
+
url (Union[Unset, str]): The presigned URL for uploading the file Example:
|
|
20
|
+
https://s3.example.com/bucket/uploads/20230101/123000_1234_test.zip?signature=....
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
key: Union[Unset, str] = UNSET
|
|
24
|
+
s3_url: Union[Unset, str] = UNSET
|
|
25
|
+
url: Union[Unset, str] = UNSET
|
|
26
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
27
|
+
|
|
28
|
+
def to_dict(self) -> dict[str, Any]:
|
|
29
|
+
key = self.key
|
|
30
|
+
|
|
31
|
+
s3_url = self.s3_url
|
|
32
|
+
|
|
33
|
+
url = self.url
|
|
34
|
+
|
|
35
|
+
field_dict: dict[str, Any] = {}
|
|
36
|
+
field_dict.update(self.additional_properties)
|
|
37
|
+
field_dict.update({})
|
|
38
|
+
if key is not UNSET:
|
|
39
|
+
field_dict["key"] = key
|
|
40
|
+
if s3_url is not UNSET:
|
|
41
|
+
field_dict["s3_url"] = s3_url
|
|
42
|
+
if url is not UNSET:
|
|
43
|
+
field_dict["url"] = url
|
|
44
|
+
|
|
45
|
+
return field_dict
|
|
46
|
+
|
|
47
|
+
@classmethod
|
|
48
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
49
|
+
d = dict(src_dict)
|
|
50
|
+
key = d.pop("key", UNSET)
|
|
51
|
+
|
|
52
|
+
s3_url = d.pop("s3_url", UNSET)
|
|
53
|
+
|
|
54
|
+
url = d.pop("url", UNSET)
|
|
55
|
+
|
|
56
|
+
get_storage_presign_upload_response_200 = cls(
|
|
57
|
+
key=key,
|
|
58
|
+
s3_url=s3_url,
|
|
59
|
+
url=url,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
get_storage_presign_upload_response_200.additional_properties = d
|
|
63
|
+
return get_storage_presign_upload_response_200
|
|
64
|
+
|
|
65
|
+
@property
|
|
66
|
+
def additional_keys(self) -> list[str]:
|
|
67
|
+
return list(self.additional_properties.keys())
|
|
68
|
+
|
|
69
|
+
def __getitem__(self, key: str) -> Any:
|
|
70
|
+
return self.additional_properties[key]
|
|
71
|
+
|
|
72
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
73
|
+
self.additional_properties[key] = value
|
|
74
|
+
|
|
75
|
+
def __delitem__(self, key: str) -> None:
|
|
76
|
+
del self.additional_properties[key]
|
|
77
|
+
|
|
78
|
+
def __contains__(self, key: str) -> bool:
|
|
79
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
from attrs import field as _attrs_field
|
|
6
|
+
|
|
7
|
+
from ..models.job_spec_master_strategy import JobSpecMasterStrategy
|
|
8
|
+
from ..types import UNSET, Unset
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from ..models.job_spec_env import JobSpecEnv
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
T = TypeVar("T", bound="JobSpec")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@_attrs_define
|
|
18
|
+
class JobSpec:
|
|
19
|
+
"""Domain-specific job specification (rendered into slurm script)
|
|
20
|
+
|
|
21
|
+
Attributes:
|
|
22
|
+
artifact_dir (Union[Unset, str]): Artifacts directory
|
|
23
|
+
cpus_per_task (Union[Unset, int]): CPUs per task
|
|
24
|
+
env (Union[Unset, JobSpecEnv]): Environment variables
|
|
25
|
+
gpus_per_node (Union[Unset, int]): GPUs per node
|
|
26
|
+
log_dir (Union[Unset, str]): Logs directory
|
|
27
|
+
master_strategy (Union[Unset, JobSpecMasterStrategy]): Strategy for master node selection Default:
|
|
28
|
+
JobSpecMasterStrategy.FIRST_NODE.
|
|
29
|
+
mem (Union[Unset, str]): Memory requirement (e.g., "8G")
|
|
30
|
+
mounts (Union[Unset, list[str]]): Container mounts (e.g., ["/path1:/path1"])
|
|
31
|
+
nodes (Union[Unset, int]): Number of nodes
|
|
32
|
+
num_tool_workers (Union[Unset, int]): Number of tool workers
|
|
33
|
+
num_train_workers (Union[Unset, int]): Number of training workers
|
|
34
|
+
partition (Union[Unset, str]): Partition name
|
|
35
|
+
proxy_image (Union[Unset, str]): Proxy container image
|
|
36
|
+
qos (Union[Unset, str]): Quality of Service
|
|
37
|
+
run_dir (Union[Unset, str]): Run directory
|
|
38
|
+
time (Union[Unset, str]): Time limit
|
|
39
|
+
tool_image (Union[Unset, str]): Tooling container image
|
|
40
|
+
tool_master_cmd (Union[Unset, str]): Tooling master command
|
|
41
|
+
tool_worker_cmd (Union[Unset, str]): Tooling worker command
|
|
42
|
+
train_image (Union[Unset, str]): Training container image
|
|
43
|
+
train_master_cmd (Union[Unset, str]): Training master command
|
|
44
|
+
train_worker_cmd (Union[Unset, str]): Training worker command
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
artifact_dir: Union[Unset, str] = UNSET
|
|
48
|
+
cpus_per_task: Union[Unset, int] = UNSET
|
|
49
|
+
env: Union[Unset, "JobSpecEnv"] = UNSET
|
|
50
|
+
gpus_per_node: Union[Unset, int] = UNSET
|
|
51
|
+
log_dir: Union[Unset, str] = UNSET
|
|
52
|
+
master_strategy: Union[Unset, JobSpecMasterStrategy] = JobSpecMasterStrategy.FIRST_NODE
|
|
53
|
+
mem: Union[Unset, str] = UNSET
|
|
54
|
+
mounts: Union[Unset, list[str]] = UNSET
|
|
55
|
+
nodes: Union[Unset, int] = UNSET
|
|
56
|
+
num_tool_workers: Union[Unset, int] = UNSET
|
|
57
|
+
num_train_workers: Union[Unset, int] = UNSET
|
|
58
|
+
partition: Union[Unset, str] = UNSET
|
|
59
|
+
proxy_image: Union[Unset, str] = UNSET
|
|
60
|
+
qos: Union[Unset, str] = UNSET
|
|
61
|
+
run_dir: Union[Unset, str] = UNSET
|
|
62
|
+
time: Union[Unset, str] = UNSET
|
|
63
|
+
tool_image: Union[Unset, str] = UNSET
|
|
64
|
+
tool_master_cmd: Union[Unset, str] = UNSET
|
|
65
|
+
tool_worker_cmd: Union[Unset, str] = UNSET
|
|
66
|
+
train_image: Union[Unset, str] = UNSET
|
|
67
|
+
train_master_cmd: Union[Unset, str] = UNSET
|
|
68
|
+
train_worker_cmd: Union[Unset, str] = UNSET
|
|
69
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
70
|
+
|
|
71
|
+
def to_dict(self) -> dict[str, Any]:
|
|
72
|
+
artifact_dir = self.artifact_dir
|
|
73
|
+
|
|
74
|
+
cpus_per_task = self.cpus_per_task
|
|
75
|
+
|
|
76
|
+
env: Union[Unset, dict[str, Any]] = UNSET
|
|
77
|
+
if not isinstance(self.env, Unset):
|
|
78
|
+
env = self.env.to_dict()
|
|
79
|
+
|
|
80
|
+
gpus_per_node = self.gpus_per_node
|
|
81
|
+
|
|
82
|
+
log_dir = self.log_dir
|
|
83
|
+
|
|
84
|
+
master_strategy: Union[Unset, str] = UNSET
|
|
85
|
+
if not isinstance(self.master_strategy, Unset):
|
|
86
|
+
master_strategy = self.master_strategy.value
|
|
87
|
+
|
|
88
|
+
mem = self.mem
|
|
89
|
+
|
|
90
|
+
mounts: Union[Unset, list[str]] = UNSET
|
|
91
|
+
if not isinstance(self.mounts, Unset):
|
|
92
|
+
mounts = self.mounts
|
|
93
|
+
|
|
94
|
+
nodes = self.nodes
|
|
95
|
+
|
|
96
|
+
num_tool_workers = self.num_tool_workers
|
|
97
|
+
|
|
98
|
+
num_train_workers = self.num_train_workers
|
|
99
|
+
|
|
100
|
+
partition = self.partition
|
|
101
|
+
|
|
102
|
+
proxy_image = self.proxy_image
|
|
103
|
+
|
|
104
|
+
qos = self.qos
|
|
105
|
+
|
|
106
|
+
run_dir = self.run_dir
|
|
107
|
+
|
|
108
|
+
time = self.time
|
|
109
|
+
|
|
110
|
+
tool_image = self.tool_image
|
|
111
|
+
|
|
112
|
+
tool_master_cmd = self.tool_master_cmd
|
|
113
|
+
|
|
114
|
+
tool_worker_cmd = self.tool_worker_cmd
|
|
115
|
+
|
|
116
|
+
train_image = self.train_image
|
|
117
|
+
|
|
118
|
+
train_master_cmd = self.train_master_cmd
|
|
119
|
+
|
|
120
|
+
train_worker_cmd = self.train_worker_cmd
|
|
121
|
+
|
|
122
|
+
field_dict: dict[str, Any] = {}
|
|
123
|
+
field_dict.update(self.additional_properties)
|
|
124
|
+
field_dict.update({})
|
|
125
|
+
if artifact_dir is not UNSET:
|
|
126
|
+
field_dict["artifact_dir"] = artifact_dir
|
|
127
|
+
if cpus_per_task is not UNSET:
|
|
128
|
+
field_dict["cpus_per_task"] = cpus_per_task
|
|
129
|
+
if env is not UNSET:
|
|
130
|
+
field_dict["env"] = env
|
|
131
|
+
if gpus_per_node is not UNSET:
|
|
132
|
+
field_dict["gpus_per_node"] = gpus_per_node
|
|
133
|
+
if log_dir is not UNSET:
|
|
134
|
+
field_dict["log_dir"] = log_dir
|
|
135
|
+
if master_strategy is not UNSET:
|
|
136
|
+
field_dict["master_strategy"] = master_strategy
|
|
137
|
+
if mem is not UNSET:
|
|
138
|
+
field_dict["mem"] = mem
|
|
139
|
+
if mounts is not UNSET:
|
|
140
|
+
field_dict["mounts"] = mounts
|
|
141
|
+
if nodes is not UNSET:
|
|
142
|
+
field_dict["nodes"] = nodes
|
|
143
|
+
if num_tool_workers is not UNSET:
|
|
144
|
+
field_dict["num_tool_workers"] = num_tool_workers
|
|
145
|
+
if num_train_workers is not UNSET:
|
|
146
|
+
field_dict["num_train_workers"] = num_train_workers
|
|
147
|
+
if partition is not UNSET:
|
|
148
|
+
field_dict["partition"] = partition
|
|
149
|
+
if proxy_image is not UNSET:
|
|
150
|
+
field_dict["proxy_image"] = proxy_image
|
|
151
|
+
if qos is not UNSET:
|
|
152
|
+
field_dict["qos"] = qos
|
|
153
|
+
if run_dir is not UNSET:
|
|
154
|
+
field_dict["run_dir"] = run_dir
|
|
155
|
+
if time is not UNSET:
|
|
156
|
+
field_dict["time"] = time
|
|
157
|
+
if tool_image is not UNSET:
|
|
158
|
+
field_dict["tool_image"] = tool_image
|
|
159
|
+
if tool_master_cmd is not UNSET:
|
|
160
|
+
field_dict["tool_master_cmd"] = tool_master_cmd
|
|
161
|
+
if tool_worker_cmd is not UNSET:
|
|
162
|
+
field_dict["tool_worker_cmd"] = tool_worker_cmd
|
|
163
|
+
if train_image is not UNSET:
|
|
164
|
+
field_dict["train_image"] = train_image
|
|
165
|
+
if train_master_cmd is not UNSET:
|
|
166
|
+
field_dict["train_master_cmd"] = train_master_cmd
|
|
167
|
+
if train_worker_cmd is not UNSET:
|
|
168
|
+
field_dict["train_worker_cmd"] = train_worker_cmd
|
|
169
|
+
|
|
170
|
+
return field_dict
|
|
171
|
+
|
|
172
|
+
@classmethod
|
|
173
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
174
|
+
from ..models.job_spec_env import JobSpecEnv
|
|
175
|
+
|
|
176
|
+
d = dict(src_dict)
|
|
177
|
+
artifact_dir = d.pop("artifact_dir", UNSET)
|
|
178
|
+
|
|
179
|
+
cpus_per_task = d.pop("cpus_per_task", UNSET)
|
|
180
|
+
|
|
181
|
+
_env = d.pop("env", UNSET)
|
|
182
|
+
env: Union[Unset, JobSpecEnv]
|
|
183
|
+
if isinstance(_env, Unset):
|
|
184
|
+
env = UNSET
|
|
185
|
+
else:
|
|
186
|
+
env = JobSpecEnv.from_dict(_env)
|
|
187
|
+
|
|
188
|
+
gpus_per_node = d.pop("gpus_per_node", UNSET)
|
|
189
|
+
|
|
190
|
+
log_dir = d.pop("log_dir", UNSET)
|
|
191
|
+
|
|
192
|
+
_master_strategy = d.pop("master_strategy", UNSET)
|
|
193
|
+
master_strategy: Union[Unset, JobSpecMasterStrategy]
|
|
194
|
+
if isinstance(_master_strategy, Unset):
|
|
195
|
+
master_strategy = UNSET
|
|
196
|
+
else:
|
|
197
|
+
master_strategy = JobSpecMasterStrategy(_master_strategy)
|
|
198
|
+
|
|
199
|
+
mem = d.pop("mem", UNSET)
|
|
200
|
+
|
|
201
|
+
mounts = cast(list[str], d.pop("mounts", UNSET))
|
|
202
|
+
|
|
203
|
+
nodes = d.pop("nodes", UNSET)
|
|
204
|
+
|
|
205
|
+
num_tool_workers = d.pop("num_tool_workers", UNSET)
|
|
206
|
+
|
|
207
|
+
num_train_workers = d.pop("num_train_workers", UNSET)
|
|
208
|
+
|
|
209
|
+
partition = d.pop("partition", UNSET)
|
|
210
|
+
|
|
211
|
+
proxy_image = d.pop("proxy_image", UNSET)
|
|
212
|
+
|
|
213
|
+
qos = d.pop("qos", UNSET)
|
|
214
|
+
|
|
215
|
+
run_dir = d.pop("run_dir", UNSET)
|
|
216
|
+
|
|
217
|
+
time = d.pop("time", UNSET)
|
|
218
|
+
|
|
219
|
+
tool_image = d.pop("tool_image", UNSET)
|
|
220
|
+
|
|
221
|
+
tool_master_cmd = d.pop("tool_master_cmd", UNSET)
|
|
222
|
+
|
|
223
|
+
tool_worker_cmd = d.pop("tool_worker_cmd", UNSET)
|
|
224
|
+
|
|
225
|
+
train_image = d.pop("train_image", UNSET)
|
|
226
|
+
|
|
227
|
+
train_master_cmd = d.pop("train_master_cmd", UNSET)
|
|
228
|
+
|
|
229
|
+
train_worker_cmd = d.pop("train_worker_cmd", UNSET)
|
|
230
|
+
|
|
231
|
+
job_spec = cls(
|
|
232
|
+
artifact_dir=artifact_dir,
|
|
233
|
+
cpus_per_task=cpus_per_task,
|
|
234
|
+
env=env,
|
|
235
|
+
gpus_per_node=gpus_per_node,
|
|
236
|
+
log_dir=log_dir,
|
|
237
|
+
master_strategy=master_strategy,
|
|
238
|
+
mem=mem,
|
|
239
|
+
mounts=mounts,
|
|
240
|
+
nodes=nodes,
|
|
241
|
+
num_tool_workers=num_tool_workers,
|
|
242
|
+
num_train_workers=num_train_workers,
|
|
243
|
+
partition=partition,
|
|
244
|
+
proxy_image=proxy_image,
|
|
245
|
+
qos=qos,
|
|
246
|
+
run_dir=run_dir,
|
|
247
|
+
time=time,
|
|
248
|
+
tool_image=tool_image,
|
|
249
|
+
tool_master_cmd=tool_master_cmd,
|
|
250
|
+
tool_worker_cmd=tool_worker_cmd,
|
|
251
|
+
train_image=train_image,
|
|
252
|
+
train_master_cmd=train_master_cmd,
|
|
253
|
+
train_worker_cmd=train_worker_cmd,
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
job_spec.additional_properties = d
|
|
257
|
+
return job_spec
|
|
258
|
+
|
|
259
|
+
@property
|
|
260
|
+
def additional_keys(self) -> list[str]:
|
|
261
|
+
return list(self.additional_properties.keys())
|
|
262
|
+
|
|
263
|
+
def __getitem__(self, key: str) -> Any:
|
|
264
|
+
return self.additional_properties[key]
|
|
265
|
+
|
|
266
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
267
|
+
self.additional_properties[key] = value
|
|
268
|
+
|
|
269
|
+
def __delitem__(self, key: str) -> None:
|
|
270
|
+
del self.additional_properties[key]
|
|
271
|
+
|
|
272
|
+
def __contains__(self, key: str) -> bool:
|
|
273
|
+
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="JobSpecEnv")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@_attrs_define
|
|
11
|
+
class JobSpecEnv:
|
|
12
|
+
"""Environment variables"""
|
|
13
|
+
|
|
14
|
+
additional_properties: dict[str, str] = _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
|
+
job_spec_env = cls()
|
|
26
|
+
|
|
27
|
+
job_spec_env.additional_properties = d
|
|
28
|
+
return job_spec_env
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
def additional_keys(self) -> list[str]:
|
|
32
|
+
return list(self.additional_properties.keys())
|
|
33
|
+
|
|
34
|
+
def __getitem__(self, key: str) -> str:
|
|
35
|
+
return self.additional_properties[key]
|
|
36
|
+
|
|
37
|
+
def __setitem__(self, key: str, value: str) -> 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
|