blaxel 0.1.21__py3-none-any.whl → 0.1.22rc70__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/agents/__init__.py +1 -1
- blaxel/client/models/__init__.py +18 -0
- blaxel/client/models/billable_time_metric.py +70 -0
- blaxel/client/models/jobs_chart_value.py +2 -2
- blaxel/{sandbox/client/models/process_kill_request.py → client/models/logs_response.py} +17 -14
- blaxel/client/models/logs_response_data.py +99 -0
- blaxel/client/models/memory_allocation_by_name.py +70 -0
- blaxel/client/models/metadata.py +9 -0
- blaxel/client/models/resource.py +79 -0
- blaxel/client/models/resource_log_chart.py +133 -0
- blaxel/client/models/resource_log_response.py +83 -0
- blaxel/client/models/resource_metrics.py +24 -0
- blaxel/client/models/resource_trace.py +97 -0
- blaxel/client/models/websocket_message.py +106 -0
- blaxel/common/internal.py +1 -0
- blaxel/jobs/__init__.py +1 -1
- blaxel/sandbox/base.py +1 -2
- blaxel/sandbox/client/api/process/delete_process_identifier_kill.py +0 -26
- blaxel/sandbox/client/models/__init__.py +2 -2
- blaxel/sandbox/client/models/process_request.py +25 -1
- blaxel/sandbox/client/models/process_request_env.py +49 -0
- blaxel/tools/__init__.py +1 -1
- {blaxel-0.1.21.dist-info → blaxel-0.1.22rc70.dist-info}/METADATA +1 -1
- {blaxel-0.1.21.dist-info → blaxel-0.1.22rc70.dist-info}/RECORD +26 -17
- {blaxel-0.1.21.dist-info → blaxel-0.1.22rc70.dist-info}/WHEEL +0 -0
- {blaxel-0.1.21.dist-info → blaxel-0.1.22rc70.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,83 @@
|
|
1
|
+
from typing import Any, TypeVar, Union, cast
|
2
|
+
|
3
|
+
from attrs import define as _attrs_define
|
4
|
+
from attrs import field as _attrs_field
|
5
|
+
|
6
|
+
from ..types import UNSET, Unset
|
7
|
+
|
8
|
+
T = TypeVar("T", bound="ResourceLogResponse")
|
9
|
+
|
10
|
+
|
11
|
+
@_attrs_define
|
12
|
+
class ResourceLogResponse:
|
13
|
+
"""Response for a resource log
|
14
|
+
|
15
|
+
Attributes:
|
16
|
+
chart (Union[Unset, list[Any]]): Chart
|
17
|
+
logs (Union[Unset, list[Any]]): Logs
|
18
|
+
total_count (Union[Unset, int]): Total count of logs
|
19
|
+
"""
|
20
|
+
|
21
|
+
chart: Union[Unset, list[Any]] = UNSET
|
22
|
+
logs: Union[Unset, list[Any]] = UNSET
|
23
|
+
total_count: Union[Unset, int] = UNSET
|
24
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
25
|
+
|
26
|
+
def to_dict(self) -> dict[str, Any]:
|
27
|
+
chart: Union[Unset, list[Any]] = UNSET
|
28
|
+
if not isinstance(self.chart, Unset):
|
29
|
+
chart = self.chart
|
30
|
+
|
31
|
+
logs: Union[Unset, list[Any]] = UNSET
|
32
|
+
if not isinstance(self.logs, Unset):
|
33
|
+
logs = self.logs
|
34
|
+
|
35
|
+
total_count = self.total_count
|
36
|
+
|
37
|
+
field_dict: dict[str, Any] = {}
|
38
|
+
field_dict.update(self.additional_properties)
|
39
|
+
field_dict.update({})
|
40
|
+
if chart is not UNSET:
|
41
|
+
field_dict["chart"] = chart
|
42
|
+
if logs is not UNSET:
|
43
|
+
field_dict["logs"] = logs
|
44
|
+
if total_count is not UNSET:
|
45
|
+
field_dict["totalCount"] = total_count
|
46
|
+
|
47
|
+
return field_dict
|
48
|
+
|
49
|
+
@classmethod
|
50
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
51
|
+
if not src_dict:
|
52
|
+
return None
|
53
|
+
d = src_dict.copy()
|
54
|
+
chart = cast(list[Any], d.pop("chart", UNSET))
|
55
|
+
|
56
|
+
logs = cast(list[Any], d.pop("logs", UNSET))
|
57
|
+
|
58
|
+
total_count = d.pop("totalCount", UNSET)
|
59
|
+
|
60
|
+
resource_log_response = cls(
|
61
|
+
chart=chart,
|
62
|
+
logs=logs,
|
63
|
+
total_count=total_count,
|
64
|
+
)
|
65
|
+
|
66
|
+
resource_log_response.additional_properties = d
|
67
|
+
return resource_log_response
|
68
|
+
|
69
|
+
@property
|
70
|
+
def additional_keys(self) -> list[str]:
|
71
|
+
return list(self.additional_properties.keys())
|
72
|
+
|
73
|
+
def __getitem__(self, key: str) -> Any:
|
74
|
+
return self.additional_properties[key]
|
75
|
+
|
76
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
77
|
+
self.additional_properties[key] = value
|
78
|
+
|
79
|
+
def __delitem__(self, key: str) -> None:
|
80
|
+
del self.additional_properties[key]
|
81
|
+
|
82
|
+
def __contains__(self, key: str) -> bool:
|
83
|
+
return key in self.additional_properties
|
@@ -6,6 +6,7 @@ from attrs import field as _attrs_field
|
|
6
6
|
from ..types import UNSET, Unset
|
7
7
|
|
8
8
|
if TYPE_CHECKING:
|
9
|
+
from ..models.billable_time_metric import BillableTimeMetric
|
9
10
|
from ..models.latency_metric import LatencyMetric
|
10
11
|
from ..models.memory_allocation_metric import MemoryAllocationMetric
|
11
12
|
from ..models.metric import Metric
|
@@ -30,6 +31,7 @@ class ResourceMetrics:
|
|
30
31
|
"""Metrics for a single resource deployment (eg. model deployment, function deployment)
|
31
32
|
|
32
33
|
Attributes:
|
34
|
+
billable_time (Union[Unset, BillableTimeMetric]): Billable time metric
|
33
35
|
inference_errors_global (Union[Unset, list['Metric']]): Array of metrics
|
34
36
|
inference_global (Union[Unset, list['Metric']]): Array of metrics
|
35
37
|
last_n_requests (Union[Unset, list['Metric']]): Array of metrics
|
@@ -59,6 +61,7 @@ class ResourceMetrics:
|
|
59
61
|
token_total (Union[Unset, TokenTotalMetric]): Token total metric
|
60
62
|
"""
|
61
63
|
|
64
|
+
billable_time: Union[Unset, "BillableTimeMetric"] = UNSET
|
62
65
|
inference_errors_global: Union[Unset, list["Metric"]] = UNSET
|
63
66
|
inference_global: Union[Unset, list["Metric"]] = UNSET
|
64
67
|
last_n_requests: Union[Unset, list["Metric"]] = UNSET
|
@@ -83,6 +86,16 @@ class ResourceMetrics:
|
|
83
86
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
84
87
|
|
85
88
|
def to_dict(self) -> dict[str, Any]:
|
89
|
+
billable_time: Union[Unset, dict[str, Any]] = UNSET
|
90
|
+
if (
|
91
|
+
self.billable_time
|
92
|
+
and not isinstance(self.billable_time, Unset)
|
93
|
+
and not isinstance(self.billable_time, dict)
|
94
|
+
):
|
95
|
+
billable_time = self.billable_time.to_dict()
|
96
|
+
elif self.billable_time and isinstance(self.billable_time, dict):
|
97
|
+
billable_time = self.billable_time
|
98
|
+
|
86
99
|
inference_errors_global: Union[Unset, list[dict[str, Any]]] = UNSET
|
87
100
|
if not isinstance(self.inference_errors_global, Unset):
|
88
101
|
inference_errors_global = []
|
@@ -244,6 +257,8 @@ class ResourceMetrics:
|
|
244
257
|
field_dict: dict[str, Any] = {}
|
245
258
|
field_dict.update(self.additional_properties)
|
246
259
|
field_dict.update({})
|
260
|
+
if billable_time is not UNSET:
|
261
|
+
field_dict["billableTime"] = billable_time
|
247
262
|
if inference_errors_global is not UNSET:
|
248
263
|
field_dict["inferenceErrorsGlobal"] = inference_errors_global
|
249
264
|
if inference_global is not UNSET:
|
@@ -291,6 +306,7 @@ class ResourceMetrics:
|
|
291
306
|
|
292
307
|
@classmethod
|
293
308
|
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
309
|
+
from ..models.billable_time_metric import BillableTimeMetric
|
294
310
|
from ..models.latency_metric import LatencyMetric
|
295
311
|
from ..models.memory_allocation_metric import MemoryAllocationMetric
|
296
312
|
from ..models.metric import Metric
|
@@ -313,6 +329,13 @@ class ResourceMetrics:
|
|
313
329
|
if not src_dict:
|
314
330
|
return None
|
315
331
|
d = src_dict.copy()
|
332
|
+
_billable_time = d.pop("billableTime", UNSET)
|
333
|
+
billable_time: Union[Unset, BillableTimeMetric]
|
334
|
+
if isinstance(_billable_time, Unset):
|
335
|
+
billable_time = UNSET
|
336
|
+
else:
|
337
|
+
billable_time = BillableTimeMetric.from_dict(_billable_time)
|
338
|
+
|
316
339
|
inference_errors_global = []
|
317
340
|
_inference_errors_global = d.pop("inferenceErrorsGlobal", UNSET)
|
318
341
|
for componentsschemas_array_metric_item_data in _inference_errors_global or []:
|
@@ -443,6 +466,7 @@ class ResourceMetrics:
|
|
443
466
|
token_total = TokenTotalMetric.from_dict(_token_total)
|
444
467
|
|
445
468
|
resource_metrics = cls(
|
469
|
+
billable_time=billable_time,
|
446
470
|
inference_errors_global=inference_errors_global,
|
447
471
|
inference_global=inference_global,
|
448
472
|
last_n_requests=last_n_requests,
|
@@ -0,0 +1,97 @@
|
|
1
|
+
from typing import Any, TypeVar, Union
|
2
|
+
|
3
|
+
from attrs import define as _attrs_define
|
4
|
+
from attrs import field as _attrs_field
|
5
|
+
|
6
|
+
from ..types import UNSET, Unset
|
7
|
+
|
8
|
+
T = TypeVar("T", bound="ResourceTrace")
|
9
|
+
|
10
|
+
|
11
|
+
@_attrs_define
|
12
|
+
class ResourceTrace:
|
13
|
+
"""Log for a resource deployment (eg. model deployment, function deployment)
|
14
|
+
|
15
|
+
Attributes:
|
16
|
+
duration (Union[Unset, int]): Duration in nanoseconds
|
17
|
+
has_error (Union[Unset, bool]): Has error
|
18
|
+
start_time (Union[Unset, str]): The timestamp of the log
|
19
|
+
status_code (Union[Unset, int]): Status code
|
20
|
+
trace_id (Union[Unset, str]): Trace ID of the log
|
21
|
+
"""
|
22
|
+
|
23
|
+
duration: Union[Unset, int] = UNSET
|
24
|
+
has_error: Union[Unset, bool] = UNSET
|
25
|
+
start_time: Union[Unset, str] = UNSET
|
26
|
+
status_code: Union[Unset, int] = UNSET
|
27
|
+
trace_id: Union[Unset, str] = UNSET
|
28
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
29
|
+
|
30
|
+
def to_dict(self) -> dict[str, Any]:
|
31
|
+
duration = self.duration
|
32
|
+
|
33
|
+
has_error = self.has_error
|
34
|
+
|
35
|
+
start_time = self.start_time
|
36
|
+
|
37
|
+
status_code = self.status_code
|
38
|
+
|
39
|
+
trace_id = self.trace_id
|
40
|
+
|
41
|
+
field_dict: dict[str, Any] = {}
|
42
|
+
field_dict.update(self.additional_properties)
|
43
|
+
field_dict.update({})
|
44
|
+
if duration is not UNSET:
|
45
|
+
field_dict["duration"] = duration
|
46
|
+
if has_error is not UNSET:
|
47
|
+
field_dict["hasError"] = has_error
|
48
|
+
if start_time is not UNSET:
|
49
|
+
field_dict["startTime"] = start_time
|
50
|
+
if status_code is not UNSET:
|
51
|
+
field_dict["statusCode"] = status_code
|
52
|
+
if trace_id is not UNSET:
|
53
|
+
field_dict["traceID"] = trace_id
|
54
|
+
|
55
|
+
return field_dict
|
56
|
+
|
57
|
+
@classmethod
|
58
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
59
|
+
if not src_dict:
|
60
|
+
return None
|
61
|
+
d = src_dict.copy()
|
62
|
+
duration = d.pop("duration", UNSET)
|
63
|
+
|
64
|
+
has_error = d.pop("hasError", UNSET)
|
65
|
+
|
66
|
+
start_time = d.pop("startTime", UNSET)
|
67
|
+
|
68
|
+
status_code = d.pop("statusCode", UNSET)
|
69
|
+
|
70
|
+
trace_id = d.pop("traceID", UNSET)
|
71
|
+
|
72
|
+
resource_trace = cls(
|
73
|
+
duration=duration,
|
74
|
+
has_error=has_error,
|
75
|
+
start_time=start_time,
|
76
|
+
status_code=status_code,
|
77
|
+
trace_id=trace_id,
|
78
|
+
)
|
79
|
+
|
80
|
+
resource_trace.additional_properties = d
|
81
|
+
return resource_trace
|
82
|
+
|
83
|
+
@property
|
84
|
+
def additional_keys(self) -> list[str]:
|
85
|
+
return list(self.additional_properties.keys())
|
86
|
+
|
87
|
+
def __getitem__(self, key: str) -> Any:
|
88
|
+
return self.additional_properties[key]
|
89
|
+
|
90
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
91
|
+
self.additional_properties[key] = value
|
92
|
+
|
93
|
+
def __delitem__(self, key: str) -> None:
|
94
|
+
del self.additional_properties[key]
|
95
|
+
|
96
|
+
def __contains__(self, key: str) -> bool:
|
97
|
+
return key in self.additional_properties
|
@@ -0,0 +1,106 @@
|
|
1
|
+
from typing import Any, TypeVar, Union
|
2
|
+
|
3
|
+
from attrs import define as _attrs_define
|
4
|
+
from attrs import field as _attrs_field
|
5
|
+
|
6
|
+
from ..types import UNSET, Unset
|
7
|
+
|
8
|
+
T = TypeVar("T", bound="WebsocketMessage")
|
9
|
+
|
10
|
+
|
11
|
+
@_attrs_define
|
12
|
+
class WebsocketMessage:
|
13
|
+
"""WebSocket connection details
|
14
|
+
|
15
|
+
Attributes:
|
16
|
+
created_at (Union[Unset, str]): The date and time when the resource was created
|
17
|
+
updated_at (Union[Unset, str]): The date and time when the resource was updated
|
18
|
+
id (Union[Unset, str]): Unique message ID
|
19
|
+
message (Union[Unset, str]): Message
|
20
|
+
ttl (Union[Unset, int]): TTL timestamp for automatic deletion
|
21
|
+
workspace (Union[Unset, str]): Workspace the connection belongs to
|
22
|
+
"""
|
23
|
+
|
24
|
+
created_at: Union[Unset, str] = UNSET
|
25
|
+
updated_at: Union[Unset, str] = UNSET
|
26
|
+
id: Union[Unset, str] = UNSET
|
27
|
+
message: Union[Unset, str] = UNSET
|
28
|
+
ttl: Union[Unset, int] = UNSET
|
29
|
+
workspace: Union[Unset, str] = UNSET
|
30
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
31
|
+
|
32
|
+
def to_dict(self) -> dict[str, Any]:
|
33
|
+
created_at = self.created_at
|
34
|
+
|
35
|
+
updated_at = self.updated_at
|
36
|
+
|
37
|
+
id = self.id
|
38
|
+
|
39
|
+
message = self.message
|
40
|
+
|
41
|
+
ttl = self.ttl
|
42
|
+
|
43
|
+
workspace = self.workspace
|
44
|
+
|
45
|
+
field_dict: dict[str, Any] = {}
|
46
|
+
field_dict.update(self.additional_properties)
|
47
|
+
field_dict.update({})
|
48
|
+
if created_at is not UNSET:
|
49
|
+
field_dict["createdAt"] = created_at
|
50
|
+
if updated_at is not UNSET:
|
51
|
+
field_dict["updatedAt"] = updated_at
|
52
|
+
if id is not UNSET:
|
53
|
+
field_dict["id"] = id
|
54
|
+
if message is not UNSET:
|
55
|
+
field_dict["message"] = message
|
56
|
+
if ttl is not UNSET:
|
57
|
+
field_dict["ttl"] = ttl
|
58
|
+
if workspace is not UNSET:
|
59
|
+
field_dict["workspace"] = workspace
|
60
|
+
|
61
|
+
return field_dict
|
62
|
+
|
63
|
+
@classmethod
|
64
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
65
|
+
if not src_dict:
|
66
|
+
return None
|
67
|
+
d = src_dict.copy()
|
68
|
+
created_at = d.pop("createdAt", UNSET)
|
69
|
+
|
70
|
+
updated_at = d.pop("updatedAt", UNSET)
|
71
|
+
|
72
|
+
id = d.pop("id", UNSET)
|
73
|
+
|
74
|
+
message = d.pop("message", UNSET)
|
75
|
+
|
76
|
+
ttl = d.pop("ttl", UNSET)
|
77
|
+
|
78
|
+
workspace = d.pop("workspace", UNSET)
|
79
|
+
|
80
|
+
websocket_message = cls(
|
81
|
+
created_at=created_at,
|
82
|
+
updated_at=updated_at,
|
83
|
+
id=id,
|
84
|
+
message=message,
|
85
|
+
ttl=ttl,
|
86
|
+
workspace=workspace,
|
87
|
+
)
|
88
|
+
|
89
|
+
websocket_message.additional_properties = d
|
90
|
+
return websocket_message
|
91
|
+
|
92
|
+
@property
|
93
|
+
def additional_keys(self) -> list[str]:
|
94
|
+
return list(self.additional_properties.keys())
|
95
|
+
|
96
|
+
def __getitem__(self, key: str) -> Any:
|
97
|
+
return self.additional_properties[key]
|
98
|
+
|
99
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
100
|
+
self.additional_properties[key] = value
|
101
|
+
|
102
|
+
def __delitem__(self, key: str) -> None:
|
103
|
+
del self.additional_properties[key]
|
104
|
+
|
105
|
+
def __contains__(self, key: str) -> bool:
|
106
|
+
return key in self.additional_properties
|
blaxel/common/internal.py
CHANGED
blaxel/jobs/__init__.py
CHANGED
@@ -8,7 +8,7 @@ from typing import Any, Awaitable, Callable, Dict
|
|
8
8
|
import requests
|
9
9
|
|
10
10
|
from ..client import client
|
11
|
-
from ..common.internal import
|
11
|
+
from ..common.internal import get_forced_url, get_global_unique_hash
|
12
12
|
from ..common.settings import settings
|
13
13
|
from ..instrumentation.span import SpanManager
|
14
14
|
|
blaxel/sandbox/base.py
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
import os
|
2
1
|
|
3
2
|
from httpx import Response
|
4
3
|
|
5
4
|
from ..client.models import Sandbox
|
6
|
-
from ..common.internal import
|
5
|
+
from ..common.internal import get_forced_url, get_global_unique_hash
|
7
6
|
from ..common.settings import settings
|
8
7
|
from .client.client import client
|
9
8
|
from .client.models import ErrorResponse
|
@@ -6,32 +6,18 @@ import httpx
|
|
6
6
|
from ... import errors
|
7
7
|
from ...client import Client
|
8
8
|
from ...models.error_response import ErrorResponse
|
9
|
-
from ...models.process_kill_request import ProcessKillRequest
|
10
9
|
from ...models.success_response import SuccessResponse
|
11
10
|
from ...types import Response
|
12
11
|
|
13
12
|
|
14
13
|
def _get_kwargs(
|
15
14
|
identifier: str,
|
16
|
-
*,
|
17
|
-
body: ProcessKillRequest,
|
18
15
|
) -> dict[str, Any]:
|
19
|
-
headers: dict[str, Any] = {}
|
20
|
-
|
21
16
|
_kwargs: dict[str, Any] = {
|
22
17
|
"method": "delete",
|
23
18
|
"url": f"/process/{identifier}/kill",
|
24
19
|
}
|
25
20
|
|
26
|
-
if type(body) == dict:
|
27
|
-
_body = body
|
28
|
-
else:
|
29
|
-
_body = body.to_dict()
|
30
|
-
|
31
|
-
_kwargs["json"] = _body
|
32
|
-
headers["Content-Type"] = "application/json"
|
33
|
-
|
34
|
-
_kwargs["headers"] = headers
|
35
21
|
return _kwargs
|
36
22
|
|
37
23
|
|
@@ -71,7 +57,6 @@ def sync_detailed(
|
|
71
57
|
identifier: str,
|
72
58
|
*,
|
73
59
|
client: Union[Client],
|
74
|
-
body: ProcessKillRequest,
|
75
60
|
) -> Response[Union[ErrorResponse, SuccessResponse]]:
|
76
61
|
"""Kill a process
|
77
62
|
|
@@ -79,7 +64,6 @@ def sync_detailed(
|
|
79
64
|
|
80
65
|
Args:
|
81
66
|
identifier (str):
|
82
|
-
body (ProcessKillRequest):
|
83
67
|
|
84
68
|
Raises:
|
85
69
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -91,7 +75,6 @@ def sync_detailed(
|
|
91
75
|
|
92
76
|
kwargs = _get_kwargs(
|
93
77
|
identifier=identifier,
|
94
|
-
body=body,
|
95
78
|
)
|
96
79
|
|
97
80
|
response = client.get_httpx_client().request(
|
@@ -105,7 +88,6 @@ def sync(
|
|
105
88
|
identifier: str,
|
106
89
|
*,
|
107
90
|
client: Union[Client],
|
108
|
-
body: ProcessKillRequest,
|
109
91
|
) -> Optional[Union[ErrorResponse, SuccessResponse]]:
|
110
92
|
"""Kill a process
|
111
93
|
|
@@ -113,7 +95,6 @@ def sync(
|
|
113
95
|
|
114
96
|
Args:
|
115
97
|
identifier (str):
|
116
|
-
body (ProcessKillRequest):
|
117
98
|
|
118
99
|
Raises:
|
119
100
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -126,7 +107,6 @@ def sync(
|
|
126
107
|
return sync_detailed(
|
127
108
|
identifier=identifier,
|
128
109
|
client=client,
|
129
|
-
body=body,
|
130
110
|
).parsed
|
131
111
|
|
132
112
|
|
@@ -134,7 +114,6 @@ async def asyncio_detailed(
|
|
134
114
|
identifier: str,
|
135
115
|
*,
|
136
116
|
client: Union[Client],
|
137
|
-
body: ProcessKillRequest,
|
138
117
|
) -> Response[Union[ErrorResponse, SuccessResponse]]:
|
139
118
|
"""Kill a process
|
140
119
|
|
@@ -142,7 +121,6 @@ async def asyncio_detailed(
|
|
142
121
|
|
143
122
|
Args:
|
144
123
|
identifier (str):
|
145
|
-
body (ProcessKillRequest):
|
146
124
|
|
147
125
|
Raises:
|
148
126
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -154,7 +132,6 @@ async def asyncio_detailed(
|
|
154
132
|
|
155
133
|
kwargs = _get_kwargs(
|
156
134
|
identifier=identifier,
|
157
|
-
body=body,
|
158
135
|
)
|
159
136
|
|
160
137
|
response = await client.get_async_httpx_client().request(**kwargs)
|
@@ -166,7 +143,6 @@ async def asyncio(
|
|
166
143
|
identifier: str,
|
167
144
|
*,
|
168
145
|
client: Union[Client],
|
169
|
-
body: ProcessKillRequest,
|
170
146
|
) -> Optional[Union[ErrorResponse, SuccessResponse]]:
|
171
147
|
"""Kill a process
|
172
148
|
|
@@ -174,7 +150,6 @@ async def asyncio(
|
|
174
150
|
|
175
151
|
Args:
|
176
152
|
identifier (str):
|
177
|
-
body (ProcessKillRequest):
|
178
153
|
|
179
154
|
Raises:
|
180
155
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
@@ -188,6 +163,5 @@ async def asyncio(
|
|
188
163
|
await asyncio_detailed(
|
189
164
|
identifier=identifier,
|
190
165
|
client=client,
|
191
|
-
body=body,
|
192
166
|
)
|
193
167
|
).parsed
|
@@ -11,9 +11,9 @@ from .file_with_content import FileWithContent
|
|
11
11
|
from .get_network_process_pid_ports_response_200 import GetNetworkProcessPidPortsResponse200
|
12
12
|
from .port_monitor_request import PortMonitorRequest
|
13
13
|
from .post_network_process_pid_monitor_response_200 import PostNetworkProcessPidMonitorResponse200
|
14
|
-
from .process_kill_request import ProcessKillRequest
|
15
14
|
from .process_logs import ProcessLogs
|
16
15
|
from .process_request import ProcessRequest
|
16
|
+
from .process_request_env import ProcessRequestEnv
|
17
17
|
from .process_response import ProcessResponse
|
18
18
|
from .process_response_status import ProcessResponseStatus
|
19
19
|
from .subdirectory import Subdirectory
|
@@ -29,9 +29,9 @@ __all__ = (
|
|
29
29
|
"GetNetworkProcessPidPortsResponse200",
|
30
30
|
"PortMonitorRequest",
|
31
31
|
"PostNetworkProcessPidMonitorResponse200",
|
32
|
-
"ProcessKillRequest",
|
33
32
|
"ProcessLogs",
|
34
33
|
"ProcessRequest",
|
34
|
+
"ProcessRequestEnv",
|
35
35
|
"ProcessResponse",
|
36
36
|
"ProcessResponseStatus",
|
37
37
|
"Subdirectory",
|
@@ -1,10 +1,14 @@
|
|
1
|
-
from typing import Any, TypeVar, Union, cast
|
1
|
+
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
2
2
|
|
3
3
|
from attrs import define as _attrs_define
|
4
4
|
from attrs import field as _attrs_field
|
5
5
|
|
6
6
|
from ..types import UNSET, Unset
|
7
7
|
|
8
|
+
if TYPE_CHECKING:
|
9
|
+
from ..models.process_request_env import ProcessRequestEnv
|
10
|
+
|
11
|
+
|
8
12
|
T = TypeVar("T", bound="ProcessRequest")
|
9
13
|
|
10
14
|
|
@@ -13,6 +17,7 @@ class ProcessRequest:
|
|
13
17
|
"""
|
14
18
|
Attributes:
|
15
19
|
command (str): Example: ls -la.
|
20
|
+
env (Union[Unset, ProcessRequestEnv]): Example: {'{"PORT"': ' "3000"}'}.
|
16
21
|
name (Union[Unset, str]): Example: my-process.
|
17
22
|
timeout (Union[Unset, int]): Example: 30.
|
18
23
|
wait_for_completion (Union[Unset, bool]):
|
@@ -21,6 +26,7 @@ class ProcessRequest:
|
|
21
26
|
"""
|
22
27
|
|
23
28
|
command: str
|
29
|
+
env: Union[Unset, "ProcessRequestEnv"] = UNSET
|
24
30
|
name: Union[Unset, str] = UNSET
|
25
31
|
timeout: Union[Unset, int] = UNSET
|
26
32
|
wait_for_completion: Union[Unset, bool] = UNSET
|
@@ -31,6 +37,12 @@ class ProcessRequest:
|
|
31
37
|
def to_dict(self) -> dict[str, Any]:
|
32
38
|
command = self.command
|
33
39
|
|
40
|
+
env: Union[Unset, dict[str, Any]] = UNSET
|
41
|
+
if self.env and not isinstance(self.env, Unset) and not isinstance(self.env, dict):
|
42
|
+
env = self.env.to_dict()
|
43
|
+
elif self.env and isinstance(self.env, dict):
|
44
|
+
env = self.env
|
45
|
+
|
34
46
|
name = self.name
|
35
47
|
|
36
48
|
timeout = self.timeout
|
@@ -50,6 +62,8 @@ class ProcessRequest:
|
|
50
62
|
"command": command,
|
51
63
|
}
|
52
64
|
)
|
65
|
+
if env is not UNSET:
|
66
|
+
field_dict["env"] = env
|
53
67
|
if name is not UNSET:
|
54
68
|
field_dict["name"] = name
|
55
69
|
if timeout is not UNSET:
|
@@ -65,11 +79,20 @@ class ProcessRequest:
|
|
65
79
|
|
66
80
|
@classmethod
|
67
81
|
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
82
|
+
from ..models.process_request_env import ProcessRequestEnv
|
83
|
+
|
68
84
|
if not src_dict:
|
69
85
|
return None
|
70
86
|
d = src_dict.copy()
|
71
87
|
command = d.pop("command")
|
72
88
|
|
89
|
+
_env = d.pop("env", UNSET)
|
90
|
+
env: Union[Unset, ProcessRequestEnv]
|
91
|
+
if isinstance(_env, Unset):
|
92
|
+
env = UNSET
|
93
|
+
else:
|
94
|
+
env = ProcessRequestEnv.from_dict(_env)
|
95
|
+
|
73
96
|
name = d.pop("name", UNSET)
|
74
97
|
|
75
98
|
timeout = d.pop("timeout", UNSET)
|
@@ -82,6 +105,7 @@ class ProcessRequest:
|
|
82
105
|
|
83
106
|
process_request = cls(
|
84
107
|
command=command,
|
108
|
+
env=env,
|
85
109
|
name=name,
|
86
110
|
timeout=timeout,
|
87
111
|
wait_for_completion=wait_for_completion,
|
@@ -0,0 +1,49 @@
|
|
1
|
+
from typing import Any, TypeVar
|
2
|
+
|
3
|
+
from attrs import define as _attrs_define
|
4
|
+
from attrs import field as _attrs_field
|
5
|
+
|
6
|
+
T = TypeVar("T", bound="ProcessRequestEnv")
|
7
|
+
|
8
|
+
|
9
|
+
@_attrs_define
|
10
|
+
class ProcessRequestEnv:
|
11
|
+
"""
|
12
|
+
Example:
|
13
|
+
{'{"PORT"': ' "3000"}'}
|
14
|
+
|
15
|
+
"""
|
16
|
+
|
17
|
+
additional_properties: dict[str, str] = _attrs_field(init=False, factory=dict)
|
18
|
+
|
19
|
+
def to_dict(self) -> dict[str, Any]:
|
20
|
+
field_dict: dict[str, Any] = {}
|
21
|
+
field_dict.update(self.additional_properties)
|
22
|
+
|
23
|
+
return field_dict
|
24
|
+
|
25
|
+
@classmethod
|
26
|
+
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
27
|
+
if not src_dict:
|
28
|
+
return None
|
29
|
+
d = src_dict.copy()
|
30
|
+
process_request_env = cls()
|
31
|
+
|
32
|
+
process_request_env.additional_properties = d
|
33
|
+
return process_request_env
|
34
|
+
|
35
|
+
@property
|
36
|
+
def additional_keys(self) -> list[str]:
|
37
|
+
return list(self.additional_properties.keys())
|
38
|
+
|
39
|
+
def __getitem__(self, key: str) -> str:
|
40
|
+
return self.additional_properties[key]
|
41
|
+
|
42
|
+
def __setitem__(self, key: str, value: str) -> 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
|
blaxel/tools/__init__.py
CHANGED
@@ -10,7 +10,7 @@ from mcp import ClientSession
|
|
10
10
|
from mcp.types import CallToolResult
|
11
11
|
from mcp.types import Tool as MCPTool
|
12
12
|
|
13
|
-
from ..common.internal import
|
13
|
+
from ..common.internal import get_forced_url, get_global_unique_hash
|
14
14
|
from ..common.settings import settings
|
15
15
|
from ..instrumentation.span import SpanManager
|
16
16
|
from ..mcp.client import websocket_client
|