mlops-python-sdk 1.0.0__py3-none-any.whl → 1.0.2__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 (30) hide show
  1. mlops/__init__.py +3 -3
  2. mlops/api/client/api/storage/__init__.py +1 -0
  3. mlops/api/client/api/storage/get_storage_presign_download.py +175 -0
  4. mlops/api/client/api/storage/get_storage_presign_upload.py +175 -0
  5. mlops/api/client/api/tasks/cancel_task.py +14 -14
  6. mlops/api/client/api/tasks/delete_task.py +14 -14
  7. mlops/api/client/api/tasks/get_task.py +15 -15
  8. mlops/api/client/api/tasks/get_task_by_task_id.py +204 -0
  9. mlops/api/client/api/tasks/get_task_logs.py +300 -0
  10. mlops/api/client/api/tasks/list_tasks.py +14 -14
  11. mlops/api/client/models/__init__.py +16 -0
  12. mlops/api/client/models/get_storage_presign_download_response_200.py +60 -0
  13. mlops/api/client/models/get_storage_presign_upload_response_200.py +79 -0
  14. mlops/api/client/models/get_task_logs_direction.py +9 -0
  15. mlops/api/client/models/get_task_logs_log_type.py +10 -0
  16. mlops/api/client/models/log_pagination.py +90 -0
  17. mlops/api/client/models/task_log_entry.py +105 -0
  18. mlops/api/client/models/task_log_entry_log_type.py +9 -0
  19. mlops/api/client/models/task_logs_response.py +112 -0
  20. mlops/api/client/models/task_submit_request.py +50 -6
  21. mlops/connection_config.py +2 -9
  22. mlops/exceptions.py +10 -10
  23. mlops/task/__init__.py +1 -1
  24. mlops/task/client.py +11 -35
  25. mlops/task/task.py +194 -64
  26. mlops_python_sdk-1.0.2.dist-info/METADATA +254 -0
  27. mlops_python_sdk-1.0.2.dist-info/RECORD +52 -0
  28. mlops_python_sdk-1.0.0.dist-info/METADATA +0 -416
  29. mlops_python_sdk-1.0.0.dist-info/RECORD +0 -39
  30. {mlops_python_sdk-1.0.0.dist-info → mlops_python_sdk-1.0.2.dist-info}/WHEEL +0 -0
mlops/__init__.py CHANGED
@@ -1,5 +1,5 @@
1
1
  """
2
- XClient Python SDK for accessing XCloud Service API.
2
+ MLOps Python SDK for accessing MLOps API.
3
3
 
4
4
  This package provides a client library for interacting with the XCloud Service API.
5
5
  """
@@ -10,7 +10,7 @@ from .connection_config import (
10
10
  ProxyTypes,
11
11
  )
12
12
  from .exceptions import (
13
- XClientException,
13
+ MLOpsException,
14
14
  TimeoutException,
15
15
  NotFoundException,
16
16
  AuthenticationException,
@@ -29,7 +29,7 @@ __all__ = [
29
29
  "ConnectionConfig",
30
30
  "ProxyTypes",
31
31
  # Exceptions
32
- "XClientException",
32
+ "MLOpsException",
33
33
  "TimeoutException",
34
34
  "NotFoundException",
35
35
  "AuthenticationException",
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,175 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.error_response import ErrorResponse
9
+ from ...models.get_storage_presign_download_response_200 import GetStoragePresignDownloadResponse200
10
+ from ...types import UNSET, Response
11
+
12
+
13
+ def _get_kwargs(
14
+ *,
15
+ key: str,
16
+ ) -> dict[str, Any]:
17
+ params: dict[str, Any] = {}
18
+
19
+ params["key"] = key
20
+
21
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
22
+
23
+ _kwargs: dict[str, Any] = {
24
+ "method": "get",
25
+ "url": "/storage/presign_download",
26
+ "params": params,
27
+ }
28
+
29
+ return _kwargs
30
+
31
+
32
+ def _parse_response(
33
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
34
+ ) -> Optional[Union[ErrorResponse, GetStoragePresignDownloadResponse200]]:
35
+ if response.status_code == 200:
36
+ response_200 = GetStoragePresignDownloadResponse200.from_dict(response.json())
37
+
38
+ return response_200
39
+ if response.status_code == 400:
40
+ response_400 = ErrorResponse.from_dict(response.json())
41
+
42
+ return response_400
43
+ if response.status_code == 500:
44
+ response_500 = ErrorResponse.from_dict(response.json())
45
+
46
+ return response_500
47
+ if client.raise_on_unexpected_status:
48
+ raise errors.UnexpectedStatus(response.status_code, response.content)
49
+ else:
50
+ return None
51
+
52
+
53
+ def _build_response(
54
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
55
+ ) -> Response[Union[ErrorResponse, GetStoragePresignDownloadResponse200]]:
56
+ return Response(
57
+ status_code=HTTPStatus(response.status_code),
58
+ content=response.content,
59
+ headers=response.headers,
60
+ parsed=_parse_response(client=client, response=response),
61
+ )
62
+
63
+
64
+ def sync_detailed(
65
+ *,
66
+ client: AuthenticatedClient,
67
+ key: str,
68
+ ) -> Response[Union[ErrorResponse, GetStoragePresignDownloadResponse200]]:
69
+ """Get presigned URL for file download
70
+
71
+ Generates a presigned URL for downloading a file from S3.
72
+
73
+ Args:
74
+ key (str):
75
+
76
+ Raises:
77
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
78
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
79
+
80
+ Returns:
81
+ Response[Union[ErrorResponse, GetStoragePresignDownloadResponse200]]
82
+ """
83
+
84
+ kwargs = _get_kwargs(
85
+ key=key,
86
+ )
87
+
88
+ response = client.get_httpx_client().request(
89
+ **kwargs,
90
+ )
91
+
92
+ return _build_response(client=client, response=response)
93
+
94
+
95
+ def sync(
96
+ *,
97
+ client: AuthenticatedClient,
98
+ key: str,
99
+ ) -> Optional[Union[ErrorResponse, GetStoragePresignDownloadResponse200]]:
100
+ """Get presigned URL for file download
101
+
102
+ Generates a presigned URL for downloading a file from S3.
103
+
104
+ Args:
105
+ key (str):
106
+
107
+ Raises:
108
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
109
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
110
+
111
+ Returns:
112
+ Union[ErrorResponse, GetStoragePresignDownloadResponse200]
113
+ """
114
+
115
+ return sync_detailed(
116
+ client=client,
117
+ key=key,
118
+ ).parsed
119
+
120
+
121
+ async def asyncio_detailed(
122
+ *,
123
+ client: AuthenticatedClient,
124
+ key: str,
125
+ ) -> Response[Union[ErrorResponse, GetStoragePresignDownloadResponse200]]:
126
+ """Get presigned URL for file download
127
+
128
+ Generates a presigned URL for downloading a file from S3.
129
+
130
+ Args:
131
+ key (str):
132
+
133
+ Raises:
134
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
135
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
136
+
137
+ Returns:
138
+ Response[Union[ErrorResponse, GetStoragePresignDownloadResponse200]]
139
+ """
140
+
141
+ kwargs = _get_kwargs(
142
+ key=key,
143
+ )
144
+
145
+ response = await client.get_async_httpx_client().request(**kwargs)
146
+
147
+ return _build_response(client=client, response=response)
148
+
149
+
150
+ async def asyncio(
151
+ *,
152
+ client: AuthenticatedClient,
153
+ key: str,
154
+ ) -> Optional[Union[ErrorResponse, GetStoragePresignDownloadResponse200]]:
155
+ """Get presigned URL for file download
156
+
157
+ Generates a presigned URL for downloading a file from S3.
158
+
159
+ Args:
160
+ key (str):
161
+
162
+ Raises:
163
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
164
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
165
+
166
+ Returns:
167
+ Union[ErrorResponse, GetStoragePresignDownloadResponse200]
168
+ """
169
+
170
+ return (
171
+ await asyncio_detailed(
172
+ client=client,
173
+ key=key,
174
+ )
175
+ ).parsed
@@ -0,0 +1,175 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.error_response import ErrorResponse
9
+ from ...models.get_storage_presign_upload_response_200 import GetStoragePresignUploadResponse200
10
+ from ...types import UNSET, Response
11
+
12
+
13
+ def _get_kwargs(
14
+ *,
15
+ filename: str,
16
+ ) -> dict[str, Any]:
17
+ params: dict[str, Any] = {}
18
+
19
+ params["filename"] = filename
20
+
21
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
22
+
23
+ _kwargs: dict[str, Any] = {
24
+ "method": "get",
25
+ "url": "/storage/presign_upload",
26
+ "params": params,
27
+ }
28
+
29
+ return _kwargs
30
+
31
+
32
+ def _parse_response(
33
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
34
+ ) -> Optional[Union[ErrorResponse, GetStoragePresignUploadResponse200]]:
35
+ if response.status_code == 200:
36
+ response_200 = GetStoragePresignUploadResponse200.from_dict(response.json())
37
+
38
+ return response_200
39
+ if response.status_code == 400:
40
+ response_400 = ErrorResponse.from_dict(response.json())
41
+
42
+ return response_400
43
+ if response.status_code == 500:
44
+ response_500 = ErrorResponse.from_dict(response.json())
45
+
46
+ return response_500
47
+ if client.raise_on_unexpected_status:
48
+ raise errors.UnexpectedStatus(response.status_code, response.content)
49
+ else:
50
+ return None
51
+
52
+
53
+ def _build_response(
54
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
55
+ ) -> Response[Union[ErrorResponse, GetStoragePresignUploadResponse200]]:
56
+ return Response(
57
+ status_code=HTTPStatus(response.status_code),
58
+ content=response.content,
59
+ headers=response.headers,
60
+ parsed=_parse_response(client=client, response=response),
61
+ )
62
+
63
+
64
+ def sync_detailed(
65
+ *,
66
+ client: AuthenticatedClient,
67
+ filename: str,
68
+ ) -> Response[Union[ErrorResponse, GetStoragePresignUploadResponse200]]:
69
+ """Get presigned URL for file upload
70
+
71
+ Generates a presigned URL for uploading a file to S3.
72
+
73
+ Args:
74
+ filename (str):
75
+
76
+ Raises:
77
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
78
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
79
+
80
+ Returns:
81
+ Response[Union[ErrorResponse, GetStoragePresignUploadResponse200]]
82
+ """
83
+
84
+ kwargs = _get_kwargs(
85
+ filename=filename,
86
+ )
87
+
88
+ response = client.get_httpx_client().request(
89
+ **kwargs,
90
+ )
91
+
92
+ return _build_response(client=client, response=response)
93
+
94
+
95
+ def sync(
96
+ *,
97
+ client: AuthenticatedClient,
98
+ filename: str,
99
+ ) -> Optional[Union[ErrorResponse, GetStoragePresignUploadResponse200]]:
100
+ """Get presigned URL for file upload
101
+
102
+ Generates a presigned URL for uploading a file to S3.
103
+
104
+ Args:
105
+ filename (str):
106
+
107
+ Raises:
108
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
109
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
110
+
111
+ Returns:
112
+ Union[ErrorResponse, GetStoragePresignUploadResponse200]
113
+ """
114
+
115
+ return sync_detailed(
116
+ client=client,
117
+ filename=filename,
118
+ ).parsed
119
+
120
+
121
+ async def asyncio_detailed(
122
+ *,
123
+ client: AuthenticatedClient,
124
+ filename: str,
125
+ ) -> Response[Union[ErrorResponse, GetStoragePresignUploadResponse200]]:
126
+ """Get presigned URL for file upload
127
+
128
+ Generates a presigned URL for uploading a file to S3.
129
+
130
+ Args:
131
+ filename (str):
132
+
133
+ Raises:
134
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
135
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
136
+
137
+ Returns:
138
+ Response[Union[ErrorResponse, GetStoragePresignUploadResponse200]]
139
+ """
140
+
141
+ kwargs = _get_kwargs(
142
+ filename=filename,
143
+ )
144
+
145
+ response = await client.get_async_httpx_client().request(**kwargs)
146
+
147
+ return _build_response(client=client, response=response)
148
+
149
+
150
+ async def asyncio(
151
+ *,
152
+ client: AuthenticatedClient,
153
+ filename: str,
154
+ ) -> Optional[Union[ErrorResponse, GetStoragePresignUploadResponse200]]:
155
+ """Get presigned URL for file upload
156
+
157
+ Generates a presigned URL for uploading a file to S3.
158
+
159
+ Args:
160
+ filename (str):
161
+
162
+ Raises:
163
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
164
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
165
+
166
+ Returns:
167
+ Union[ErrorResponse, GetStoragePresignUploadResponse200]
168
+ """
169
+
170
+ return (
171
+ await asyncio_detailed(
172
+ client=client,
173
+ filename=filename,
174
+ )
175
+ ).parsed
@@ -13,11 +13,11 @@ from ...types import UNSET, Response
13
13
  def _get_kwargs(
14
14
  id: int,
15
15
  *,
16
- cluster_id: int,
16
+ cluster_name: str,
17
17
  ) -> dict[str, Any]:
18
18
  params: dict[str, Any] = {}
19
19
 
20
- params["cluster_id"] = cluster_id
20
+ params["cluster_name"] = cluster_name
21
21
 
22
22
  params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
23
23
 
@@ -74,7 +74,7 @@ def sync_detailed(
74
74
  id: int,
75
75
  *,
76
76
  client: AuthenticatedClient,
77
- cluster_id: int,
77
+ cluster_name: str,
78
78
  ) -> Response[Union[ErrorResponse, MessageResponse]]:
79
79
  """Cancel task
80
80
 
@@ -82,7 +82,7 @@ def sync_detailed(
82
82
 
83
83
  Args:
84
84
  id (int):
85
- cluster_id (int):
85
+ cluster_name (str):
86
86
 
87
87
  Raises:
88
88
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -94,7 +94,7 @@ def sync_detailed(
94
94
 
95
95
  kwargs = _get_kwargs(
96
96
  id=id,
97
- cluster_id=cluster_id,
97
+ cluster_name=cluster_name,
98
98
  )
99
99
 
100
100
  response = client.get_httpx_client().request(
@@ -108,7 +108,7 @@ def sync(
108
108
  id: int,
109
109
  *,
110
110
  client: AuthenticatedClient,
111
- cluster_id: int,
111
+ cluster_name: str,
112
112
  ) -> Optional[Union[ErrorResponse, MessageResponse]]:
113
113
  """Cancel task
114
114
 
@@ -116,7 +116,7 @@ def sync(
116
116
 
117
117
  Args:
118
118
  id (int):
119
- cluster_id (int):
119
+ cluster_name (str):
120
120
 
121
121
  Raises:
122
122
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -129,7 +129,7 @@ def sync(
129
129
  return sync_detailed(
130
130
  id=id,
131
131
  client=client,
132
- cluster_id=cluster_id,
132
+ cluster_name=cluster_name,
133
133
  ).parsed
134
134
 
135
135
 
@@ -137,7 +137,7 @@ async def asyncio_detailed(
137
137
  id: int,
138
138
  *,
139
139
  client: AuthenticatedClient,
140
- cluster_id: int,
140
+ cluster_name: str,
141
141
  ) -> Response[Union[ErrorResponse, MessageResponse]]:
142
142
  """Cancel task
143
143
 
@@ -145,7 +145,7 @@ async def asyncio_detailed(
145
145
 
146
146
  Args:
147
147
  id (int):
148
- cluster_id (int):
148
+ cluster_name (str):
149
149
 
150
150
  Raises:
151
151
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -157,7 +157,7 @@ async def asyncio_detailed(
157
157
 
158
158
  kwargs = _get_kwargs(
159
159
  id=id,
160
- cluster_id=cluster_id,
160
+ cluster_name=cluster_name,
161
161
  )
162
162
 
163
163
  response = await client.get_async_httpx_client().request(**kwargs)
@@ -169,7 +169,7 @@ async def asyncio(
169
169
  id: int,
170
170
  *,
171
171
  client: AuthenticatedClient,
172
- cluster_id: int,
172
+ cluster_name: str,
173
173
  ) -> Optional[Union[ErrorResponse, MessageResponse]]:
174
174
  """Cancel task
175
175
 
@@ -177,7 +177,7 @@ async def asyncio(
177
177
 
178
178
  Args:
179
179
  id (int):
180
- cluster_id (int):
180
+ cluster_name (str):
181
181
 
182
182
  Raises:
183
183
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -191,6 +191,6 @@ async def asyncio(
191
191
  await asyncio_detailed(
192
192
  id=id,
193
193
  client=client,
194
- cluster_id=cluster_id,
194
+ cluster_name=cluster_name,
195
195
  )
196
196
  ).parsed
@@ -13,11 +13,11 @@ from ...types import UNSET, Response
13
13
  def _get_kwargs(
14
14
  id: int,
15
15
  *,
16
- cluster_id: int,
16
+ cluster_name: str,
17
17
  ) -> dict[str, Any]:
18
18
  params: dict[str, Any] = {}
19
19
 
20
- params["cluster_id"] = cluster_id
20
+ params["cluster_name"] = cluster_name
21
21
 
22
22
  params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
23
23
 
@@ -78,7 +78,7 @@ def sync_detailed(
78
78
  id: int,
79
79
  *,
80
80
  client: AuthenticatedClient,
81
- cluster_id: int,
81
+ cluster_name: str,
82
82
  ) -> Response[Union[ErrorResponse, MessageResponse]]:
83
83
  """Delete task record
84
84
 
@@ -87,7 +87,7 @@ def sync_detailed(
87
87
 
88
88
  Args:
89
89
  id (int):
90
- cluster_id (int):
90
+ cluster_name (str):
91
91
 
92
92
  Raises:
93
93
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -99,7 +99,7 @@ def sync_detailed(
99
99
 
100
100
  kwargs = _get_kwargs(
101
101
  id=id,
102
- cluster_id=cluster_id,
102
+ cluster_name=cluster_name,
103
103
  )
104
104
 
105
105
  response = client.get_httpx_client().request(
@@ -113,7 +113,7 @@ def sync(
113
113
  id: int,
114
114
  *,
115
115
  client: AuthenticatedClient,
116
- cluster_id: int,
116
+ cluster_name: str,
117
117
  ) -> Optional[Union[ErrorResponse, MessageResponse]]:
118
118
  """Delete task record
119
119
 
@@ -122,7 +122,7 @@ def sync(
122
122
 
123
123
  Args:
124
124
  id (int):
125
- cluster_id (int):
125
+ cluster_name (str):
126
126
 
127
127
  Raises:
128
128
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -135,7 +135,7 @@ def sync(
135
135
  return sync_detailed(
136
136
  id=id,
137
137
  client=client,
138
- cluster_id=cluster_id,
138
+ cluster_name=cluster_name,
139
139
  ).parsed
140
140
 
141
141
 
@@ -143,7 +143,7 @@ async def asyncio_detailed(
143
143
  id: int,
144
144
  *,
145
145
  client: AuthenticatedClient,
146
- cluster_id: int,
146
+ cluster_name: str,
147
147
  ) -> Response[Union[ErrorResponse, MessageResponse]]:
148
148
  """Delete task record
149
149
 
@@ -152,7 +152,7 @@ async def asyncio_detailed(
152
152
 
153
153
  Args:
154
154
  id (int):
155
- cluster_id (int):
155
+ cluster_name (str):
156
156
 
157
157
  Raises:
158
158
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -164,7 +164,7 @@ async def asyncio_detailed(
164
164
 
165
165
  kwargs = _get_kwargs(
166
166
  id=id,
167
- cluster_id=cluster_id,
167
+ cluster_name=cluster_name,
168
168
  )
169
169
 
170
170
  response = await client.get_async_httpx_client().request(**kwargs)
@@ -176,7 +176,7 @@ async def asyncio(
176
176
  id: int,
177
177
  *,
178
178
  client: AuthenticatedClient,
179
- cluster_id: int,
179
+ cluster_name: str,
180
180
  ) -> Optional[Union[ErrorResponse, MessageResponse]]:
181
181
  """Delete task record
182
182
 
@@ -185,7 +185,7 @@ async def asyncio(
185
185
 
186
186
  Args:
187
187
  id (int):
188
- cluster_id (int):
188
+ cluster_name (str):
189
189
 
190
190
  Raises:
191
191
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -199,6 +199,6 @@ async def asyncio(
199
199
  await asyncio_detailed(
200
200
  id=id,
201
201
  client=client,
202
- cluster_id=cluster_id,
202
+ cluster_name=cluster_name,
203
203
  )
204
204
  ).parsed