digitalhub 0.13.0b3__py3-none-any.whl → 0.14.9__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.
- digitalhub/__init__.py +3 -8
- digitalhub/context/api.py +43 -6
- digitalhub/context/builder.py +1 -5
- digitalhub/context/context.py +28 -13
- digitalhub/entities/_base/_base/entity.py +0 -15
- digitalhub/entities/_base/context/entity.py +1 -4
- digitalhub/entities/_base/entity/builder.py +5 -5
- digitalhub/entities/_base/entity/entity.py +0 -8
- digitalhub/entities/_base/executable/entity.py +195 -87
- digitalhub/entities/_base/material/entity.py +11 -23
- digitalhub/entities/_base/material/utils.py +28 -4
- digitalhub/entities/_base/runtime_entity/builder.py +53 -18
- digitalhub/entities/_base/unversioned/entity.py +1 -1
- digitalhub/entities/_base/versioned/entity.py +1 -1
- digitalhub/entities/_commons/enums.py +1 -31
- digitalhub/entities/_commons/metrics.py +64 -30
- digitalhub/entities/_commons/utils.py +119 -30
- digitalhub/entities/_constructors/_resources.py +151 -0
- digitalhub/entities/{_base/entity/_constructors → _constructors}/name.py +18 -0
- digitalhub/entities/_processors/base/crud.py +381 -0
- digitalhub/entities/_processors/base/import_export.py +118 -0
- digitalhub/entities/_processors/base/processor.py +299 -0
- digitalhub/entities/_processors/base/special_ops.py +104 -0
- digitalhub/entities/_processors/context/crud.py +652 -0
- digitalhub/entities/_processors/context/import_export.py +242 -0
- digitalhub/entities/_processors/context/material.py +123 -0
- digitalhub/entities/_processors/context/processor.py +400 -0
- digitalhub/entities/_processors/context/special_ops.py +476 -0
- digitalhub/entities/_processors/processors.py +12 -0
- digitalhub/entities/_processors/utils.py +38 -102
- digitalhub/entities/artifact/crud.py +58 -22
- digitalhub/entities/artifact/utils.py +28 -13
- digitalhub/entities/builders.py +2 -0
- digitalhub/entities/dataitem/crud.py +63 -20
- digitalhub/entities/dataitem/table/entity.py +27 -22
- digitalhub/entities/dataitem/utils.py +82 -32
- digitalhub/entities/function/_base/entity.py +3 -6
- digitalhub/entities/function/crud.py +55 -24
- digitalhub/entities/model/_base/entity.py +62 -20
- digitalhub/entities/model/crud.py +59 -23
- digitalhub/entities/model/mlflow/utils.py +29 -20
- digitalhub/entities/model/utils.py +28 -13
- digitalhub/entities/project/_base/builder.py +0 -6
- digitalhub/entities/project/_base/entity.py +337 -164
- digitalhub/entities/project/_base/spec.py +4 -4
- digitalhub/entities/project/crud.py +28 -71
- digitalhub/entities/project/utils.py +7 -3
- digitalhub/entities/run/_base/builder.py +0 -4
- digitalhub/entities/run/_base/entity.py +70 -63
- digitalhub/entities/run/crud.py +79 -26
- digitalhub/entities/secret/_base/entity.py +1 -5
- digitalhub/entities/secret/crud.py +31 -28
- digitalhub/entities/task/_base/builder.py +0 -4
- digitalhub/entities/task/_base/entity.py +5 -5
- digitalhub/entities/task/_base/models.py +13 -16
- digitalhub/entities/task/crud.py +61 -29
- digitalhub/entities/trigger/_base/entity.py +1 -5
- digitalhub/entities/trigger/crud.py +89 -30
- digitalhub/entities/workflow/_base/entity.py +3 -8
- digitalhub/entities/workflow/crud.py +55 -24
- digitalhub/factory/entity.py +283 -0
- digitalhub/factory/enums.py +18 -0
- digitalhub/factory/registry.py +197 -0
- digitalhub/factory/runtime.py +44 -0
- digitalhub/factory/utils.py +3 -54
- digitalhub/runtimes/_base.py +2 -2
- digitalhub/stores/client/{dhcore/api_builder.py → api_builder.py} +3 -3
- digitalhub/stores/client/builder.py +19 -31
- digitalhub/stores/client/client.py +322 -0
- digitalhub/stores/client/configurator.py +408 -0
- digitalhub/stores/client/enums.py +50 -0
- digitalhub/stores/client/{dhcore/error_parser.py → error_parser.py} +0 -4
- digitalhub/stores/client/header_manager.py +61 -0
- digitalhub/stores/client/http_handler.py +152 -0
- digitalhub/stores/client/{_base/key_builder.py → key_builder.py} +14 -14
- digitalhub/stores/client/params_builder.py +330 -0
- digitalhub/stores/client/response_processor.py +102 -0
- digitalhub/stores/client/utils.py +35 -0
- digitalhub/stores/{credentials → configurator}/api.py +5 -9
- digitalhub/stores/configurator/configurator.py +123 -0
- digitalhub/stores/{credentials → configurator}/enums.py +27 -10
- digitalhub/stores/configurator/handler.py +213 -0
- digitalhub/stores/{credentials → configurator}/ini_module.py +31 -22
- digitalhub/stores/data/_base/store.py +0 -20
- digitalhub/stores/data/api.py +5 -7
- digitalhub/stores/data/builder.py +53 -27
- digitalhub/stores/data/local/store.py +0 -103
- digitalhub/stores/data/remote/store.py +0 -4
- digitalhub/stores/data/s3/configurator.py +39 -77
- digitalhub/stores/data/s3/store.py +57 -37
- digitalhub/stores/data/sql/configurator.py +66 -46
- digitalhub/stores/data/sql/store.py +171 -104
- digitalhub/stores/readers/data/factory.py +0 -8
- digitalhub/stores/readers/data/pandas/reader.py +9 -19
- digitalhub/utils/file_utils.py +0 -17
- digitalhub/utils/generic_utils.py +1 -14
- digitalhub/utils/git_utils.py +0 -8
- digitalhub/utils/io_utils.py +0 -12
- digitalhub/utils/store_utils.py +44 -0
- {digitalhub-0.13.0b3.dist-info → digitalhub-0.14.9.dist-info}/METADATA +5 -4
- {digitalhub-0.13.0b3.dist-info → digitalhub-0.14.9.dist-info}/RECORD +112 -113
- {digitalhub-0.13.0b3.dist-info → digitalhub-0.14.9.dist-info}/WHEEL +1 -1
- digitalhub/entities/_commons/types.py +0 -9
- digitalhub/entities/_processors/base.py +0 -531
- digitalhub/entities/_processors/context.py +0 -1299
- digitalhub/entities/task/_base/utils.py +0 -22
- digitalhub/factory/factory.py +0 -381
- digitalhub/stores/client/_base/api_builder.py +0 -34
- digitalhub/stores/client/_base/client.py +0 -243
- digitalhub/stores/client/_base/params_builder.py +0 -34
- digitalhub/stores/client/api.py +0 -36
- digitalhub/stores/client/dhcore/client.py +0 -613
- digitalhub/stores/client/dhcore/configurator.py +0 -675
- digitalhub/stores/client/dhcore/enums.py +0 -34
- digitalhub/stores/client/dhcore/key_builder.py +0 -62
- digitalhub/stores/client/dhcore/models.py +0 -40
- digitalhub/stores/client/dhcore/params_builder.py +0 -278
- digitalhub/stores/client/dhcore/utils.py +0 -94
- digitalhub/stores/client/local/api_builder.py +0 -116
- digitalhub/stores/client/local/client.py +0 -573
- digitalhub/stores/client/local/enums.py +0 -15
- digitalhub/stores/client/local/key_builder.py +0 -62
- digitalhub/stores/client/local/params_builder.py +0 -120
- digitalhub/stores/credentials/__init__.py +0 -3
- digitalhub/stores/credentials/configurator.py +0 -210
- digitalhub/stores/credentials/handler.py +0 -176
- digitalhub/stores/credentials/store.py +0 -81
- digitalhub/stores/data/enums.py +0 -15
- digitalhub/stores/data/s3/utils.py +0 -78
- /digitalhub/entities/{_base/entity/_constructors → _constructors}/__init__.py +0 -0
- /digitalhub/entities/{_base/entity/_constructors → _constructors}/metadata.py +0 -0
- /digitalhub/entities/{_base/entity/_constructors → _constructors}/spec.py +0 -0
- /digitalhub/entities/{_base/entity/_constructors → _constructors}/status.py +0 -0
- /digitalhub/entities/{_base/entity/_constructors → _constructors}/uuid.py +0 -0
- /digitalhub/{stores/client/_base → entities/_processors/base}/__init__.py +0 -0
- /digitalhub/{stores/client/dhcore → entities/_processors/context}/__init__.py +0 -0
- /digitalhub/stores/{client/local → configurator}/__init__.py +0 -0
- {digitalhub-0.13.0b3.dist-info → digitalhub-0.14.9.dist-info}/licenses/AUTHORS +0 -0
- {digitalhub-0.13.0b3.dist-info → digitalhub-0.14.9.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: © 2025 DSLab - Fondazione Bruno Kessler
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
import typing
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from digitalhub.entities._processors.context.crud import ContextEntityCRUDProcessor
|
|
11
|
+
from digitalhub.entities._processors.context.import_export import ContextEntityImportExportProcessor
|
|
12
|
+
from digitalhub.entities._processors.context.material import ContextEntityMaterialProcessor
|
|
13
|
+
from digitalhub.entities._processors.context.special_ops import ContextEntitySpecialOpsProcessor
|
|
14
|
+
|
|
15
|
+
if typing.TYPE_CHECKING:
|
|
16
|
+
from digitalhub.entities._base.context.entity import ContextEntity
|
|
17
|
+
from digitalhub.entities._base.executable.entity import ExecutableEntity
|
|
18
|
+
from digitalhub.entities._base.material.entity import MaterialEntity
|
|
19
|
+
from digitalhub.entities._base.unversioned.entity import UnversionedEntity
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class ContextEntityOperationsProcessor:
|
|
23
|
+
"""
|
|
24
|
+
Processor for context entity operations.
|
|
25
|
+
|
|
26
|
+
This class handles CRUD operations and other entity management tasks
|
|
27
|
+
for context-level entities (artifacts, functions, workflows, runs, etc.)
|
|
28
|
+
within projects. It manages the full lifecycle of versioned and
|
|
29
|
+
unversioned entities including creation, reading, updating, deletion,
|
|
30
|
+
import/export, and specialized operations like file uploads and metrics.
|
|
31
|
+
|
|
32
|
+
Uses composition with specialized processors for different operation types.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
def __init__(self):
|
|
36
|
+
self.crud_processor = ContextEntityCRUDProcessor()
|
|
37
|
+
self.material_processor = ContextEntityMaterialProcessor()
|
|
38
|
+
self.import_export_processor = ContextEntityImportExportProcessor()
|
|
39
|
+
self.special_ops_processor = ContextEntitySpecialOpsProcessor()
|
|
40
|
+
|
|
41
|
+
##############################
|
|
42
|
+
# CRUD context entity
|
|
43
|
+
##############################
|
|
44
|
+
|
|
45
|
+
def create_context_entity(
|
|
46
|
+
self,
|
|
47
|
+
_entity: ContextEntity | None = None,
|
|
48
|
+
**kwargs,
|
|
49
|
+
) -> ContextEntity:
|
|
50
|
+
"""Create a context entity in the backend."""
|
|
51
|
+
return self.crud_processor.create_context_entity(_entity=_entity, **kwargs)
|
|
52
|
+
|
|
53
|
+
def log_material_entity(
|
|
54
|
+
self,
|
|
55
|
+
**kwargs,
|
|
56
|
+
) -> MaterialEntity:
|
|
57
|
+
"""Create a material entity in the backend and upload associated files."""
|
|
58
|
+
return self.material_processor.log_material_entity(self.crud_processor, **kwargs)
|
|
59
|
+
|
|
60
|
+
def read_context_entity(
|
|
61
|
+
self,
|
|
62
|
+
identifier: str,
|
|
63
|
+
entity_type: str | None = None,
|
|
64
|
+
project: str | None = None,
|
|
65
|
+
entity_id: str | None = None,
|
|
66
|
+
**kwargs,
|
|
67
|
+
) -> ContextEntity:
|
|
68
|
+
"""Read a context entity from the backend."""
|
|
69
|
+
return self.crud_processor.read_context_entity(
|
|
70
|
+
identifier=identifier,
|
|
71
|
+
entity_type=entity_type,
|
|
72
|
+
project=project,
|
|
73
|
+
entity_id=entity_id,
|
|
74
|
+
**kwargs,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
def read_unversioned_entity(
|
|
78
|
+
self,
|
|
79
|
+
identifier: str,
|
|
80
|
+
entity_type: str | None = None,
|
|
81
|
+
project: str | None = None,
|
|
82
|
+
entity_id: str | None = None,
|
|
83
|
+
**kwargs,
|
|
84
|
+
) -> UnversionedEntity:
|
|
85
|
+
"""Read an unversioned entity from the backend."""
|
|
86
|
+
return self.crud_processor.read_unversioned_entity(
|
|
87
|
+
identifier=identifier,
|
|
88
|
+
entity_type=entity_type,
|
|
89
|
+
project=project,
|
|
90
|
+
entity_id=entity_id,
|
|
91
|
+
**kwargs,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
def read_context_entity_versions(
|
|
95
|
+
self,
|
|
96
|
+
identifier: str,
|
|
97
|
+
entity_type: str | None = None,
|
|
98
|
+
project: str | None = None,
|
|
99
|
+
**kwargs,
|
|
100
|
+
) -> list[ContextEntity]:
|
|
101
|
+
"""Read all versions of a context entity from the backend."""
|
|
102
|
+
return self.crud_processor.read_context_entity_versions(
|
|
103
|
+
identifier=identifier,
|
|
104
|
+
entity_type=entity_type,
|
|
105
|
+
project=project,
|
|
106
|
+
**kwargs,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
def list_context_entities(
|
|
110
|
+
self,
|
|
111
|
+
project: str,
|
|
112
|
+
entity_type: str,
|
|
113
|
+
**kwargs,
|
|
114
|
+
) -> list[ContextEntity]:
|
|
115
|
+
"""List all latest version context entities from the backend."""
|
|
116
|
+
return self.crud_processor.list_context_entities(
|
|
117
|
+
project=project,
|
|
118
|
+
entity_type=entity_type,
|
|
119
|
+
**kwargs,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
def update_context_entity(
|
|
123
|
+
self,
|
|
124
|
+
project: str,
|
|
125
|
+
entity_type: str,
|
|
126
|
+
entity_id: str,
|
|
127
|
+
entity_dict: dict,
|
|
128
|
+
**kwargs,
|
|
129
|
+
) -> ContextEntity:
|
|
130
|
+
"""Update a context entity in the backend."""
|
|
131
|
+
return self.crud_processor.update_context_entity(
|
|
132
|
+
project=project,
|
|
133
|
+
entity_type=entity_type,
|
|
134
|
+
entity_id=entity_id,
|
|
135
|
+
entity_dict=entity_dict,
|
|
136
|
+
**kwargs,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
def delete_context_entity(
|
|
140
|
+
self,
|
|
141
|
+
identifier: str,
|
|
142
|
+
project: str | None = None,
|
|
143
|
+
entity_type: str | None = None,
|
|
144
|
+
entity_id: str | None = None,
|
|
145
|
+
**kwargs,
|
|
146
|
+
) -> dict:
|
|
147
|
+
"""Delete a context entity from the backend."""
|
|
148
|
+
return self.crud_processor.delete_context_entity(
|
|
149
|
+
identifier=identifier,
|
|
150
|
+
project=project,
|
|
151
|
+
entity_type=entity_type,
|
|
152
|
+
entity_id=entity_id,
|
|
153
|
+
**kwargs,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
##############################
|
|
157
|
+
# Import/Export operations
|
|
158
|
+
##############################
|
|
159
|
+
|
|
160
|
+
def import_context_entity(
|
|
161
|
+
self,
|
|
162
|
+
file: str | None = None,
|
|
163
|
+
key: str | None = None,
|
|
164
|
+
reset_id: bool = False,
|
|
165
|
+
context: str | None = None,
|
|
166
|
+
) -> ContextEntity:
|
|
167
|
+
"""Import a context entity from a YAML file or from a storage key."""
|
|
168
|
+
return self.import_export_processor.import_context_entity(
|
|
169
|
+
crud_processor=self.crud_processor,
|
|
170
|
+
file=file,
|
|
171
|
+
key=key,
|
|
172
|
+
reset_id=reset_id,
|
|
173
|
+
context=context,
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
def import_executable_entity(
|
|
177
|
+
self,
|
|
178
|
+
file: str | None = None,
|
|
179
|
+
key: str | None = None,
|
|
180
|
+
reset_id: bool = False,
|
|
181
|
+
context: str | None = None,
|
|
182
|
+
) -> ExecutableEntity:
|
|
183
|
+
"""Import an executable entity from a YAML file or from a storage key."""
|
|
184
|
+
return self.import_export_processor.import_executable_entity(
|
|
185
|
+
crud_processor=self.crud_processor,
|
|
186
|
+
file=file,
|
|
187
|
+
key=key,
|
|
188
|
+
reset_id=reset_id,
|
|
189
|
+
context=context,
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
def load_context_entity(
|
|
193
|
+
self,
|
|
194
|
+
file: str,
|
|
195
|
+
) -> ContextEntity:
|
|
196
|
+
"""Load a context entity from a YAML file and update it in the backend."""
|
|
197
|
+
return self.import_export_processor.load_context_entity(
|
|
198
|
+
crud_processor=self.crud_processor,
|
|
199
|
+
file=file,
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
def load_executable_entity(
|
|
203
|
+
self,
|
|
204
|
+
file: str,
|
|
205
|
+
) -> ExecutableEntity:
|
|
206
|
+
"""Load an executable entity from a YAML file and update it in the backend."""
|
|
207
|
+
return self.import_export_processor.load_executable_entity(
|
|
208
|
+
crud_processor=self.crud_processor,
|
|
209
|
+
file=file,
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
##############################
|
|
213
|
+
# Context entity operations
|
|
214
|
+
##############################
|
|
215
|
+
|
|
216
|
+
def build_context_entity_key(
|
|
217
|
+
self,
|
|
218
|
+
project: str,
|
|
219
|
+
entity_type: str,
|
|
220
|
+
entity_kind: str,
|
|
221
|
+
entity_name: str,
|
|
222
|
+
entity_id: str | None = None,
|
|
223
|
+
) -> str:
|
|
224
|
+
"""Build a storage key for a context entity."""
|
|
225
|
+
return self.special_ops_processor.build_context_entity_key(
|
|
226
|
+
project=project,
|
|
227
|
+
entity_type=entity_type,
|
|
228
|
+
entity_kind=entity_kind,
|
|
229
|
+
entity_name=entity_name,
|
|
230
|
+
entity_id=entity_id,
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
def read_secret_data(
|
|
234
|
+
self,
|
|
235
|
+
project: str,
|
|
236
|
+
entity_type: str,
|
|
237
|
+
**kwargs,
|
|
238
|
+
) -> dict:
|
|
239
|
+
"""Read secret data from the backend."""
|
|
240
|
+
return self.special_ops_processor.read_secret_data(
|
|
241
|
+
project=project,
|
|
242
|
+
entity_type=entity_type,
|
|
243
|
+
**kwargs,
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
def update_secret_data(
|
|
247
|
+
self,
|
|
248
|
+
project: str,
|
|
249
|
+
entity_type: str,
|
|
250
|
+
data: dict,
|
|
251
|
+
**kwargs,
|
|
252
|
+
) -> None:
|
|
253
|
+
"""Update secret data in the backend."""
|
|
254
|
+
return self.special_ops_processor.update_secret_data(
|
|
255
|
+
project=project,
|
|
256
|
+
entity_type=entity_type,
|
|
257
|
+
data=data,
|
|
258
|
+
**kwargs,
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
def read_run_logs(
|
|
262
|
+
self,
|
|
263
|
+
project: str,
|
|
264
|
+
entity_type: str,
|
|
265
|
+
entity_id: str,
|
|
266
|
+
**kwargs,
|
|
267
|
+
) -> dict:
|
|
268
|
+
"""Read execution logs from the backend."""
|
|
269
|
+
return self.special_ops_processor.read_run_logs(
|
|
270
|
+
project=project,
|
|
271
|
+
entity_type=entity_type,
|
|
272
|
+
entity_id=entity_id,
|
|
273
|
+
**kwargs,
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
def stop_entity(
|
|
277
|
+
self,
|
|
278
|
+
project: str,
|
|
279
|
+
entity_type: str,
|
|
280
|
+
entity_id: str,
|
|
281
|
+
**kwargs,
|
|
282
|
+
) -> None:
|
|
283
|
+
"""Stop a running entity in the backend."""
|
|
284
|
+
return self.special_ops_processor.stop_entity(
|
|
285
|
+
project=project,
|
|
286
|
+
entity_type=entity_type,
|
|
287
|
+
entity_id=entity_id,
|
|
288
|
+
**kwargs,
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
def resume_entity(
|
|
292
|
+
self,
|
|
293
|
+
project: str,
|
|
294
|
+
entity_type: str,
|
|
295
|
+
entity_id: str,
|
|
296
|
+
**kwargs,
|
|
297
|
+
) -> None:
|
|
298
|
+
"""Resume a stopped entity in the backend."""
|
|
299
|
+
return self.special_ops_processor.resume_entity(
|
|
300
|
+
project=project,
|
|
301
|
+
entity_type=entity_type,
|
|
302
|
+
entity_id=entity_id,
|
|
303
|
+
**kwargs,
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
def read_files_info(
|
|
307
|
+
self,
|
|
308
|
+
project: str,
|
|
309
|
+
entity_type: str,
|
|
310
|
+
entity_id: str,
|
|
311
|
+
**kwargs,
|
|
312
|
+
) -> list[dict]:
|
|
313
|
+
"""Read file information from the backend."""
|
|
314
|
+
return self.special_ops_processor.read_files_info(
|
|
315
|
+
project=project,
|
|
316
|
+
entity_type=entity_type,
|
|
317
|
+
entity_id=entity_id,
|
|
318
|
+
**kwargs,
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
def update_files_info(
|
|
322
|
+
self,
|
|
323
|
+
project: str,
|
|
324
|
+
entity_type: str,
|
|
325
|
+
entity_id: str,
|
|
326
|
+
entity_list: list[dict],
|
|
327
|
+
**kwargs,
|
|
328
|
+
) -> None:
|
|
329
|
+
"""Get files info from backend."""
|
|
330
|
+
return self.special_ops_processor.update_files_info(
|
|
331
|
+
project=project,
|
|
332
|
+
entity_type=entity_type,
|
|
333
|
+
entity_id=entity_id,
|
|
334
|
+
entity_list=entity_list,
|
|
335
|
+
**kwargs,
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
def read_metrics(
|
|
339
|
+
self,
|
|
340
|
+
project: str,
|
|
341
|
+
entity_type: str,
|
|
342
|
+
entity_id: str,
|
|
343
|
+
metric_name: str | None = None,
|
|
344
|
+
**kwargs,
|
|
345
|
+
) -> dict:
|
|
346
|
+
"""Read metrics from the backend for a specific entity."""
|
|
347
|
+
return self.special_ops_processor.read_metrics(
|
|
348
|
+
project=project,
|
|
349
|
+
entity_type=entity_type,
|
|
350
|
+
entity_id=entity_id,
|
|
351
|
+
metric_name=metric_name,
|
|
352
|
+
**kwargs,
|
|
353
|
+
)
|
|
354
|
+
|
|
355
|
+
def update_metric(
|
|
356
|
+
self,
|
|
357
|
+
project: str,
|
|
358
|
+
entity_type: str,
|
|
359
|
+
entity_id: str,
|
|
360
|
+
metric_name: str,
|
|
361
|
+
metric_value: Any,
|
|
362
|
+
**kwargs,
|
|
363
|
+
) -> None:
|
|
364
|
+
"""Update or create a metric value for an entity in the backend."""
|
|
365
|
+
return self.special_ops_processor.update_metric(
|
|
366
|
+
project=project,
|
|
367
|
+
entity_type=entity_type,
|
|
368
|
+
entity_id=entity_id,
|
|
369
|
+
metric_name=metric_name,
|
|
370
|
+
metric_value=metric_value,
|
|
371
|
+
**kwargs,
|
|
372
|
+
)
|
|
373
|
+
|
|
374
|
+
def search_entity(
|
|
375
|
+
self,
|
|
376
|
+
project: str,
|
|
377
|
+
query: str | None = None,
|
|
378
|
+
entity_types: list[str] | None = None,
|
|
379
|
+
name: str | None = None,
|
|
380
|
+
kind: str | None = None,
|
|
381
|
+
created: str | None = None,
|
|
382
|
+
updated: str | None = None,
|
|
383
|
+
description: str | None = None,
|
|
384
|
+
labels: list[str] | None = None,
|
|
385
|
+
**kwargs,
|
|
386
|
+
) -> list[ContextEntity]:
|
|
387
|
+
"""Search for entities in the backend using various criteria."""
|
|
388
|
+
return self.special_ops_processor.search_entity(
|
|
389
|
+
crud_processor=self.crud_processor,
|
|
390
|
+
project=project,
|
|
391
|
+
query=query,
|
|
392
|
+
entity_types=entity_types,
|
|
393
|
+
name=name,
|
|
394
|
+
kind=kind,
|
|
395
|
+
created=created,
|
|
396
|
+
updated=updated,
|
|
397
|
+
description=description,
|
|
398
|
+
labels=labels,
|
|
399
|
+
**kwargs,
|
|
400
|
+
)
|