blaxel 0.2.26rc119__py3-none-any.whl → 0.2.27__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/__init__.py +3 -5
- blaxel/core/__init__.py +9 -1
- blaxel/core/client/api/{privateclusters/create_private_cluster.py → images/cleanup_images.py} +31 -25
- blaxel/core/client/models/__init__.py +2 -4
- blaxel/core/client/models/agent.py +1 -0
- blaxel/core/client/models/agent_spec.py +1 -24
- blaxel/core/client/models/billable_time_metric.py +1 -0
- blaxel/core/{sandbox/client/models/find_match.py → client/models/cleanup_images_response_200.py} +19 -19
- blaxel/core/client/models/configuration.py +1 -0
- blaxel/core/client/models/core_event.py +9 -0
- blaxel/core/client/models/core_spec.py +1 -24
- blaxel/core/client/models/core_spec_configurations.py +1 -0
- blaxel/core/client/models/create_job_execution_request.py +1 -0
- blaxel/core/client/models/create_job_execution_response.py +1 -0
- blaxel/core/client/models/custom_domain.py +1 -0
- blaxel/core/client/models/custom_domain_metadata.py +1 -0
- blaxel/core/client/models/custom_domain_spec.py +1 -0
- blaxel/core/client/models/delete_volume_template_version_response_200.py +1 -0
- blaxel/core/client/models/entrypoint.py +1 -0
- blaxel/core/client/models/form.py +1 -0
- blaxel/core/client/models/function.py +1 -0
- blaxel/core/client/models/function_spec.py +1 -24
- blaxel/core/client/models/image.py +1 -0
- blaxel/core/client/models/image_spec.py +1 -0
- blaxel/core/client/models/integration.py +1 -0
- blaxel/core/client/models/integration_connection.py +1 -0
- blaxel/core/client/models/integration_connection_spec.py +1 -0
- blaxel/core/client/models/integration_endpoint.py +1 -0
- blaxel/core/client/models/integration_endpoints.py +2 -0
- blaxel/core/client/models/job.py +1 -0
- blaxel/core/client/models/job_execution.py +1 -0
- blaxel/core/client/models/job_execution_spec.py +1 -0
- blaxel/core/client/models/job_execution_task.py +1 -0
- blaxel/core/client/models/job_metrics.py +1 -0
- blaxel/core/client/models/job_spec.py +1 -24
- blaxel/core/client/models/jobs_network_chart.py +1 -0
- blaxel/core/client/models/jobs_success_failed_chart.py +1 -0
- blaxel/core/client/models/latency_metric.py +1 -0
- blaxel/core/client/models/location_response.py +1 -0
- blaxel/core/client/models/mcp_definition.py +1 -0
- blaxel/core/client/models/metadata.py +1 -0
- blaxel/core/client/models/metrics.py +34 -0
- blaxel/core/client/models/model.py +1 -0
- blaxel/core/client/models/model_spec.py +1 -24
- blaxel/core/client/models/pending_invitation_accept.py +1 -0
- blaxel/core/client/models/pending_invitation_render.py +1 -0
- blaxel/core/client/models/policy.py +1 -0
- blaxel/core/client/models/policy_spec.py +1 -0
- blaxel/core/client/models/preview.py +1 -0
- blaxel/core/client/models/preview_spec.py +1 -0
- blaxel/core/client/models/preview_token.py +1 -0
- blaxel/core/client/models/public_ips.py +1 -0
- blaxel/core/client/models/request_duration_over_time_metrics.py +1 -0
- blaxel/core/client/models/request_total_by_origin_metric.py +1 -0
- blaxel/core/client/models/request_total_metric.py +1 -0
- blaxel/core/client/models/resource_metrics.py +1 -0
- blaxel/core/client/models/revision_configuration.py +9 -0
- blaxel/core/client/models/runtime.py +1 -0
- blaxel/core/client/models/sandbox.py +1 -0
- blaxel/core/client/models/sandbox_definition.py +1 -0
- blaxel/core/client/models/sandbox_lifecycle.py +1 -0
- blaxel/core/client/models/sandbox_spec.py +1 -24
- blaxel/core/client/models/serverless_config.py +1 -0
- blaxel/core/client/models/start_sandbox.py +1 -0
- blaxel/core/client/models/stop_sandbox.py +1 -0
- blaxel/core/client/models/store_agent.py +1 -0
- blaxel/core/client/models/store_configuration.py +1 -0
- blaxel/core/client/models/template.py +1 -0
- blaxel/core/client/models/time_to_first_token_over_time_metrics.py +1 -0
- blaxel/core/client/models/token_rate_metrics.py +1 -0
- blaxel/core/client/models/trigger.py +10 -0
- blaxel/core/client/models/trigger_configuration.py +28 -0
- blaxel/core/client/models/volume.py +1 -0
- blaxel/core/client/models/volume_template.py +1 -0
- blaxel/core/client/models/websocket_channel.py +9 -0
- blaxel/core/client/models/workspace.py +1 -0
- blaxel/core/client/response_interceptor.py +0 -1
- blaxel/core/common/__init__.py +11 -2
- blaxel/core/common/autoload.py +1 -85
- blaxel/core/common/settings.py +56 -16
- blaxel/core/common/webhook.py +187 -0
- blaxel/core/jobs/__init__.py +352 -3
- blaxel/core/sandbox/client/models/__init__.py +0 -16
- blaxel/core/sandbox/default/action.py +10 -27
- blaxel/core/sandbox/default/filesystem.py +47 -185
- blaxel/core/sandbox/default/interpreter.py +55 -62
- blaxel/core/sandbox/default/process.py +46 -66
- {blaxel-0.2.26rc119.dist-info → blaxel-0.2.27.dist-info}/METADATA +2 -3
- {blaxel-0.2.26rc119.dist-info → blaxel-0.2.27.dist-info}/RECORD +91 -114
- blaxel/core/client/api/privateclusters/__init__.py +0 -0
- blaxel/core/client/api/privateclusters/delete_private_cluster.py +0 -152
- blaxel/core/client/api/privateclusters/get_private_cluster.py +0 -155
- blaxel/core/client/api/privateclusters/get_private_cluster_health.py +0 -97
- blaxel/core/client/api/privateclusters/list_private_clusters.py +0 -136
- blaxel/core/client/api/privateclusters/update_private_cluster.py +0 -152
- blaxel/core/client/api/privateclusters/update_private_cluster_health.py +0 -97
- blaxel/core/client/models/model_private_cluster.py +0 -79
- blaxel/core/client/models/private_cluster.py +0 -183
- blaxel/core/sandbox/client/api/filesystem/delete_filesystem_tree_path.py +0 -188
- blaxel/core/sandbox/client/api/filesystem/get_filesystem_content_search_path.py +0 -265
- blaxel/core/sandbox/client/api/filesystem/get_filesystem_find_path.py +0 -248
- blaxel/core/sandbox/client/api/filesystem/get_filesystem_search_path.py +0 -237
- blaxel/core/sandbox/client/api/filesystem/get_filesystem_tree_path.py +0 -197
- blaxel/core/sandbox/client/api/filesystem/put_filesystem_tree_path.py +0 -223
- blaxel/core/sandbox/client/api/websocket/__init__.py +0 -0
- blaxel/core/sandbox/client/api/websocket/get_ws.py +0 -81
- blaxel/core/sandbox/client/models/content_search_match.py +0 -98
- blaxel/core/sandbox/client/models/content_search_response.py +0 -97
- blaxel/core/sandbox/client/models/find_response.py +0 -88
- blaxel/core/sandbox/client/models/fuzzy_search_match.py +0 -78
- blaxel/core/sandbox/client/models/fuzzy_search_response.py +0 -88
- blaxel/core/sandbox/client/models/tree_request.py +0 -76
- blaxel/core/sandbox/client/models/tree_request_files.py +0 -49
- {blaxel-0.2.26rc119.dist-info → blaxel-0.2.27.dist-info}/WHEEL +0 -0
- {blaxel-0.2.26rc119.dist-info → blaxel-0.2.27.dist-info}/licenses/LICENSE +0 -0
|
@@ -16,12 +16,14 @@ class RevisionConfiguration:
|
|
|
16
16
|
active (Union[Unset, str]): Active revision id
|
|
17
17
|
canary (Union[Unset, str]): Canary revision id
|
|
18
18
|
canary_percent (Union[Unset, int]): Canary revision percent
|
|
19
|
+
sticky_session_ttl (Union[Unset, int]): Sticky session TTL in seconds (0 = disabled)
|
|
19
20
|
traffic (Union[Unset, int]): Traffic percentage
|
|
20
21
|
"""
|
|
21
22
|
|
|
22
23
|
active: Union[Unset, str] = UNSET
|
|
23
24
|
canary: Union[Unset, str] = UNSET
|
|
24
25
|
canary_percent: Union[Unset, int] = UNSET
|
|
26
|
+
sticky_session_ttl: Union[Unset, int] = UNSET
|
|
25
27
|
traffic: Union[Unset, int] = UNSET
|
|
26
28
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
27
29
|
|
|
@@ -32,6 +34,8 @@ class RevisionConfiguration:
|
|
|
32
34
|
|
|
33
35
|
canary_percent = self.canary_percent
|
|
34
36
|
|
|
37
|
+
sticky_session_ttl = self.sticky_session_ttl
|
|
38
|
+
|
|
35
39
|
traffic = self.traffic
|
|
36
40
|
|
|
37
41
|
field_dict: dict[str, Any] = {}
|
|
@@ -43,6 +47,8 @@ class RevisionConfiguration:
|
|
|
43
47
|
field_dict["canary"] = canary
|
|
44
48
|
if canary_percent is not UNSET:
|
|
45
49
|
field_dict["canaryPercent"] = canary_percent
|
|
50
|
+
if sticky_session_ttl is not UNSET:
|
|
51
|
+
field_dict["stickySessionTtl"] = sticky_session_ttl
|
|
46
52
|
if traffic is not UNSET:
|
|
47
53
|
field_dict["traffic"] = traffic
|
|
48
54
|
|
|
@@ -59,12 +65,15 @@ class RevisionConfiguration:
|
|
|
59
65
|
|
|
60
66
|
canary_percent = d.pop("canaryPercent", UNSET)
|
|
61
67
|
|
|
68
|
+
sticky_session_ttl = d.pop("stickySessionTtl", UNSET)
|
|
69
|
+
|
|
62
70
|
traffic = d.pop("traffic", UNSET)
|
|
63
71
|
|
|
64
72
|
revision_configuration = cls(
|
|
65
73
|
active=active,
|
|
66
74
|
canary=canary,
|
|
67
75
|
canary_percent=canary_percent,
|
|
76
|
+
sticky_session_ttl=sticky_session_ttl,
|
|
68
77
|
traffic=traffic,
|
|
69
78
|
)
|
|
70
79
|
|
|
@@ -50,6 +50,7 @@ class SandboxDefinition:
|
|
|
50
50
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
51
51
|
|
|
52
52
|
def to_dict(self) -> dict[str, Any]:
|
|
53
|
+
|
|
53
54
|
categories: Union[Unset, list[Any]] = UNSET
|
|
54
55
|
if not isinstance(self.categories, Unset):
|
|
55
56
|
categories = self.categories
|
|
@@ -24,6 +24,7 @@ class SandboxLifecycle:
|
|
|
24
24
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
25
25
|
|
|
26
26
|
def to_dict(self) -> dict[str, Any]:
|
|
27
|
+
|
|
27
28
|
expiration_policies: Union[Unset, list[dict[str, Any]]] = UNSET
|
|
28
29
|
if not isinstance(self.expiration_policies, Unset):
|
|
29
30
|
expiration_policies = []
|
|
@@ -8,7 +8,6 @@ from ..types import UNSET, Unset
|
|
|
8
8
|
if TYPE_CHECKING:
|
|
9
9
|
from ..models.core_spec_configurations import CoreSpecConfigurations
|
|
10
10
|
from ..models.flavor import Flavor
|
|
11
|
-
from ..models.model_private_cluster import ModelPrivateCluster
|
|
12
11
|
from ..models.revision_configuration import RevisionConfiguration
|
|
13
12
|
from ..models.runtime import Runtime
|
|
14
13
|
from ..models.sandbox_lifecycle import SandboxLifecycle
|
|
@@ -28,7 +27,6 @@ class SandboxSpec:
|
|
|
28
27
|
flavors (Union[Unset, list['Flavor']]): Types of hardware available for deployments
|
|
29
28
|
integration_connections (Union[Unset, list[str]]):
|
|
30
29
|
policies (Union[Unset, list[str]]):
|
|
31
|
-
private_clusters (Union[Unset, ModelPrivateCluster]): Private cluster where the model deployment is deployed
|
|
32
30
|
revision (Union[Unset, RevisionConfiguration]): Revision configuration
|
|
33
31
|
runtime (Union[Unset, Runtime]): Set of configurations for a deployment
|
|
34
32
|
sandbox (Union[Unset, bool]): Sandbox mode
|
|
@@ -42,7 +40,6 @@ class SandboxSpec:
|
|
|
42
40
|
flavors: Union[Unset, list["Flavor"]] = UNSET
|
|
43
41
|
integration_connections: Union[Unset, list[str]] = UNSET
|
|
44
42
|
policies: Union[Unset, list[str]] = UNSET
|
|
45
|
-
private_clusters: Union[Unset, "ModelPrivateCluster"] = UNSET
|
|
46
43
|
revision: Union[Unset, "RevisionConfiguration"] = UNSET
|
|
47
44
|
runtime: Union[Unset, "Runtime"] = UNSET
|
|
48
45
|
sandbox: Union[Unset, bool] = UNSET
|
|
@@ -52,6 +49,7 @@ class SandboxSpec:
|
|
|
52
49
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
53
50
|
|
|
54
51
|
def to_dict(self) -> dict[str, Any]:
|
|
52
|
+
|
|
55
53
|
configurations: Union[Unset, dict[str, Any]] = UNSET
|
|
56
54
|
if (
|
|
57
55
|
self.configurations
|
|
@@ -82,16 +80,6 @@ class SandboxSpec:
|
|
|
82
80
|
if not isinstance(self.policies, Unset):
|
|
83
81
|
policies = self.policies
|
|
84
82
|
|
|
85
|
-
private_clusters: Union[Unset, dict[str, Any]] = UNSET
|
|
86
|
-
if (
|
|
87
|
-
self.private_clusters
|
|
88
|
-
and not isinstance(self.private_clusters, Unset)
|
|
89
|
-
and not isinstance(self.private_clusters, dict)
|
|
90
|
-
):
|
|
91
|
-
private_clusters = self.private_clusters.to_dict()
|
|
92
|
-
elif self.private_clusters and isinstance(self.private_clusters, dict):
|
|
93
|
-
private_clusters = self.private_clusters
|
|
94
|
-
|
|
95
83
|
revision: Union[Unset, dict[str, Any]] = UNSET
|
|
96
84
|
if self.revision and not isinstance(self.revision, Unset) and not isinstance(self.revision, dict):
|
|
97
85
|
revision = self.revision.to_dict()
|
|
@@ -137,8 +125,6 @@ class SandboxSpec:
|
|
|
137
125
|
field_dict["integrationConnections"] = integration_connections
|
|
138
126
|
if policies is not UNSET:
|
|
139
127
|
field_dict["policies"] = policies
|
|
140
|
-
if private_clusters is not UNSET:
|
|
141
|
-
field_dict["privateClusters"] = private_clusters
|
|
142
128
|
if revision is not UNSET:
|
|
143
129
|
field_dict["revision"] = revision
|
|
144
130
|
if runtime is not UNSET:
|
|
@@ -158,7 +144,6 @@ class SandboxSpec:
|
|
|
158
144
|
def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
|
|
159
145
|
from ..models.core_spec_configurations import CoreSpecConfigurations
|
|
160
146
|
from ..models.flavor import Flavor
|
|
161
|
-
from ..models.model_private_cluster import ModelPrivateCluster
|
|
162
147
|
from ..models.revision_configuration import RevisionConfiguration
|
|
163
148
|
from ..models.runtime import Runtime
|
|
164
149
|
from ..models.sandbox_lifecycle import SandboxLifecycle
|
|
@@ -187,13 +172,6 @@ class SandboxSpec:
|
|
|
187
172
|
|
|
188
173
|
policies = cast(list[str], d.pop("policies", UNSET))
|
|
189
174
|
|
|
190
|
-
_private_clusters = d.pop("privateClusters", UNSET)
|
|
191
|
-
private_clusters: Union[Unset, ModelPrivateCluster]
|
|
192
|
-
if isinstance(_private_clusters, Unset):
|
|
193
|
-
private_clusters = UNSET
|
|
194
|
-
else:
|
|
195
|
-
private_clusters = ModelPrivateCluster.from_dict(_private_clusters)
|
|
196
|
-
|
|
197
175
|
_revision = d.pop("revision", UNSET)
|
|
198
176
|
revision: Union[Unset, RevisionConfiguration]
|
|
199
177
|
if isinstance(_revision, Unset):
|
|
@@ -234,7 +212,6 @@ class SandboxSpec:
|
|
|
234
212
|
flavors=flavors,
|
|
235
213
|
integration_connections=integration_connections,
|
|
236
214
|
policies=policies,
|
|
237
|
-
private_clusters=private_clusters,
|
|
238
215
|
revision=revision,
|
|
239
216
|
runtime=runtime,
|
|
240
217
|
sandbox=sandbox,
|
|
@@ -40,6 +40,7 @@ class StoreConfiguration:
|
|
|
40
40
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
41
41
|
|
|
42
42
|
def to_dict(self) -> dict[str, Any]:
|
|
43
|
+
|
|
43
44
|
available_models: Union[Unset, list[str]] = UNSET
|
|
44
45
|
if not isinstance(self.available_models, Unset):
|
|
45
46
|
available_models = self.available_models
|
|
@@ -25,6 +25,7 @@ class TimeToFirstTokenOverTimeMetrics:
|
|
|
25
25
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
26
26
|
|
|
27
27
|
def to_dict(self) -> dict[str, Any]:
|
|
28
|
+
|
|
28
29
|
time_to_first_token_over_time: Union[Unset, list[dict[str, Any]]] = UNSET
|
|
29
30
|
if not isinstance(self.time_to_first_token_over_time, Unset):
|
|
30
31
|
time_to_first_token_over_time = []
|
|
@@ -28,6 +28,7 @@ class TokenRateMetrics:
|
|
|
28
28
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
29
29
|
|
|
30
30
|
def to_dict(self) -> dict[str, Any]:
|
|
31
|
+
|
|
31
32
|
token_rate: Union[Unset, list[dict[str, Any]]] = UNSET
|
|
32
33
|
if not isinstance(self.token_rate, Unset):
|
|
33
34
|
token_rate = []
|
|
@@ -18,16 +18,19 @@ class Trigger:
|
|
|
18
18
|
|
|
19
19
|
Attributes:
|
|
20
20
|
configuration (Union[Unset, TriggerConfiguration]): Trigger configuration
|
|
21
|
+
enabled (Union[Unset, bool]): Enable or disable the trigger (default: true)
|
|
21
22
|
id (Union[Unset, str]): The id of the trigger
|
|
22
23
|
type_ (Union[Unset, str]): The type of trigger, can be http or http-async
|
|
23
24
|
"""
|
|
24
25
|
|
|
25
26
|
configuration: Union[Unset, "TriggerConfiguration"] = UNSET
|
|
27
|
+
enabled: Union[Unset, bool] = UNSET
|
|
26
28
|
id: Union[Unset, str] = UNSET
|
|
27
29
|
type_: Union[Unset, str] = UNSET
|
|
28
30
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
29
31
|
|
|
30
32
|
def to_dict(self) -> dict[str, Any]:
|
|
33
|
+
|
|
31
34
|
configuration: Union[Unset, dict[str, Any]] = UNSET
|
|
32
35
|
if (
|
|
33
36
|
self.configuration
|
|
@@ -38,6 +41,8 @@ class Trigger:
|
|
|
38
41
|
elif self.configuration and isinstance(self.configuration, dict):
|
|
39
42
|
configuration = self.configuration
|
|
40
43
|
|
|
44
|
+
enabled = self.enabled
|
|
45
|
+
|
|
41
46
|
id = self.id
|
|
42
47
|
|
|
43
48
|
type_ = self.type_
|
|
@@ -47,6 +52,8 @@ class Trigger:
|
|
|
47
52
|
field_dict.update({})
|
|
48
53
|
if configuration is not UNSET:
|
|
49
54
|
field_dict["configuration"] = configuration
|
|
55
|
+
if enabled is not UNSET:
|
|
56
|
+
field_dict["enabled"] = enabled
|
|
50
57
|
if id is not UNSET:
|
|
51
58
|
field_dict["id"] = id
|
|
52
59
|
if type_ is not UNSET:
|
|
@@ -68,12 +75,15 @@ class Trigger:
|
|
|
68
75
|
else:
|
|
69
76
|
configuration = TriggerConfiguration.from_dict(_configuration)
|
|
70
77
|
|
|
78
|
+
enabled = d.pop("enabled", UNSET)
|
|
79
|
+
|
|
71
80
|
id = d.pop("id", UNSET)
|
|
72
81
|
|
|
73
82
|
type_ = d.pop("type", UNSET)
|
|
74
83
|
|
|
75
84
|
trigger = cls(
|
|
76
85
|
configuration=configuration,
|
|
86
|
+
enabled=enabled,
|
|
77
87
|
id=id,
|
|
78
88
|
type_=type_,
|
|
79
89
|
)
|
|
@@ -18,22 +18,33 @@ class TriggerConfiguration:
|
|
|
18
18
|
|
|
19
19
|
Attributes:
|
|
20
20
|
authentication_type (Union[Unset, str]): The authentication type of the trigger
|
|
21
|
+
callback_secret (Union[Unset, str]): The callback secret for async triggers (auto-generated, encrypted)
|
|
22
|
+
callback_url (Union[Unset, str]): The callback URL for async triggers (optional)
|
|
21
23
|
path (Union[Unset, str]): The path of the trigger
|
|
22
24
|
retry (Union[Unset, int]): The retry of the trigger
|
|
23
25
|
schedule (Union[Unset, str]): The schedule of the trigger, cron expression * * * * *
|
|
24
26
|
tasks (Union[Unset, list['TriggerConfigurationTask']]): The tasks configuration of the cronjob
|
|
27
|
+
timeout (Union[Unset, int]): The timeout in seconds for async triggers (max 900s, MK3 only)
|
|
25
28
|
"""
|
|
26
29
|
|
|
27
30
|
authentication_type: Union[Unset, str] = UNSET
|
|
31
|
+
callback_secret: Union[Unset, str] = UNSET
|
|
32
|
+
callback_url: Union[Unset, str] = UNSET
|
|
28
33
|
path: Union[Unset, str] = UNSET
|
|
29
34
|
retry: Union[Unset, int] = UNSET
|
|
30
35
|
schedule: Union[Unset, str] = UNSET
|
|
31
36
|
tasks: Union[Unset, list["TriggerConfigurationTask"]] = UNSET
|
|
37
|
+
timeout: Union[Unset, int] = UNSET
|
|
32
38
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
33
39
|
|
|
34
40
|
def to_dict(self) -> dict[str, Any]:
|
|
41
|
+
|
|
35
42
|
authentication_type = self.authentication_type
|
|
36
43
|
|
|
44
|
+
callback_secret = self.callback_secret
|
|
45
|
+
|
|
46
|
+
callback_url = self.callback_url
|
|
47
|
+
|
|
37
48
|
path = self.path
|
|
38
49
|
|
|
39
50
|
retry = self.retry
|
|
@@ -50,11 +61,17 @@ class TriggerConfiguration:
|
|
|
50
61
|
tasks_item = tasks_item_data.to_dict()
|
|
51
62
|
tasks.append(tasks_item)
|
|
52
63
|
|
|
64
|
+
timeout = self.timeout
|
|
65
|
+
|
|
53
66
|
field_dict: dict[str, Any] = {}
|
|
54
67
|
field_dict.update(self.additional_properties)
|
|
55
68
|
field_dict.update({})
|
|
56
69
|
if authentication_type is not UNSET:
|
|
57
70
|
field_dict["authenticationType"] = authentication_type
|
|
71
|
+
if callback_secret is not UNSET:
|
|
72
|
+
field_dict["callbackSecret"] = callback_secret
|
|
73
|
+
if callback_url is not UNSET:
|
|
74
|
+
field_dict["callbackUrl"] = callback_url
|
|
58
75
|
if path is not UNSET:
|
|
59
76
|
field_dict["path"] = path
|
|
60
77
|
if retry is not UNSET:
|
|
@@ -63,6 +80,8 @@ class TriggerConfiguration:
|
|
|
63
80
|
field_dict["schedule"] = schedule
|
|
64
81
|
if tasks is not UNSET:
|
|
65
82
|
field_dict["tasks"] = tasks
|
|
83
|
+
if timeout is not UNSET:
|
|
84
|
+
field_dict["timeout"] = timeout
|
|
66
85
|
|
|
67
86
|
return field_dict
|
|
68
87
|
|
|
@@ -75,6 +94,10 @@ class TriggerConfiguration:
|
|
|
75
94
|
d = src_dict.copy()
|
|
76
95
|
authentication_type = d.pop("authenticationType", UNSET)
|
|
77
96
|
|
|
97
|
+
callback_secret = d.pop("callbackSecret", UNSET)
|
|
98
|
+
|
|
99
|
+
callback_url = d.pop("callbackUrl", UNSET)
|
|
100
|
+
|
|
78
101
|
path = d.pop("path", UNSET)
|
|
79
102
|
|
|
80
103
|
retry = d.pop("retry", UNSET)
|
|
@@ -88,12 +111,17 @@ class TriggerConfiguration:
|
|
|
88
111
|
|
|
89
112
|
tasks.append(tasks_item)
|
|
90
113
|
|
|
114
|
+
timeout = d.pop("timeout", UNSET)
|
|
115
|
+
|
|
91
116
|
trigger_configuration = cls(
|
|
92
117
|
authentication_type=authentication_type,
|
|
118
|
+
callback_secret=callback_secret,
|
|
119
|
+
callback_url=callback_url,
|
|
93
120
|
path=path,
|
|
94
121
|
retry=retry,
|
|
95
122
|
schedule=schedule,
|
|
96
123
|
tasks=tasks,
|
|
124
|
+
timeout=timeout,
|
|
97
125
|
)
|
|
98
126
|
|
|
99
127
|
trigger_configuration.additional_properties = d
|
|
@@ -33,6 +33,7 @@ class VolumeTemplate:
|
|
|
33
33
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
34
34
|
|
|
35
35
|
def to_dict(self) -> dict[str, Any]:
|
|
36
|
+
|
|
36
37
|
metadata: Union[Unset, dict[str, Any]] = UNSET
|
|
37
38
|
if self.metadata and not isinstance(self.metadata, Unset) and not isinstance(self.metadata, dict):
|
|
38
39
|
metadata = self.metadata.to_dict()
|
|
@@ -16,12 +16,14 @@ class WebsocketChannel:
|
|
|
16
16
|
created_at (Union[Unset, str]): The date and time when the resource was created
|
|
17
17
|
updated_at (Union[Unset, str]): The date and time when the resource was updated
|
|
18
18
|
connection_id (Union[Unset, str]): Unique connection ID
|
|
19
|
+
source_region (Union[Unset, str]): Source region the connection belongs to
|
|
19
20
|
workspace (Union[Unset, str]): Workspace the connection belongs to
|
|
20
21
|
"""
|
|
21
22
|
|
|
22
23
|
created_at: Union[Unset, str] = UNSET
|
|
23
24
|
updated_at: Union[Unset, str] = UNSET
|
|
24
25
|
connection_id: Union[Unset, str] = UNSET
|
|
26
|
+
source_region: Union[Unset, str] = UNSET
|
|
25
27
|
workspace: Union[Unset, str] = UNSET
|
|
26
28
|
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
27
29
|
|
|
@@ -32,6 +34,8 @@ class WebsocketChannel:
|
|
|
32
34
|
|
|
33
35
|
connection_id = self.connection_id
|
|
34
36
|
|
|
37
|
+
source_region = self.source_region
|
|
38
|
+
|
|
35
39
|
workspace = self.workspace
|
|
36
40
|
|
|
37
41
|
field_dict: dict[str, Any] = {}
|
|
@@ -43,6 +47,8 @@ class WebsocketChannel:
|
|
|
43
47
|
field_dict["updatedAt"] = updated_at
|
|
44
48
|
if connection_id is not UNSET:
|
|
45
49
|
field_dict["connection_id"] = connection_id
|
|
50
|
+
if source_region is not UNSET:
|
|
51
|
+
field_dict["sourceRegion"] = source_region
|
|
46
52
|
if workspace is not UNSET:
|
|
47
53
|
field_dict["workspace"] = workspace
|
|
48
54
|
|
|
@@ -59,12 +65,15 @@ class WebsocketChannel:
|
|
|
59
65
|
|
|
60
66
|
connection_id = d.pop("connection_id", UNSET)
|
|
61
67
|
|
|
68
|
+
source_region = d.pop("sourceRegion", UNSET)
|
|
69
|
+
|
|
62
70
|
workspace = d.pop("workspace", UNSET)
|
|
63
71
|
|
|
64
72
|
websocket_channel = cls(
|
|
65
73
|
created_at=created_at,
|
|
66
74
|
updated_at=updated_at,
|
|
67
75
|
connection_id=connection_id,
|
|
76
|
+
source_region=source_region,
|
|
68
77
|
workspace=workspace,
|
|
69
78
|
)
|
|
70
79
|
|
blaxel/core/common/__init__.py
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
from .autoload import autoload
|
|
1
|
+
from .autoload import autoload
|
|
2
2
|
from .env import env
|
|
3
3
|
from .internal import get_alphanumeric_limited_hash, get_global_unique_hash
|
|
4
4
|
from .settings import Settings, settings
|
|
5
|
+
from .webhook import (
|
|
6
|
+
AsyncSidecarCallback,
|
|
7
|
+
RequestLike,
|
|
8
|
+
verify_webhook_from_request,
|
|
9
|
+
verify_webhook_signature,
|
|
10
|
+
)
|
|
5
11
|
|
|
6
12
|
__all__ = [
|
|
7
13
|
"autoload",
|
|
8
|
-
"capture_exception",
|
|
9
14
|
"Settings",
|
|
10
15
|
"settings",
|
|
11
16
|
"env",
|
|
12
17
|
"get_alphanumeric_limited_hash",
|
|
13
18
|
"get_global_unique_hash",
|
|
19
|
+
"verify_webhook_signature",
|
|
20
|
+
"verify_webhook_from_request",
|
|
21
|
+
"AsyncSidecarCallback",
|
|
22
|
+
"RequestLike",
|
|
14
23
|
]
|
blaxel/core/common/autoload.py
CHANGED
|
@@ -1,91 +1,12 @@
|
|
|
1
|
-
import atexit
|
|
2
1
|
import logging
|
|
3
|
-
import sys
|
|
4
|
-
import threading
|
|
5
|
-
|
|
6
|
-
from sentry_sdk import Client, Hub
|
|
7
2
|
|
|
8
3
|
from ..client import client
|
|
9
|
-
from ..client.response_interceptor import
|
|
10
|
-
response_interceptors_async,
|
|
11
|
-
response_interceptors_sync,
|
|
12
|
-
)
|
|
4
|
+
from ..client.response_interceptor import response_interceptors_async, response_interceptors_sync
|
|
13
5
|
from ..sandbox.client import client as client_sandbox
|
|
14
6
|
from .settings import settings
|
|
15
7
|
|
|
16
8
|
logger = logging.getLogger(__name__)
|
|
17
9
|
|
|
18
|
-
# Isolated Sentry hub for SDK-only error tracking (doesn't interfere with user's Sentry)
|
|
19
|
-
_sentry_hub: Hub | None = None
|
|
20
|
-
_captured_exceptions: set = set() # Track already captured exceptions to avoid duplicates
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def _trace_blaxel_exceptions(frame, event, arg):
|
|
24
|
-
"""Trace function that captures exceptions from blaxel SDK code."""
|
|
25
|
-
if event == 'exception':
|
|
26
|
-
exc_type, exc_value, exc_tb = arg
|
|
27
|
-
filename = frame.f_code.co_filename
|
|
28
|
-
|
|
29
|
-
# Only capture if it's from blaxel in site-packages
|
|
30
|
-
if 'site-packages/blaxel' in filename:
|
|
31
|
-
# Avoid capturing the same exception multiple times
|
|
32
|
-
exc_id = id(exc_value)
|
|
33
|
-
if exc_id not in _captured_exceptions:
|
|
34
|
-
_captured_exceptions.add(exc_id)
|
|
35
|
-
capture_exception(exc_value)
|
|
36
|
-
# Clean up old exception IDs to prevent memory leak
|
|
37
|
-
if len(_captured_exceptions) > 1000:
|
|
38
|
-
_captured_exceptions.clear()
|
|
39
|
-
|
|
40
|
-
return _trace_blaxel_exceptions
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def sentry() -> None:
|
|
44
|
-
"""Initialize an isolated Sentry client for SDK error tracking."""
|
|
45
|
-
global _sentry_hub
|
|
46
|
-
try:
|
|
47
|
-
dsn = settings.sentry_dsn
|
|
48
|
-
if not dsn:
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
# Create an isolated client that won't interfere with user's Sentry
|
|
52
|
-
sentry_client = Client(
|
|
53
|
-
dsn=dsn,
|
|
54
|
-
environment=settings.env,
|
|
55
|
-
release=f"sdk-python@{settings.version}",
|
|
56
|
-
default_integrations=False,
|
|
57
|
-
auto_enabling_integrations=False,
|
|
58
|
-
)
|
|
59
|
-
_sentry_hub = Hub(sentry_client)
|
|
60
|
-
|
|
61
|
-
# Set SDK-specific tags
|
|
62
|
-
with _sentry_hub.configure_scope() as scope:
|
|
63
|
-
scope.set_tag("blaxel.workspace", settings.workspace)
|
|
64
|
-
scope.set_tag("blaxel.version", settings.version)
|
|
65
|
-
scope.set_tag("blaxel.commit", settings.commit)
|
|
66
|
-
|
|
67
|
-
# Install trace function to automatically capture SDK exceptions
|
|
68
|
-
sys.settrace(_trace_blaxel_exceptions)
|
|
69
|
-
threading.settrace(_trace_blaxel_exceptions)
|
|
70
|
-
|
|
71
|
-
# Register atexit handler to flush pending events
|
|
72
|
-
atexit.register(_flush_sentry)
|
|
73
|
-
|
|
74
|
-
except Exception as e:
|
|
75
|
-
logger.debug(f"Error initializing Sentry: {e}")
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
def capture_exception(exception: Exception | None = None) -> None:
|
|
79
|
-
"""Capture an exception to the SDK's isolated Sentry hub."""
|
|
80
|
-
if _sentry_hub is not None and _sentry_hub.client is not None:
|
|
81
|
-
_sentry_hub.capture_exception(exception)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
def _flush_sentry():
|
|
85
|
-
"""Flush pending Sentry events on program exit."""
|
|
86
|
-
if _sentry_hub is not None and _sentry_hub.client is not None:
|
|
87
|
-
_sentry_hub.client.flush(timeout=2)
|
|
88
|
-
|
|
89
10
|
|
|
90
11
|
def telemetry() -> None:
|
|
91
12
|
from blaxel.telemetry import telemetry_manager
|
|
@@ -112,11 +33,6 @@ def autoload() -> None:
|
|
|
112
33
|
httpx_sandbox_async_client = client_sandbox.get_async_httpx_client()
|
|
113
34
|
httpx_sandbox_async_client.event_hooks["response"] = response_interceptors_async
|
|
114
35
|
|
|
115
|
-
try:
|
|
116
|
-
sentry()
|
|
117
|
-
except Exception:
|
|
118
|
-
pass
|
|
119
|
-
|
|
120
36
|
try:
|
|
121
37
|
telemetry()
|
|
122
38
|
except Exception:
|