blaxel 0.1.16rc60__py3-none-any.whl → 0.1.18rc61__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 (60) hide show
  1. blaxel/authentication/clientcredentials.py +1 -1
  2. blaxel/client/api/jobs/__init__.py +0 -0
  3. blaxel/client/api/{default/get_template_file_contents.py → jobs/create_job.py} +57 -44
  4. blaxel/client/api/jobs/delete_job.py +154 -0
  5. blaxel/client/api/{default/get_template_contents.py → jobs/get_job.py} +43 -30
  6. blaxel/client/api/jobs/list_job_revisions.py +159 -0
  7. blaxel/client/api/jobs/list_jobs.py +135 -0
  8. blaxel/client/api/jobs/update_job.py +179 -0
  9. blaxel/client/models/__init__.py +34 -0
  10. blaxel/client/models/job.py +129 -0
  11. blaxel/client/models/job_execution_config.py +79 -0
  12. blaxel/client/models/job_metrics.py +199 -0
  13. blaxel/client/models/job_metrics_executions_chart.py +45 -0
  14. blaxel/client/models/job_metrics_executions_total.py +45 -0
  15. blaxel/client/models/job_metrics_tasks_chart.py +45 -0
  16. blaxel/client/models/job_metrics_tasks_total.py +45 -0
  17. blaxel/client/models/job_spec.py +208 -0
  18. blaxel/client/models/jobs_chart.py +94 -0
  19. blaxel/client/models/jobs_chart_value.py +70 -0
  20. blaxel/client/models/jobs_executions.py +88 -0
  21. blaxel/client/models/jobs_network_chart.py +94 -0
  22. blaxel/client/models/jobs_success_failed_chart.py +139 -0
  23. blaxel/client/models/jobs_tasks.py +88 -0
  24. blaxel/client/models/jobs_total.py +97 -0
  25. blaxel/client/models/preview_spec.py +55 -1
  26. blaxel/client/models/preview_spec_request_headers.py +48 -0
  27. blaxel/{sandbox/client/models/get_process_identifier_logs_response_200.py → client/models/preview_spec_response_headers.py} +6 -6
  28. blaxel/client/models/runtime.py +18 -0
  29. blaxel/client/models/serverless_config.py +9 -0
  30. blaxel/common/internal.py +0 -2
  31. blaxel/common/logger.py +2 -0
  32. blaxel/instrumentation/manager.py +1 -1
  33. blaxel/jobs/__init__.py +4 -8
  34. blaxel/sandbox/client/api/filesystem/delete_filesystem_path.py +4 -0
  35. blaxel/sandbox/client/api/filesystem/get_filesystem_path.py +4 -0
  36. blaxel/sandbox/client/api/filesystem/get_watch_filesystem_path.py +22 -1
  37. blaxel/sandbox/client/api/filesystem/put_filesystem_path.py +8 -4
  38. blaxel/sandbox/client/api/network/delete_network_process_pid_monitor.py +4 -0
  39. blaxel/sandbox/client/api/network/get_network_process_pid_ports.py +4 -0
  40. blaxel/sandbox/client/api/network/post_network_process_pid_monitor.py +4 -0
  41. blaxel/sandbox/client/api/process/delete_process_identifier.py +4 -0
  42. blaxel/sandbox/client/api/process/delete_process_identifier_kill.py +4 -0
  43. blaxel/sandbox/client/api/process/get_process_identifier_logs.py +16 -16
  44. blaxel/sandbox/client/api/process/get_process_identifier_logs_stream.py +4 -0
  45. blaxel/sandbox/client/api/process/get_ws_process_identifier_logs_stream.py +8 -8
  46. blaxel/sandbox/client/api/process/post_process.py +4 -0
  47. blaxel/sandbox/client/models/__init__.py +4 -2
  48. blaxel/sandbox/client/models/directory.py +9 -0
  49. blaxel/sandbox/client/models/file.py +9 -0
  50. blaxel/sandbox/client/models/file_with_content.py +9 -0
  51. blaxel/sandbox/client/models/process_logs.py +78 -0
  52. blaxel/sandbox/client/models/process_response.py +12 -4
  53. blaxel/sandbox/client/models/process_response_status.py +12 -0
  54. blaxel/sandbox/client/models/subdirectory.py +9 -0
  55. blaxel/sandbox/preview.py +13 -17
  56. blaxel/sandbox/process.py +8 -9
  57. {blaxel-0.1.16rc60.dist-info → blaxel-0.1.18rc61.dist-info}/METADATA +1 -1
  58. {blaxel-0.1.16rc60.dist-info → blaxel-0.1.18rc61.dist-info}/RECORD +60 -37
  59. {blaxel-0.1.16rc60.dist-info → blaxel-0.1.18rc61.dist-info}/WHEEL +0 -0
  60. {blaxel-0.1.16rc60.dist-info → blaxel-0.1.18rc61.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,199 @@
1
+ from typing import TYPE_CHECKING, 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
+ if TYPE_CHECKING:
9
+ from ..models.job_metrics_executions_chart import JobMetricsExecutionsChart
10
+ from ..models.job_metrics_executions_total import JobMetricsExecutionsTotal
11
+ from ..models.job_metrics_tasks_chart import JobMetricsTasksChart
12
+ from ..models.job_metrics_tasks_total import JobMetricsTasksTotal
13
+
14
+
15
+ T = TypeVar("T", bound="JobMetrics")
16
+
17
+
18
+ @_attrs_define
19
+ class JobMetrics:
20
+ """Metrics for job
21
+
22
+ Attributes:
23
+ billable_time (Union[Unset, list[Any]]): Billable time
24
+ cpu_usage (Union[Unset, list[Any]]): CPU usage
25
+ executions_chart (Union[Unset, JobMetricsExecutionsChart]): Executions chart
26
+ executions_running (Union[Unset, list[Any]]): Executions running
27
+ executions_total (Union[Unset, JobMetricsExecutionsTotal]): Total executions
28
+ ram_usage (Union[Unset, list[Any]]): RAM usage
29
+ tasks_chart (Union[Unset, JobMetricsTasksChart]): Tasks chart
30
+ tasks_running (Union[Unset, list[Any]]): Tasks running
31
+ tasks_total (Union[Unset, JobMetricsTasksTotal]): Total tasks
32
+ """
33
+
34
+ billable_time: Union[Unset, list[Any]] = UNSET
35
+ cpu_usage: Union[Unset, list[Any]] = UNSET
36
+ executions_chart: Union[Unset, "JobMetricsExecutionsChart"] = UNSET
37
+ executions_running: Union[Unset, list[Any]] = UNSET
38
+ executions_total: Union[Unset, "JobMetricsExecutionsTotal"] = UNSET
39
+ ram_usage: Union[Unset, list[Any]] = UNSET
40
+ tasks_chart: Union[Unset, "JobMetricsTasksChart"] = UNSET
41
+ tasks_running: Union[Unset, list[Any]] = UNSET
42
+ tasks_total: Union[Unset, "JobMetricsTasksTotal"] = UNSET
43
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
44
+
45
+ def to_dict(self) -> dict[str, Any]:
46
+ billable_time: Union[Unset, list[Any]] = UNSET
47
+ if not isinstance(self.billable_time, Unset):
48
+ billable_time = self.billable_time
49
+
50
+ cpu_usage: Union[Unset, list[Any]] = UNSET
51
+ if not isinstance(self.cpu_usage, Unset):
52
+ cpu_usage = self.cpu_usage
53
+
54
+ executions_chart: Union[Unset, dict[str, Any]] = UNSET
55
+ if (
56
+ self.executions_chart
57
+ and not isinstance(self.executions_chart, Unset)
58
+ and not isinstance(self.executions_chart, dict)
59
+ ):
60
+ executions_chart = self.executions_chart.to_dict()
61
+ elif self.executions_chart and isinstance(self.executions_chart, dict):
62
+ executions_chart = self.executions_chart
63
+
64
+ executions_running: Union[Unset, list[Any]] = UNSET
65
+ if not isinstance(self.executions_running, Unset):
66
+ executions_running = self.executions_running
67
+
68
+ executions_total: Union[Unset, dict[str, Any]] = UNSET
69
+ if (
70
+ self.executions_total
71
+ and not isinstance(self.executions_total, Unset)
72
+ and not isinstance(self.executions_total, dict)
73
+ ):
74
+ executions_total = self.executions_total.to_dict()
75
+ elif self.executions_total and isinstance(self.executions_total, dict):
76
+ executions_total = self.executions_total
77
+
78
+ ram_usage: Union[Unset, list[Any]] = UNSET
79
+ if not isinstance(self.ram_usage, Unset):
80
+ ram_usage = self.ram_usage
81
+
82
+ tasks_chart: Union[Unset, dict[str, Any]] = UNSET
83
+ if self.tasks_chart and not isinstance(self.tasks_chart, Unset) and not isinstance(self.tasks_chart, dict):
84
+ tasks_chart = self.tasks_chart.to_dict()
85
+ elif self.tasks_chart and isinstance(self.tasks_chart, dict):
86
+ tasks_chart = self.tasks_chart
87
+
88
+ tasks_running: Union[Unset, list[Any]] = UNSET
89
+ if not isinstance(self.tasks_running, Unset):
90
+ tasks_running = self.tasks_running
91
+
92
+ tasks_total: Union[Unset, dict[str, Any]] = UNSET
93
+ if self.tasks_total and not isinstance(self.tasks_total, Unset) and not isinstance(self.tasks_total, dict):
94
+ tasks_total = self.tasks_total.to_dict()
95
+ elif self.tasks_total and isinstance(self.tasks_total, dict):
96
+ tasks_total = self.tasks_total
97
+
98
+ field_dict: dict[str, Any] = {}
99
+ field_dict.update(self.additional_properties)
100
+ field_dict.update({})
101
+ if billable_time is not UNSET:
102
+ field_dict["billableTime"] = billable_time
103
+ if cpu_usage is not UNSET:
104
+ field_dict["cpuUsage"] = cpu_usage
105
+ if executions_chart is not UNSET:
106
+ field_dict["executionsChart"] = executions_chart
107
+ if executions_running is not UNSET:
108
+ field_dict["executionsRunning"] = executions_running
109
+ if executions_total is not UNSET:
110
+ field_dict["executionsTotal"] = executions_total
111
+ if ram_usage is not UNSET:
112
+ field_dict["ramUsage"] = ram_usage
113
+ if tasks_chart is not UNSET:
114
+ field_dict["tasksChart"] = tasks_chart
115
+ if tasks_running is not UNSET:
116
+ field_dict["tasksRunning"] = tasks_running
117
+ if tasks_total is not UNSET:
118
+ field_dict["tasksTotal"] = tasks_total
119
+
120
+ return field_dict
121
+
122
+ @classmethod
123
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
124
+ from ..models.job_metrics_executions_chart import JobMetricsExecutionsChart
125
+ from ..models.job_metrics_executions_total import JobMetricsExecutionsTotal
126
+ from ..models.job_metrics_tasks_chart import JobMetricsTasksChart
127
+ from ..models.job_metrics_tasks_total import JobMetricsTasksTotal
128
+
129
+ if not src_dict:
130
+ return None
131
+ d = src_dict.copy()
132
+ billable_time = cast(list[Any], d.pop("billableTime", UNSET))
133
+
134
+ cpu_usage = cast(list[Any], d.pop("cpuUsage", UNSET))
135
+
136
+ _executions_chart = d.pop("executionsChart", UNSET)
137
+ executions_chart: Union[Unset, JobMetricsExecutionsChart]
138
+ if isinstance(_executions_chart, Unset):
139
+ executions_chart = UNSET
140
+ else:
141
+ executions_chart = JobMetricsExecutionsChart.from_dict(_executions_chart)
142
+
143
+ executions_running = cast(list[Any], d.pop("executionsRunning", UNSET))
144
+
145
+ _executions_total = d.pop("executionsTotal", UNSET)
146
+ executions_total: Union[Unset, JobMetricsExecutionsTotal]
147
+ if isinstance(_executions_total, Unset):
148
+ executions_total = UNSET
149
+ else:
150
+ executions_total = JobMetricsExecutionsTotal.from_dict(_executions_total)
151
+
152
+ ram_usage = cast(list[Any], d.pop("ramUsage", UNSET))
153
+
154
+ _tasks_chart = d.pop("tasksChart", UNSET)
155
+ tasks_chart: Union[Unset, JobMetricsTasksChart]
156
+ if isinstance(_tasks_chart, Unset):
157
+ tasks_chart = UNSET
158
+ else:
159
+ tasks_chart = JobMetricsTasksChart.from_dict(_tasks_chart)
160
+
161
+ tasks_running = cast(list[Any], d.pop("tasksRunning", UNSET))
162
+
163
+ _tasks_total = d.pop("tasksTotal", UNSET)
164
+ tasks_total: Union[Unset, JobMetricsTasksTotal]
165
+ if isinstance(_tasks_total, Unset):
166
+ tasks_total = UNSET
167
+ else:
168
+ tasks_total = JobMetricsTasksTotal.from_dict(_tasks_total)
169
+
170
+ job_metrics = cls(
171
+ billable_time=billable_time,
172
+ cpu_usage=cpu_usage,
173
+ executions_chart=executions_chart,
174
+ executions_running=executions_running,
175
+ executions_total=executions_total,
176
+ ram_usage=ram_usage,
177
+ tasks_chart=tasks_chart,
178
+ tasks_running=tasks_running,
179
+ tasks_total=tasks_total,
180
+ )
181
+
182
+ job_metrics.additional_properties = d
183
+ return job_metrics
184
+
185
+ @property
186
+ def additional_keys(self) -> list[str]:
187
+ return list(self.additional_properties.keys())
188
+
189
+ def __getitem__(self, key: str) -> Any:
190
+ return self.additional_properties[key]
191
+
192
+ def __setitem__(self, key: str, value: Any) -> None:
193
+ self.additional_properties[key] = value
194
+
195
+ def __delitem__(self, key: str) -> None:
196
+ del self.additional_properties[key]
197
+
198
+ def __contains__(self, key: str) -> bool:
199
+ return key in self.additional_properties
@@ -0,0 +1,45 @@
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="JobMetricsExecutionsChart")
7
+
8
+
9
+ @_attrs_define
10
+ class JobMetricsExecutionsChart:
11
+ """Executions chart"""
12
+
13
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
14
+
15
+ def to_dict(self) -> dict[str, Any]:
16
+ field_dict: dict[str, Any] = {}
17
+ field_dict.update(self.additional_properties)
18
+
19
+ return field_dict
20
+
21
+ @classmethod
22
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
23
+ if not src_dict:
24
+ return None
25
+ d = src_dict.copy()
26
+ job_metrics_executions_chart = cls()
27
+
28
+ job_metrics_executions_chart.additional_properties = d
29
+ return job_metrics_executions_chart
30
+
31
+ @property
32
+ def additional_keys(self) -> list[str]:
33
+ return list(self.additional_properties.keys())
34
+
35
+ def __getitem__(self, key: str) -> Any:
36
+ return self.additional_properties[key]
37
+
38
+ def __setitem__(self, key: str, value: Any) -> None:
39
+ self.additional_properties[key] = value
40
+
41
+ def __delitem__(self, key: str) -> None:
42
+ del self.additional_properties[key]
43
+
44
+ def __contains__(self, key: str) -> bool:
45
+ return key in self.additional_properties
@@ -0,0 +1,45 @@
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="JobMetricsExecutionsTotal")
7
+
8
+
9
+ @_attrs_define
10
+ class JobMetricsExecutionsTotal:
11
+ """Total executions"""
12
+
13
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
14
+
15
+ def to_dict(self) -> dict[str, Any]:
16
+ field_dict: dict[str, Any] = {}
17
+ field_dict.update(self.additional_properties)
18
+
19
+ return field_dict
20
+
21
+ @classmethod
22
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
23
+ if not src_dict:
24
+ return None
25
+ d = src_dict.copy()
26
+ job_metrics_executions_total = cls()
27
+
28
+ job_metrics_executions_total.additional_properties = d
29
+ return job_metrics_executions_total
30
+
31
+ @property
32
+ def additional_keys(self) -> list[str]:
33
+ return list(self.additional_properties.keys())
34
+
35
+ def __getitem__(self, key: str) -> Any:
36
+ return self.additional_properties[key]
37
+
38
+ def __setitem__(self, key: str, value: Any) -> None:
39
+ self.additional_properties[key] = value
40
+
41
+ def __delitem__(self, key: str) -> None:
42
+ del self.additional_properties[key]
43
+
44
+ def __contains__(self, key: str) -> bool:
45
+ return key in self.additional_properties
@@ -0,0 +1,45 @@
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="JobMetricsTasksChart")
7
+
8
+
9
+ @_attrs_define
10
+ class JobMetricsTasksChart:
11
+ """Tasks chart"""
12
+
13
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
14
+
15
+ def to_dict(self) -> dict[str, Any]:
16
+ field_dict: dict[str, Any] = {}
17
+ field_dict.update(self.additional_properties)
18
+
19
+ return field_dict
20
+
21
+ @classmethod
22
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
23
+ if not src_dict:
24
+ return None
25
+ d = src_dict.copy()
26
+ job_metrics_tasks_chart = cls()
27
+
28
+ job_metrics_tasks_chart.additional_properties = d
29
+ return job_metrics_tasks_chart
30
+
31
+ @property
32
+ def additional_keys(self) -> list[str]:
33
+ return list(self.additional_properties.keys())
34
+
35
+ def __getitem__(self, key: str) -> Any:
36
+ return self.additional_properties[key]
37
+
38
+ def __setitem__(self, key: str, value: Any) -> None:
39
+ self.additional_properties[key] = value
40
+
41
+ def __delitem__(self, key: str) -> None:
42
+ del self.additional_properties[key]
43
+
44
+ def __contains__(self, key: str) -> bool:
45
+ return key in self.additional_properties
@@ -0,0 +1,45 @@
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="JobMetricsTasksTotal")
7
+
8
+
9
+ @_attrs_define
10
+ class JobMetricsTasksTotal:
11
+ """Total tasks"""
12
+
13
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
14
+
15
+ def to_dict(self) -> dict[str, Any]:
16
+ field_dict: dict[str, Any] = {}
17
+ field_dict.update(self.additional_properties)
18
+
19
+ return field_dict
20
+
21
+ @classmethod
22
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
23
+ if not src_dict:
24
+ return None
25
+ d = src_dict.copy()
26
+ job_metrics_tasks_total = cls()
27
+
28
+ job_metrics_tasks_total.additional_properties = d
29
+ return job_metrics_tasks_total
30
+
31
+ @property
32
+ def additional_keys(self) -> list[str]:
33
+ return list(self.additional_properties.keys())
34
+
35
+ def __getitem__(self, key: str) -> Any:
36
+ return self.additional_properties[key]
37
+
38
+ def __setitem__(self, key: str, value: Any) -> None:
39
+ self.additional_properties[key] = value
40
+
41
+ def __delitem__(self, key: str) -> None:
42
+ del self.additional_properties[key]
43
+
44
+ def __contains__(self, key: str) -> bool:
45
+ return key in self.additional_properties
@@ -0,0 +1,208 @@
1
+ from typing import TYPE_CHECKING, 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
+ if TYPE_CHECKING:
9
+ from ..models.core_spec_configurations import CoreSpecConfigurations
10
+ from ..models.flavor import Flavor
11
+ from ..models.model_private_cluster import ModelPrivateCluster
12
+ from ..models.revision_configuration import RevisionConfiguration
13
+ from ..models.runtime import Runtime
14
+
15
+
16
+ T = TypeVar("T", bound="JobSpec")
17
+
18
+
19
+ @_attrs_define
20
+ class JobSpec:
21
+ """Job specification
22
+
23
+ Attributes:
24
+ configurations (Union[Unset, CoreSpecConfigurations]): Optional configurations for the object
25
+ enabled (Union[Unset, bool]): Enable or disable the resource
26
+ flavors (Union[Unset, list['Flavor']]): Types of hardware available for deployments
27
+ integration_connections (Union[Unset, list[str]]):
28
+ policies (Union[Unset, list[str]]):
29
+ private_clusters (Union[Unset, ModelPrivateCluster]): Private cluster where the model deployment is deployed
30
+ revision (Union[Unset, RevisionConfiguration]): Revision configuration
31
+ runtime (Union[Unset, Runtime]): Set of configurations for a deployment
32
+ sandbox (Union[Unset, bool]): Sandbox mode
33
+ """
34
+
35
+ configurations: Union[Unset, "CoreSpecConfigurations"] = UNSET
36
+ enabled: Union[Unset, bool] = UNSET
37
+ flavors: Union[Unset, list["Flavor"]] = UNSET
38
+ integration_connections: Union[Unset, list[str]] = UNSET
39
+ policies: Union[Unset, list[str]] = UNSET
40
+ private_clusters: Union[Unset, "ModelPrivateCluster"] = UNSET
41
+ revision: Union[Unset, "RevisionConfiguration"] = UNSET
42
+ runtime: Union[Unset, "Runtime"] = UNSET
43
+ sandbox: Union[Unset, bool] = UNSET
44
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
45
+
46
+ def to_dict(self) -> dict[str, Any]:
47
+ configurations: Union[Unset, dict[str, Any]] = UNSET
48
+ if (
49
+ self.configurations
50
+ and not isinstance(self.configurations, Unset)
51
+ and not isinstance(self.configurations, dict)
52
+ ):
53
+ configurations = self.configurations.to_dict()
54
+ elif self.configurations and isinstance(self.configurations, dict):
55
+ configurations = self.configurations
56
+
57
+ enabled = self.enabled
58
+
59
+ flavors: Union[Unset, list[dict[str, Any]]] = UNSET
60
+ if not isinstance(self.flavors, Unset):
61
+ flavors = []
62
+ for componentsschemas_flavors_item_data in self.flavors:
63
+ if type(componentsschemas_flavors_item_data) == dict:
64
+ componentsschemas_flavors_item = componentsschemas_flavors_item_data
65
+ else:
66
+ componentsschemas_flavors_item = componentsschemas_flavors_item_data.to_dict()
67
+ flavors.append(componentsschemas_flavors_item)
68
+
69
+ integration_connections: Union[Unset, list[str]] = UNSET
70
+ if not isinstance(self.integration_connections, Unset):
71
+ integration_connections = self.integration_connections
72
+
73
+ policies: Union[Unset, list[str]] = UNSET
74
+ if not isinstance(self.policies, Unset):
75
+ policies = self.policies
76
+
77
+ private_clusters: Union[Unset, dict[str, Any]] = UNSET
78
+ if (
79
+ self.private_clusters
80
+ and not isinstance(self.private_clusters, Unset)
81
+ and not isinstance(self.private_clusters, dict)
82
+ ):
83
+ private_clusters = self.private_clusters.to_dict()
84
+ elif self.private_clusters and isinstance(self.private_clusters, dict):
85
+ private_clusters = self.private_clusters
86
+
87
+ revision: Union[Unset, dict[str, Any]] = UNSET
88
+ if self.revision and not isinstance(self.revision, Unset) and not isinstance(self.revision, dict):
89
+ revision = self.revision.to_dict()
90
+ elif self.revision and isinstance(self.revision, dict):
91
+ revision = self.revision
92
+
93
+ runtime: Union[Unset, dict[str, Any]] = UNSET
94
+ if self.runtime and not isinstance(self.runtime, Unset) and not isinstance(self.runtime, dict):
95
+ runtime = self.runtime.to_dict()
96
+ elif self.runtime and isinstance(self.runtime, dict):
97
+ runtime = self.runtime
98
+
99
+ sandbox = self.sandbox
100
+
101
+ field_dict: dict[str, Any] = {}
102
+ field_dict.update(self.additional_properties)
103
+ field_dict.update({})
104
+ if configurations is not UNSET:
105
+ field_dict["configurations"] = configurations
106
+ if enabled is not UNSET:
107
+ field_dict["enabled"] = enabled
108
+ if flavors is not UNSET:
109
+ field_dict["flavors"] = flavors
110
+ if integration_connections is not UNSET:
111
+ field_dict["integrationConnections"] = integration_connections
112
+ if policies is not UNSET:
113
+ field_dict["policies"] = policies
114
+ if private_clusters is not UNSET:
115
+ field_dict["privateClusters"] = private_clusters
116
+ if revision is not UNSET:
117
+ field_dict["revision"] = revision
118
+ if runtime is not UNSET:
119
+ field_dict["runtime"] = runtime
120
+ if sandbox is not UNSET:
121
+ field_dict["sandbox"] = sandbox
122
+
123
+ return field_dict
124
+
125
+ @classmethod
126
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
127
+ from ..models.core_spec_configurations import CoreSpecConfigurations
128
+ from ..models.flavor import Flavor
129
+ from ..models.model_private_cluster import ModelPrivateCluster
130
+ from ..models.revision_configuration import RevisionConfiguration
131
+ from ..models.runtime import Runtime
132
+
133
+ if not src_dict:
134
+ return None
135
+ d = src_dict.copy()
136
+ _configurations = d.pop("configurations", UNSET)
137
+ configurations: Union[Unset, CoreSpecConfigurations]
138
+ if isinstance(_configurations, Unset):
139
+ configurations = UNSET
140
+ else:
141
+ configurations = CoreSpecConfigurations.from_dict(_configurations)
142
+
143
+ enabled = d.pop("enabled", UNSET)
144
+
145
+ flavors = []
146
+ _flavors = d.pop("flavors", UNSET)
147
+ for componentsschemas_flavors_item_data in _flavors or []:
148
+ componentsschemas_flavors_item = Flavor.from_dict(componentsschemas_flavors_item_data)
149
+
150
+ flavors.append(componentsschemas_flavors_item)
151
+
152
+ integration_connections = cast(list[str], d.pop("integrationConnections", UNSET))
153
+
154
+ policies = cast(list[str], d.pop("policies", UNSET))
155
+
156
+ _private_clusters = d.pop("privateClusters", UNSET)
157
+ private_clusters: Union[Unset, ModelPrivateCluster]
158
+ if isinstance(_private_clusters, Unset):
159
+ private_clusters = UNSET
160
+ else:
161
+ private_clusters = ModelPrivateCluster.from_dict(_private_clusters)
162
+
163
+ _revision = d.pop("revision", UNSET)
164
+ revision: Union[Unset, RevisionConfiguration]
165
+ if isinstance(_revision, Unset):
166
+ revision = UNSET
167
+ else:
168
+ revision = RevisionConfiguration.from_dict(_revision)
169
+
170
+ _runtime = d.pop("runtime", UNSET)
171
+ runtime: Union[Unset, Runtime]
172
+ if isinstance(_runtime, Unset):
173
+ runtime = UNSET
174
+ else:
175
+ runtime = Runtime.from_dict(_runtime)
176
+
177
+ sandbox = d.pop("sandbox", UNSET)
178
+
179
+ job_spec = cls(
180
+ configurations=configurations,
181
+ enabled=enabled,
182
+ flavors=flavors,
183
+ integration_connections=integration_connections,
184
+ policies=policies,
185
+ private_clusters=private_clusters,
186
+ revision=revision,
187
+ runtime=runtime,
188
+ sandbox=sandbox,
189
+ )
190
+
191
+ job_spec.additional_properties = d
192
+ return job_spec
193
+
194
+ @property
195
+ def additional_keys(self) -> list[str]:
196
+ return list(self.additional_properties.keys())
197
+
198
+ def __getitem__(self, key: str) -> Any:
199
+ return self.additional_properties[key]
200
+
201
+ def __setitem__(self, key: str, value: Any) -> None:
202
+ self.additional_properties[key] = value
203
+
204
+ def __delitem__(self, key: str) -> None:
205
+ del self.additional_properties[key]
206
+
207
+ def __contains__(self, key: str) -> bool:
208
+ return key in self.additional_properties
@@ -0,0 +1,94 @@
1
+ from typing import TYPE_CHECKING, 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
+ if TYPE_CHECKING:
9
+ from ..models.jobs_chart_value import JobsChartValue
10
+
11
+
12
+ T = TypeVar("T", bound="JobsChart")
13
+
14
+
15
+ @_attrs_define
16
+ class JobsChart:
17
+ """Jobs chart
18
+
19
+ Attributes:
20
+ failed (Union[Unset, JobsChartValue]): Jobs CPU usage
21
+ success (Union[Unset, JobsChartValue]): Jobs CPU usage
22
+ """
23
+
24
+ failed: Union[Unset, "JobsChartValue"] = UNSET
25
+ success: Union[Unset, "JobsChartValue"] = UNSET
26
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
+
28
+ def to_dict(self) -> dict[str, Any]:
29
+ failed: Union[Unset, dict[str, Any]] = UNSET
30
+ if self.failed and not isinstance(self.failed, Unset) and not isinstance(self.failed, dict):
31
+ failed = self.failed.to_dict()
32
+ elif self.failed and isinstance(self.failed, dict):
33
+ failed = self.failed
34
+
35
+ success: Union[Unset, dict[str, Any]] = UNSET
36
+ if self.success and not isinstance(self.success, Unset) and not isinstance(self.success, dict):
37
+ success = self.success.to_dict()
38
+ elif self.success and isinstance(self.success, dict):
39
+ success = self.success
40
+
41
+ field_dict: dict[str, Any] = {}
42
+ field_dict.update(self.additional_properties)
43
+ field_dict.update({})
44
+ if failed is not UNSET:
45
+ field_dict["failed"] = failed
46
+ if success is not UNSET:
47
+ field_dict["success"] = success
48
+
49
+ return field_dict
50
+
51
+ @classmethod
52
+ def from_dict(cls: type[T], src_dict: dict[str, Any]) -> T:
53
+ from ..models.jobs_chart_value import JobsChartValue
54
+
55
+ if not src_dict:
56
+ return None
57
+ d = src_dict.copy()
58
+ _failed = d.pop("failed", UNSET)
59
+ failed: Union[Unset, JobsChartValue]
60
+ if isinstance(_failed, Unset):
61
+ failed = UNSET
62
+ else:
63
+ failed = JobsChartValue.from_dict(_failed)
64
+
65
+ _success = d.pop("success", UNSET)
66
+ success: Union[Unset, JobsChartValue]
67
+ if isinstance(_success, Unset):
68
+ success = UNSET
69
+ else:
70
+ success = JobsChartValue.from_dict(_success)
71
+
72
+ jobs_chart = cls(
73
+ failed=failed,
74
+ success=success,
75
+ )
76
+
77
+ jobs_chart.additional_properties = d
78
+ return jobs_chart
79
+
80
+ @property
81
+ def additional_keys(self) -> list[str]:
82
+ return list(self.additional_properties.keys())
83
+
84
+ def __getitem__(self, key: str) -> Any:
85
+ return self.additional_properties[key]
86
+
87
+ def __setitem__(self, key: str, value: Any) -> None:
88
+ self.additional_properties[key] = value
89
+
90
+ def __delitem__(self, key: str) -> None:
91
+ del self.additional_properties[key]
92
+
93
+ def __contains__(self, key: str) -> bool:
94
+ return key in self.additional_properties