blaxel 0.1.16__py3-none-any.whl → 0.1.17__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.
- blaxel/authentication/clientcredentials.py +1 -1
- blaxel/client/api/jobs/__init__.py +0 -0
- blaxel/client/api/{default/get_template_file_contents.py → jobs/create_job.py} +57 -44
- blaxel/client/api/jobs/delete_job.py +154 -0
- blaxel/client/api/{default/get_template_contents.py → jobs/get_job.py} +43 -30
- blaxel/client/api/jobs/list_job_revisions.py +159 -0
- blaxel/client/api/jobs/list_jobs.py +135 -0
- blaxel/client/api/jobs/update_job.py +179 -0
- blaxel/client/models/__init__.py +34 -0
- blaxel/client/models/job.py +129 -0
- blaxel/client/models/job_execution_config.py +79 -0
- blaxel/client/models/job_metrics.py +199 -0
- blaxel/client/models/job_metrics_executions_chart.py +45 -0
- blaxel/client/models/job_metrics_executions_total.py +45 -0
- blaxel/client/models/job_metrics_tasks_chart.py +45 -0
- blaxel/client/models/job_metrics_tasks_total.py +45 -0
- blaxel/client/models/job_spec.py +208 -0
- blaxel/client/models/jobs_chart.py +94 -0
- blaxel/client/models/jobs_chart_value.py +70 -0
- blaxel/client/models/jobs_executions.py +88 -0
- blaxel/client/models/jobs_network_chart.py +94 -0
- blaxel/client/models/jobs_success_failed_chart.py +139 -0
- blaxel/client/models/jobs_tasks.py +88 -0
- blaxel/client/models/jobs_total.py +97 -0
- blaxel/client/models/preview_spec.py +55 -1
- blaxel/client/models/preview_spec_request_headers.py +48 -0
- blaxel/{sandbox/client/models/get_process_identifier_logs_response_200.py → client/models/preview_spec_response_headers.py} +6 -6
- blaxel/client/models/runtime.py +18 -0
- blaxel/client/models/serverless_config.py +9 -0
- blaxel/common/internal.py +0 -2
- blaxel/common/logger.py +2 -0
- blaxel/instrumentation/manager.py +1 -1
- blaxel/jobs/__init__.py +4 -8
- blaxel/sandbox/client/api/filesystem/delete_filesystem_path.py +4 -0
- blaxel/sandbox/client/api/filesystem/get_filesystem_path.py +4 -0
- blaxel/sandbox/client/api/filesystem/get_watch_filesystem_path.py +22 -1
- blaxel/sandbox/client/api/filesystem/put_filesystem_path.py +8 -4
- blaxel/sandbox/client/api/network/delete_network_process_pid_monitor.py +4 -0
- blaxel/sandbox/client/api/network/get_network_process_pid_ports.py +4 -0
- blaxel/sandbox/client/api/network/post_network_process_pid_monitor.py +4 -0
- blaxel/sandbox/client/api/process/delete_process_identifier.py +4 -0
- blaxel/sandbox/client/api/process/delete_process_identifier_kill.py +4 -0
- blaxel/sandbox/client/api/process/get_process_identifier_logs.py +16 -16
- blaxel/sandbox/client/api/process/get_process_identifier_logs_stream.py +4 -0
- blaxel/sandbox/client/api/process/get_ws_process_identifier_logs_stream.py +8 -8
- blaxel/sandbox/client/api/process/post_process.py +4 -0
- blaxel/sandbox/client/models/__init__.py +4 -2
- blaxel/sandbox/client/models/directory.py +9 -0
- blaxel/sandbox/client/models/file.py +9 -0
- blaxel/sandbox/client/models/file_with_content.py +9 -0
- blaxel/sandbox/client/models/process_logs.py +78 -0
- blaxel/sandbox/client/models/process_response.py +12 -4
- blaxel/sandbox/client/models/process_response_status.py +12 -0
- blaxel/sandbox/client/models/subdirectory.py +9 -0
- blaxel/sandbox/preview.py +13 -17
- blaxel/sandbox/process.py +8 -9
- {blaxel-0.1.16.dist-info → blaxel-0.1.17.dist-info}/METADATA +1 -1
- {blaxel-0.1.16.dist-info → blaxel-0.1.17.dist-info}/RECORD +60 -37
- {blaxel-0.1.16.dist-info → blaxel-0.1.17.dist-info}/WHEEL +0 -0
- {blaxel-0.1.16.dist-info → blaxel-0.1.17.dist-info}/licenses/LICENSE +0 -0
@@ -4,10 +4,10 @@ authentication for Blaxel. It manages token refreshing and authentication flows
|
|
4
4
|
client credentials and refresh tokens.
|
5
5
|
"""
|
6
6
|
|
7
|
+
import time
|
7
8
|
from dataclasses import dataclass
|
8
9
|
from datetime import datetime, timedelta
|
9
10
|
from typing import Generator, Optional
|
10
|
-
import time
|
11
11
|
|
12
12
|
import requests
|
13
13
|
from httpx import Request, Response
|
File without changes
|
@@ -1,28 +1,41 @@
|
|
1
1
|
from http import HTTPStatus
|
2
|
-
from typing import Any, Optional, Union
|
2
|
+
from typing import Any, Optional, Union
|
3
3
|
|
4
4
|
import httpx
|
5
5
|
|
6
6
|
from ... import errors
|
7
7
|
from ...client import Client
|
8
|
+
from ...models.job import Job
|
8
9
|
from ...types import Response
|
9
10
|
|
10
11
|
|
11
12
|
def _get_kwargs(
|
12
|
-
|
13
|
-
|
13
|
+
*,
|
14
|
+
body: Job,
|
14
15
|
) -> dict[str, Any]:
|
16
|
+
headers: dict[str, Any] = {}
|
17
|
+
|
15
18
|
_kwargs: dict[str, Any] = {
|
16
|
-
"method": "
|
17
|
-
"url":
|
19
|
+
"method": "post",
|
20
|
+
"url": "/jobs",
|
18
21
|
}
|
19
22
|
|
23
|
+
if type(body) == dict:
|
24
|
+
_body = body
|
25
|
+
else:
|
26
|
+
_body = body.to_dict()
|
27
|
+
|
28
|
+
_kwargs["json"] = _body
|
29
|
+
headers["Content-Type"] = "application/json"
|
30
|
+
|
31
|
+
_kwargs["headers"] = headers
|
20
32
|
return _kwargs
|
21
33
|
|
22
34
|
|
23
|
-
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[
|
35
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Job]:
|
24
36
|
if response.status_code == 200:
|
25
|
-
response_200 =
|
37
|
+
response_200 = Job.from_dict(response.json())
|
38
|
+
|
26
39
|
return response_200
|
27
40
|
if client.raise_on_unexpected_status:
|
28
41
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
@@ -30,7 +43,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[str
|
|
30
43
|
return None
|
31
44
|
|
32
45
|
|
33
|
-
def _build_response(*, client: Client, response: httpx.Response) -> Response[
|
46
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Job]:
|
34
47
|
return Response(
|
35
48
|
status_code=HTTPStatus(response.status_code),
|
36
49
|
content=response.content,
|
@@ -40,27 +53,27 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[str
|
|
40
53
|
|
41
54
|
|
42
55
|
def sync_detailed(
|
43
|
-
template_name: str,
|
44
|
-
file_name: str,
|
45
56
|
*,
|
46
57
|
client: Union[Client],
|
47
|
-
|
48
|
-
|
58
|
+
body: Job,
|
59
|
+
) -> Response[Job]:
|
60
|
+
"""Create job
|
61
|
+
|
62
|
+
Creates a job.
|
63
|
+
|
49
64
|
Args:
|
50
|
-
|
51
|
-
file_name (str):
|
65
|
+
body (Job): Job
|
52
66
|
|
53
67
|
Raises:
|
54
68
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
55
69
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
56
70
|
|
57
71
|
Returns:
|
58
|
-
Response[
|
72
|
+
Response[Job]
|
59
73
|
"""
|
60
74
|
|
61
75
|
kwargs = _get_kwargs(
|
62
|
-
|
63
|
-
file_name=file_name,
|
76
|
+
body=body,
|
64
77
|
)
|
65
78
|
|
66
79
|
response = client.get_httpx_client().request(
|
@@ -71,53 +84,53 @@ def sync_detailed(
|
|
71
84
|
|
72
85
|
|
73
86
|
def sync(
|
74
|
-
template_name: str,
|
75
|
-
file_name: str,
|
76
87
|
*,
|
77
88
|
client: Union[Client],
|
78
|
-
|
79
|
-
|
89
|
+
body: Job,
|
90
|
+
) -> Optional[Job]:
|
91
|
+
"""Create job
|
92
|
+
|
93
|
+
Creates a job.
|
94
|
+
|
80
95
|
Args:
|
81
|
-
|
82
|
-
file_name (str):
|
96
|
+
body (Job): Job
|
83
97
|
|
84
98
|
Raises:
|
85
99
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
86
100
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
87
101
|
|
88
102
|
Returns:
|
89
|
-
|
103
|
+
Job
|
90
104
|
"""
|
91
105
|
|
92
106
|
return sync_detailed(
|
93
|
-
template_name=template_name,
|
94
|
-
file_name=file_name,
|
95
107
|
client=client,
|
108
|
+
body=body,
|
96
109
|
).parsed
|
97
110
|
|
98
111
|
|
99
112
|
async def asyncio_detailed(
|
100
|
-
template_name: str,
|
101
|
-
file_name: str,
|
102
113
|
*,
|
103
114
|
client: Union[Client],
|
104
|
-
|
105
|
-
|
115
|
+
body: Job,
|
116
|
+
) -> Response[Job]:
|
117
|
+
"""Create job
|
118
|
+
|
119
|
+
Creates a job.
|
120
|
+
|
106
121
|
Args:
|
107
|
-
|
108
|
-
file_name (str):
|
122
|
+
body (Job): Job
|
109
123
|
|
110
124
|
Raises:
|
111
125
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
112
126
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
113
127
|
|
114
128
|
Returns:
|
115
|
-
Response[
|
129
|
+
Response[Job]
|
116
130
|
"""
|
117
131
|
|
118
132
|
kwargs = _get_kwargs(
|
119
|
-
|
120
|
-
file_name=file_name,
|
133
|
+
body=body,
|
121
134
|
)
|
122
135
|
|
123
136
|
response = await client.get_async_httpx_client().request(**kwargs)
|
@@ -126,28 +139,28 @@ async def asyncio_detailed(
|
|
126
139
|
|
127
140
|
|
128
141
|
async def asyncio(
|
129
|
-
template_name: str,
|
130
|
-
file_name: str,
|
131
142
|
*,
|
132
143
|
client: Union[Client],
|
133
|
-
|
134
|
-
|
144
|
+
body: Job,
|
145
|
+
) -> Optional[Job]:
|
146
|
+
"""Create job
|
147
|
+
|
148
|
+
Creates a job.
|
149
|
+
|
135
150
|
Args:
|
136
|
-
|
137
|
-
file_name (str):
|
151
|
+
body (Job): Job
|
138
152
|
|
139
153
|
Raises:
|
140
154
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
141
155
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
142
156
|
|
143
157
|
Returns:
|
144
|
-
|
158
|
+
Job
|
145
159
|
"""
|
146
160
|
|
147
161
|
return (
|
148
162
|
await asyncio_detailed(
|
149
|
-
template_name=template_name,
|
150
|
-
file_name=file_name,
|
151
163
|
client=client,
|
164
|
+
body=body,
|
152
165
|
)
|
153
166
|
).parsed
|
@@ -0,0 +1,154 @@
|
|
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 Client
|
8
|
+
from ...models.job import Job
|
9
|
+
from ...types import Response
|
10
|
+
|
11
|
+
|
12
|
+
def _get_kwargs(
|
13
|
+
job_id: str,
|
14
|
+
) -> dict[str, Any]:
|
15
|
+
_kwargs: dict[str, Any] = {
|
16
|
+
"method": "delete",
|
17
|
+
"url": f"/jobs/{job_id}",
|
18
|
+
}
|
19
|
+
|
20
|
+
return _kwargs
|
21
|
+
|
22
|
+
|
23
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Job]:
|
24
|
+
if response.status_code == 200:
|
25
|
+
response_200 = Job.from_dict(response.json())
|
26
|
+
|
27
|
+
return response_200
|
28
|
+
if client.raise_on_unexpected_status:
|
29
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
30
|
+
else:
|
31
|
+
return None
|
32
|
+
|
33
|
+
|
34
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Job]:
|
35
|
+
return Response(
|
36
|
+
status_code=HTTPStatus(response.status_code),
|
37
|
+
content=response.content,
|
38
|
+
headers=response.headers,
|
39
|
+
parsed=_parse_response(client=client, response=response),
|
40
|
+
)
|
41
|
+
|
42
|
+
|
43
|
+
def sync_detailed(
|
44
|
+
job_id: str,
|
45
|
+
*,
|
46
|
+
client: Union[Client],
|
47
|
+
) -> Response[Job]:
|
48
|
+
"""Delete job
|
49
|
+
|
50
|
+
Deletes a job by name.
|
51
|
+
|
52
|
+
Args:
|
53
|
+
job_id (str):
|
54
|
+
|
55
|
+
Raises:
|
56
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
57
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
58
|
+
|
59
|
+
Returns:
|
60
|
+
Response[Job]
|
61
|
+
"""
|
62
|
+
|
63
|
+
kwargs = _get_kwargs(
|
64
|
+
job_id=job_id,
|
65
|
+
)
|
66
|
+
|
67
|
+
response = client.get_httpx_client().request(
|
68
|
+
**kwargs,
|
69
|
+
)
|
70
|
+
|
71
|
+
return _build_response(client=client, response=response)
|
72
|
+
|
73
|
+
|
74
|
+
def sync(
|
75
|
+
job_id: str,
|
76
|
+
*,
|
77
|
+
client: Union[Client],
|
78
|
+
) -> Optional[Job]:
|
79
|
+
"""Delete job
|
80
|
+
|
81
|
+
Deletes a job by name.
|
82
|
+
|
83
|
+
Args:
|
84
|
+
job_id (str):
|
85
|
+
|
86
|
+
Raises:
|
87
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
88
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
89
|
+
|
90
|
+
Returns:
|
91
|
+
Job
|
92
|
+
"""
|
93
|
+
|
94
|
+
return sync_detailed(
|
95
|
+
job_id=job_id,
|
96
|
+
client=client,
|
97
|
+
).parsed
|
98
|
+
|
99
|
+
|
100
|
+
async def asyncio_detailed(
|
101
|
+
job_id: str,
|
102
|
+
*,
|
103
|
+
client: Union[Client],
|
104
|
+
) -> Response[Job]:
|
105
|
+
"""Delete job
|
106
|
+
|
107
|
+
Deletes a job by name.
|
108
|
+
|
109
|
+
Args:
|
110
|
+
job_id (str):
|
111
|
+
|
112
|
+
Raises:
|
113
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
114
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
115
|
+
|
116
|
+
Returns:
|
117
|
+
Response[Job]
|
118
|
+
"""
|
119
|
+
|
120
|
+
kwargs = _get_kwargs(
|
121
|
+
job_id=job_id,
|
122
|
+
)
|
123
|
+
|
124
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
125
|
+
|
126
|
+
return _build_response(client=client, response=response)
|
127
|
+
|
128
|
+
|
129
|
+
async def asyncio(
|
130
|
+
job_id: str,
|
131
|
+
*,
|
132
|
+
client: Union[Client],
|
133
|
+
) -> Optional[Job]:
|
134
|
+
"""Delete job
|
135
|
+
|
136
|
+
Deletes a job by name.
|
137
|
+
|
138
|
+
Args:
|
139
|
+
job_id (str):
|
140
|
+
|
141
|
+
Raises:
|
142
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
143
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
144
|
+
|
145
|
+
Returns:
|
146
|
+
Job
|
147
|
+
"""
|
148
|
+
|
149
|
+
return (
|
150
|
+
await asyncio_detailed(
|
151
|
+
job_id=job_id,
|
152
|
+
client=client,
|
153
|
+
)
|
154
|
+
).parsed
|
@@ -1,27 +1,28 @@
|
|
1
1
|
from http import HTTPStatus
|
2
|
-
from typing import Any, Optional, Union
|
2
|
+
from typing import Any, Optional, Union
|
3
3
|
|
4
4
|
import httpx
|
5
5
|
|
6
6
|
from ... import errors
|
7
7
|
from ...client import Client
|
8
|
+
from ...models.model import Model
|
8
9
|
from ...types import Response
|
9
10
|
|
10
11
|
|
11
12
|
def _get_kwargs(
|
12
|
-
|
13
|
+
job_id: str,
|
13
14
|
) -> dict[str, Any]:
|
14
15
|
_kwargs: dict[str, Any] = {
|
15
16
|
"method": "get",
|
16
|
-
"url": f"/
|
17
|
+
"url": f"/jobs/{job_id}",
|
17
18
|
}
|
18
19
|
|
19
20
|
return _kwargs
|
20
21
|
|
21
22
|
|
22
|
-
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[
|
23
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Model]:
|
23
24
|
if response.status_code == 200:
|
24
|
-
response_200 =
|
25
|
+
response_200 = Model.from_dict(response.json())
|
25
26
|
|
26
27
|
return response_200
|
27
28
|
if client.raise_on_unexpected_status:
|
@@ -30,7 +31,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[lis
|
|
30
31
|
return None
|
31
32
|
|
32
33
|
|
33
|
-
def _build_response(*, client: Client, response: httpx.Response) -> Response[
|
34
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Model]:
|
34
35
|
return Response(
|
35
36
|
status_code=HTTPStatus(response.status_code),
|
36
37
|
content=response.content,
|
@@ -40,24 +41,27 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[lis
|
|
40
41
|
|
41
42
|
|
42
43
|
def sync_detailed(
|
43
|
-
|
44
|
+
job_id: str,
|
44
45
|
*,
|
45
46
|
client: Union[Client],
|
46
|
-
) -> Response[
|
47
|
-
"""
|
47
|
+
) -> Response[Model]:
|
48
|
+
"""Get job
|
49
|
+
|
50
|
+
Returns a job by name.
|
51
|
+
|
48
52
|
Args:
|
49
|
-
|
53
|
+
job_id (str):
|
50
54
|
|
51
55
|
Raises:
|
52
56
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
53
57
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
54
58
|
|
55
59
|
Returns:
|
56
|
-
Response[
|
60
|
+
Response[Model]
|
57
61
|
"""
|
58
62
|
|
59
63
|
kwargs = _get_kwargs(
|
60
|
-
|
64
|
+
job_id=job_id,
|
61
65
|
)
|
62
66
|
|
63
67
|
response = client.get_httpx_client().request(
|
@@ -68,47 +72,53 @@ def sync_detailed(
|
|
68
72
|
|
69
73
|
|
70
74
|
def sync(
|
71
|
-
|
75
|
+
job_id: str,
|
72
76
|
*,
|
73
77
|
client: Union[Client],
|
74
|
-
) -> Optional[
|
75
|
-
"""
|
78
|
+
) -> Optional[Model]:
|
79
|
+
"""Get job
|
80
|
+
|
81
|
+
Returns a job by name.
|
82
|
+
|
76
83
|
Args:
|
77
|
-
|
84
|
+
job_id (str):
|
78
85
|
|
79
86
|
Raises:
|
80
87
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
81
88
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
82
89
|
|
83
90
|
Returns:
|
84
|
-
|
91
|
+
Model
|
85
92
|
"""
|
86
93
|
|
87
94
|
return sync_detailed(
|
88
|
-
|
95
|
+
job_id=job_id,
|
89
96
|
client=client,
|
90
97
|
).parsed
|
91
98
|
|
92
99
|
|
93
100
|
async def asyncio_detailed(
|
94
|
-
|
101
|
+
job_id: str,
|
95
102
|
*,
|
96
103
|
client: Union[Client],
|
97
|
-
) -> Response[
|
98
|
-
"""
|
104
|
+
) -> Response[Model]:
|
105
|
+
"""Get job
|
106
|
+
|
107
|
+
Returns a job by name.
|
108
|
+
|
99
109
|
Args:
|
100
|
-
|
110
|
+
job_id (str):
|
101
111
|
|
102
112
|
Raises:
|
103
113
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
104
114
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
105
115
|
|
106
116
|
Returns:
|
107
|
-
Response[
|
117
|
+
Response[Model]
|
108
118
|
"""
|
109
119
|
|
110
120
|
kwargs = _get_kwargs(
|
111
|
-
|
121
|
+
job_id=job_id,
|
112
122
|
)
|
113
123
|
|
114
124
|
response = await client.get_async_httpx_client().request(**kwargs)
|
@@ -117,25 +127,28 @@ async def asyncio_detailed(
|
|
117
127
|
|
118
128
|
|
119
129
|
async def asyncio(
|
120
|
-
|
130
|
+
job_id: str,
|
121
131
|
*,
|
122
132
|
client: Union[Client],
|
123
|
-
) -> Optional[
|
124
|
-
"""
|
133
|
+
) -> Optional[Model]:
|
134
|
+
"""Get job
|
135
|
+
|
136
|
+
Returns a job by name.
|
137
|
+
|
125
138
|
Args:
|
126
|
-
|
139
|
+
job_id (str):
|
127
140
|
|
128
141
|
Raises:
|
129
142
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
130
143
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
131
144
|
|
132
145
|
Returns:
|
133
|
-
|
146
|
+
Model
|
134
147
|
"""
|
135
148
|
|
136
149
|
return (
|
137
150
|
await asyncio_detailed(
|
138
|
-
|
151
|
+
job_id=job_id,
|
139
152
|
client=client,
|
140
153
|
)
|
141
154
|
).parsed
|
@@ -0,0 +1,159 @@
|
|
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 Client
|
8
|
+
from ...models.revision_metadata import RevisionMetadata
|
9
|
+
from ...types import Response
|
10
|
+
|
11
|
+
|
12
|
+
def _get_kwargs(
|
13
|
+
job_id: str,
|
14
|
+
) -> dict[str, Any]:
|
15
|
+
_kwargs: dict[str, Any] = {
|
16
|
+
"method": "get",
|
17
|
+
"url": f"/jobs/{job_id}/revisions",
|
18
|
+
}
|
19
|
+
|
20
|
+
return _kwargs
|
21
|
+
|
22
|
+
|
23
|
+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[list["RevisionMetadata"]]:
|
24
|
+
if response.status_code == 200:
|
25
|
+
response_200 = []
|
26
|
+
_response_200 = response.json()
|
27
|
+
for response_200_item_data in _response_200:
|
28
|
+
response_200_item = RevisionMetadata.from_dict(response_200_item_data)
|
29
|
+
|
30
|
+
response_200.append(response_200_item)
|
31
|
+
|
32
|
+
return response_200
|
33
|
+
if client.raise_on_unexpected_status:
|
34
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
35
|
+
else:
|
36
|
+
return None
|
37
|
+
|
38
|
+
|
39
|
+
def _build_response(*, client: Client, response: httpx.Response) -> Response[list["RevisionMetadata"]]:
|
40
|
+
return Response(
|
41
|
+
status_code=HTTPStatus(response.status_code),
|
42
|
+
content=response.content,
|
43
|
+
headers=response.headers,
|
44
|
+
parsed=_parse_response(client=client, response=response),
|
45
|
+
)
|
46
|
+
|
47
|
+
|
48
|
+
def sync_detailed(
|
49
|
+
job_id: str,
|
50
|
+
*,
|
51
|
+
client: Union[Client],
|
52
|
+
) -> Response[list["RevisionMetadata"]]:
|
53
|
+
"""List job revisions
|
54
|
+
|
55
|
+
Returns revisions for a job by name.
|
56
|
+
|
57
|
+
Args:
|
58
|
+
job_id (str):
|
59
|
+
|
60
|
+
Raises:
|
61
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
62
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
63
|
+
|
64
|
+
Returns:
|
65
|
+
Response[list['RevisionMetadata']]
|
66
|
+
"""
|
67
|
+
|
68
|
+
kwargs = _get_kwargs(
|
69
|
+
job_id=job_id,
|
70
|
+
)
|
71
|
+
|
72
|
+
response = client.get_httpx_client().request(
|
73
|
+
**kwargs,
|
74
|
+
)
|
75
|
+
|
76
|
+
return _build_response(client=client, response=response)
|
77
|
+
|
78
|
+
|
79
|
+
def sync(
|
80
|
+
job_id: str,
|
81
|
+
*,
|
82
|
+
client: Union[Client],
|
83
|
+
) -> Optional[list["RevisionMetadata"]]:
|
84
|
+
"""List job revisions
|
85
|
+
|
86
|
+
Returns revisions for a job by name.
|
87
|
+
|
88
|
+
Args:
|
89
|
+
job_id (str):
|
90
|
+
|
91
|
+
Raises:
|
92
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
93
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
94
|
+
|
95
|
+
Returns:
|
96
|
+
list['RevisionMetadata']
|
97
|
+
"""
|
98
|
+
|
99
|
+
return sync_detailed(
|
100
|
+
job_id=job_id,
|
101
|
+
client=client,
|
102
|
+
).parsed
|
103
|
+
|
104
|
+
|
105
|
+
async def asyncio_detailed(
|
106
|
+
job_id: str,
|
107
|
+
*,
|
108
|
+
client: Union[Client],
|
109
|
+
) -> Response[list["RevisionMetadata"]]:
|
110
|
+
"""List job revisions
|
111
|
+
|
112
|
+
Returns revisions for a job by name.
|
113
|
+
|
114
|
+
Args:
|
115
|
+
job_id (str):
|
116
|
+
|
117
|
+
Raises:
|
118
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
119
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
120
|
+
|
121
|
+
Returns:
|
122
|
+
Response[list['RevisionMetadata']]
|
123
|
+
"""
|
124
|
+
|
125
|
+
kwargs = _get_kwargs(
|
126
|
+
job_id=job_id,
|
127
|
+
)
|
128
|
+
|
129
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
130
|
+
|
131
|
+
return _build_response(client=client, response=response)
|
132
|
+
|
133
|
+
|
134
|
+
async def asyncio(
|
135
|
+
job_id: str,
|
136
|
+
*,
|
137
|
+
client: Union[Client],
|
138
|
+
) -> Optional[list["RevisionMetadata"]]:
|
139
|
+
"""List job revisions
|
140
|
+
|
141
|
+
Returns revisions for a job by name.
|
142
|
+
|
143
|
+
Args:
|
144
|
+
job_id (str):
|
145
|
+
|
146
|
+
Raises:
|
147
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
148
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
149
|
+
|
150
|
+
Returns:
|
151
|
+
list['RevisionMetadata']
|
152
|
+
"""
|
153
|
+
|
154
|
+
return (
|
155
|
+
await asyncio_detailed(
|
156
|
+
job_id=job_id,
|
157
|
+
client=client,
|
158
|
+
)
|
159
|
+
).parsed
|