digitalhub 0.12.0__py3-none-any.whl → 0.13.0__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.
Potentially problematic release.
This version of digitalhub might be problematic. Click here for more details.
- digitalhub/__init__.py +1 -1
- digitalhub/context/api.py +5 -5
- digitalhub/context/builder.py +3 -5
- digitalhub/context/context.py +9 -1
- digitalhub/entities/_base/executable/entity.py +105 -57
- digitalhub/entities/_base/material/entity.py +11 -18
- digitalhub/entities/_base/material/utils.py +1 -1
- digitalhub/entities/_commons/metrics.py +64 -30
- digitalhub/entities/_commons/utils.py +36 -9
- digitalhub/entities/_processors/base.py +150 -79
- digitalhub/entities/_processors/context.py +366 -215
- digitalhub/entities/_processors/utils.py +74 -30
- digitalhub/entities/artifact/crud.py +4 -0
- digitalhub/entities/artifact/utils.py +28 -13
- digitalhub/entities/dataitem/crud.py +14 -2
- digitalhub/entities/dataitem/table/entity.py +3 -3
- digitalhub/entities/dataitem/utils.py +84 -35
- digitalhub/entities/model/crud.py +4 -0
- digitalhub/entities/model/utils.py +28 -13
- digitalhub/entities/project/_base/entity.py +0 -2
- digitalhub/entities/run/_base/entity.py +2 -2
- digitalhub/entities/task/_base/models.py +12 -3
- digitalhub/entities/trigger/_base/entity.py +11 -0
- digitalhub/factory/factory.py +25 -3
- digitalhub/factory/utils.py +11 -3
- digitalhub/runtimes/_base.py +1 -1
- digitalhub/runtimes/builder.py +18 -1
- digitalhub/stores/client/__init__.py +12 -0
- digitalhub/stores/client/_base/api_builder.py +14 -0
- digitalhub/stores/client/_base/client.py +93 -0
- digitalhub/stores/client/_base/key_builder.py +28 -0
- digitalhub/stores/client/_base/params_builder.py +14 -0
- digitalhub/stores/client/api.py +10 -5
- digitalhub/stores/client/builder.py +3 -1
- digitalhub/stores/client/dhcore/api_builder.py +17 -0
- digitalhub/stores/client/dhcore/client.py +325 -70
- digitalhub/stores/client/dhcore/configurator.py +485 -193
- digitalhub/stores/client/dhcore/enums.py +3 -0
- digitalhub/stores/client/dhcore/error_parser.py +35 -1
- digitalhub/stores/client/dhcore/params_builder.py +113 -17
- digitalhub/stores/client/dhcore/utils.py +40 -22
- digitalhub/stores/client/local/api_builder.py +17 -0
- digitalhub/stores/client/local/client.py +6 -8
- digitalhub/stores/credentials/api.py +35 -0
- digitalhub/stores/credentials/configurator.py +210 -0
- digitalhub/stores/credentials/enums.py +68 -0
- digitalhub/stores/credentials/handler.py +176 -0
- digitalhub/stores/{configurator → credentials}/ini_module.py +60 -28
- digitalhub/stores/credentials/store.py +81 -0
- digitalhub/stores/data/_base/store.py +27 -9
- digitalhub/stores/data/api.py +49 -9
- digitalhub/stores/data/builder.py +90 -41
- digitalhub/stores/data/local/store.py +4 -7
- digitalhub/stores/data/remote/store.py +4 -7
- digitalhub/stores/data/s3/configurator.py +65 -80
- digitalhub/stores/data/s3/store.py +69 -81
- digitalhub/stores/data/s3/utils.py +10 -10
- digitalhub/stores/data/sql/configurator.py +76 -73
- digitalhub/stores/data/sql/store.py +191 -102
- digitalhub/utils/exceptions.py +6 -0
- digitalhub/utils/file_utils.py +53 -30
- digitalhub/utils/generic_utils.py +41 -33
- digitalhub/utils/git_utils.py +24 -14
- digitalhub/utils/io_utils.py +19 -18
- digitalhub/utils/uri_utils.py +31 -31
- {digitalhub-0.12.0.dist-info → digitalhub-0.13.0.dist-info}/METADATA +1 -1
- {digitalhub-0.12.0.dist-info → digitalhub-0.13.0.dist-info}/RECORD +71 -74
- digitalhub/entities/_commons/types.py +0 -9
- digitalhub/stores/configurator/api.py +0 -35
- digitalhub/stores/configurator/configurator.py +0 -202
- digitalhub/stores/configurator/credentials_store.py +0 -69
- digitalhub/stores/configurator/enums.py +0 -25
- digitalhub/stores/data/s3/enums.py +0 -20
- digitalhub/stores/data/sql/enums.py +0 -20
- digitalhub/stores/data/utils.py +0 -38
- /digitalhub/stores/{configurator → credentials}/__init__.py +0 -0
- {digitalhub-0.12.0.dist-info → digitalhub-0.13.0.dist-info}/WHEEL +0 -0
- {digitalhub-0.12.0.dist-info → digitalhub-0.13.0.dist-info}/licenses/AUTHORS +0 -0
- {digitalhub-0.12.0.dist-info → digitalhub-0.13.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -28,11 +28,13 @@ if typing.TYPE_CHECKING:
|
|
|
28
28
|
|
|
29
29
|
class ContextEntityOperationsProcessor:
|
|
30
30
|
"""
|
|
31
|
-
Processor for
|
|
31
|
+
Processor for context entity operations.
|
|
32
32
|
|
|
33
|
-
This
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
This class handles CRUD operations and other entity management tasks
|
|
34
|
+
for context-level entities (artifacts, functions, workflows, runs, etc.)
|
|
35
|
+
within projects. It manages the full lifecycle of versioned and
|
|
36
|
+
unversioned entities including creation, reading, updating, deletion,
|
|
37
|
+
import/export, and specialized operations like file uploads and metrics.
|
|
36
38
|
"""
|
|
37
39
|
|
|
38
40
|
##############################
|
|
@@ -46,23 +48,24 @@ class ContextEntityOperationsProcessor:
|
|
|
46
48
|
entity_dict: dict,
|
|
47
49
|
) -> dict:
|
|
48
50
|
"""
|
|
49
|
-
Create
|
|
51
|
+
Create a context entity in the backend.
|
|
52
|
+
|
|
53
|
+
Builds the appropriate API endpoint and sends a create request
|
|
54
|
+
to the backend for context-level entities within a project.
|
|
50
55
|
|
|
51
56
|
Parameters
|
|
52
57
|
----------
|
|
53
58
|
context : Context
|
|
54
|
-
|
|
55
|
-
project : str
|
|
56
|
-
Project name.
|
|
59
|
+
The project context instance.
|
|
57
60
|
entity_type : str
|
|
58
|
-
|
|
61
|
+
The type of entity to create (e.g., 'artifact', 'function').
|
|
59
62
|
entity_dict : dict
|
|
60
|
-
|
|
63
|
+
The entity data dictionary to create.
|
|
61
64
|
|
|
62
65
|
Returns
|
|
63
66
|
-------
|
|
64
67
|
dict
|
|
65
|
-
|
|
68
|
+
The created entity data returned from the backend.
|
|
66
69
|
"""
|
|
67
70
|
api = context.client.build_api(
|
|
68
71
|
ApiCategories.CONTEXT.value,
|
|
@@ -78,17 +81,25 @@ class ContextEntityOperationsProcessor:
|
|
|
78
81
|
**kwargs,
|
|
79
82
|
) -> ContextEntity:
|
|
80
83
|
"""
|
|
81
|
-
Create
|
|
84
|
+
Create a context entity in the backend.
|
|
85
|
+
|
|
86
|
+
Creates a new context entity either from an existing entity object
|
|
87
|
+
or by building one from the provided parameters. Handles entity
|
|
88
|
+
creation within a project context.
|
|
82
89
|
|
|
83
90
|
Parameters
|
|
84
91
|
----------
|
|
92
|
+
_entity : ContextEntity, optional
|
|
93
|
+
An existing context entity object to create. If None,
|
|
94
|
+
a new entity will be built from kwargs.
|
|
85
95
|
**kwargs : dict
|
|
86
|
-
Parameters
|
|
96
|
+
Parameters for entity creation, including 'project' and
|
|
97
|
+
entity-specific parameters.
|
|
87
98
|
|
|
88
99
|
Returns
|
|
89
100
|
-------
|
|
90
101
|
ContextEntity
|
|
91
|
-
|
|
102
|
+
The created context entity with backend data populated.
|
|
92
103
|
"""
|
|
93
104
|
if _entity is not None:
|
|
94
105
|
context = _entity._context()
|
|
@@ -104,17 +115,29 @@ class ContextEntityOperationsProcessor:
|
|
|
104
115
|
**kwargs,
|
|
105
116
|
) -> MaterialEntity:
|
|
106
117
|
"""
|
|
107
|
-
Create
|
|
118
|
+
Create a material entity in the backend and upload associated files.
|
|
119
|
+
|
|
120
|
+
Creates a new material entity (artifact, dataitem, or model) and
|
|
121
|
+
handles file upload operations. Manages upload state transitions
|
|
122
|
+
and error handling during the upload process.
|
|
108
123
|
|
|
109
124
|
Parameters
|
|
110
125
|
----------
|
|
111
126
|
**kwargs : dict
|
|
112
|
-
Parameters
|
|
127
|
+
Parameters for entity creation including:
|
|
128
|
+
- 'source': file source(s) to upload
|
|
129
|
+
- 'project': project name
|
|
130
|
+
- other entity-specific parameters
|
|
113
131
|
|
|
114
132
|
Returns
|
|
115
133
|
-------
|
|
116
134
|
MaterialEntity
|
|
117
|
-
|
|
135
|
+
The created material entity with uploaded files.
|
|
136
|
+
|
|
137
|
+
Raises
|
|
138
|
+
------
|
|
139
|
+
EntityError
|
|
140
|
+
If file upload fails during the process.
|
|
118
141
|
"""
|
|
119
142
|
source: SourcesOrListOfSources = kwargs.pop("source")
|
|
120
143
|
context = get_context_from_project(kwargs["project"])
|
|
@@ -135,7 +158,7 @@ class ContextEntityOperationsProcessor:
|
|
|
135
158
|
msg = None
|
|
136
159
|
except Exception as e:
|
|
137
160
|
uploaded = False
|
|
138
|
-
msg = str(e)
|
|
161
|
+
msg = str(e.args)
|
|
139
162
|
|
|
140
163
|
new_obj.status.message = msg
|
|
141
164
|
|
|
@@ -160,27 +183,31 @@ class ContextEntityOperationsProcessor:
|
|
|
160
183
|
**kwargs,
|
|
161
184
|
) -> dict:
|
|
162
185
|
"""
|
|
163
|
-
Read
|
|
186
|
+
Read a context entity from the backend.
|
|
187
|
+
|
|
188
|
+
Retrieves entity data from the backend using either entity ID
|
|
189
|
+
for direct access or entity name for latest version lookup.
|
|
190
|
+
Handles both specific version reads and latest version queries.
|
|
164
191
|
|
|
165
192
|
Parameters
|
|
166
193
|
----------
|
|
167
194
|
context : Context
|
|
168
|
-
|
|
195
|
+
The project context instance.
|
|
169
196
|
identifier : str
|
|
170
|
-
Entity key (store://...) or entity name.
|
|
171
|
-
entity_type : str
|
|
172
|
-
|
|
173
|
-
project : str
|
|
174
|
-
Project name.
|
|
175
|
-
entity_id : str
|
|
176
|
-
|
|
197
|
+
Entity key (store://...) or entity name identifier.
|
|
198
|
+
entity_type : str, optional
|
|
199
|
+
The type of entity to read.
|
|
200
|
+
project : str, optional
|
|
201
|
+
Project name (used for identifier parsing).
|
|
202
|
+
entity_id : str, optional
|
|
203
|
+
Specific entity ID to read.
|
|
177
204
|
**kwargs : dict
|
|
178
|
-
|
|
205
|
+
Additional parameters to pass to the API call.
|
|
179
206
|
|
|
180
207
|
Returns
|
|
181
208
|
-------
|
|
182
209
|
dict
|
|
183
|
-
|
|
210
|
+
The entity data retrieved from the backend.
|
|
184
211
|
"""
|
|
185
212
|
project, entity_type, _, entity_name, entity_id = parse_identifier(
|
|
186
213
|
identifier,
|
|
@@ -224,25 +251,28 @@ class ContextEntityOperationsProcessor:
|
|
|
224
251
|
**kwargs,
|
|
225
252
|
) -> ContextEntity:
|
|
226
253
|
"""
|
|
227
|
-
Read
|
|
254
|
+
Read a context entity from the backend.
|
|
255
|
+
|
|
256
|
+
Retrieves entity data from the backend and constructs a context
|
|
257
|
+
entity object. Handles post-processing for metrics and file info.
|
|
228
258
|
|
|
229
259
|
Parameters
|
|
230
260
|
----------
|
|
231
261
|
identifier : str
|
|
232
|
-
Entity key (store://...) or entity name.
|
|
233
|
-
entity_type : str
|
|
234
|
-
|
|
235
|
-
project : str
|
|
236
|
-
Project name.
|
|
237
|
-
entity_id : str
|
|
238
|
-
|
|
262
|
+
Entity key (store://...) or entity name identifier.
|
|
263
|
+
entity_type : str, optional
|
|
264
|
+
The type of entity to read.
|
|
265
|
+
project : str, optional
|
|
266
|
+
Project name for context resolution.
|
|
267
|
+
entity_id : str, optional
|
|
268
|
+
Specific entity ID to read.
|
|
239
269
|
**kwargs : dict
|
|
240
|
-
|
|
270
|
+
Additional parameters to pass to the API call.
|
|
241
271
|
|
|
242
272
|
Returns
|
|
243
273
|
-------
|
|
244
|
-
|
|
245
|
-
|
|
274
|
+
ContextEntity
|
|
275
|
+
The context entity object populated with backend data.
|
|
246
276
|
"""
|
|
247
277
|
context = get_context_from_identifier(identifier, project)
|
|
248
278
|
obj = self._read_context_entity(
|
|
@@ -265,25 +295,29 @@ class ContextEntityOperationsProcessor:
|
|
|
265
295
|
**kwargs,
|
|
266
296
|
) -> UnversionedEntity:
|
|
267
297
|
"""
|
|
268
|
-
Read
|
|
298
|
+
Read an unversioned entity from the backend.
|
|
299
|
+
|
|
300
|
+
Retrieves unversioned entity data (runs, tasks) from the backend.
|
|
301
|
+
Handles identifier parsing for entities that don't follow the
|
|
302
|
+
standard versioned naming convention.
|
|
269
303
|
|
|
270
304
|
Parameters
|
|
271
305
|
----------
|
|
272
306
|
identifier : str
|
|
273
|
-
Entity key (store://...) or entity
|
|
274
|
-
entity_type : str
|
|
275
|
-
|
|
276
|
-
project : str
|
|
277
|
-
Project name.
|
|
278
|
-
entity_id : str
|
|
279
|
-
|
|
307
|
+
Entity key (store://...) or entity ID.
|
|
308
|
+
entity_type : str, optional
|
|
309
|
+
The type of entity to read.
|
|
310
|
+
project : str, optional
|
|
311
|
+
Project name for context resolution.
|
|
312
|
+
entity_id : str, optional
|
|
313
|
+
Specific entity ID to read.
|
|
280
314
|
**kwargs : dict
|
|
281
|
-
|
|
315
|
+
Additional parameters to pass to the API call.
|
|
282
316
|
|
|
283
317
|
Returns
|
|
284
318
|
-------
|
|
285
319
|
UnversionedEntity
|
|
286
|
-
|
|
320
|
+
The unversioned entity object populated with backend data.
|
|
287
321
|
"""
|
|
288
322
|
if not identifier.startswith("store://"):
|
|
289
323
|
entity_id = identifier
|
|
@@ -304,17 +338,26 @@ class ContextEntityOperationsProcessor:
|
|
|
304
338
|
file: str,
|
|
305
339
|
) -> ContextEntity:
|
|
306
340
|
"""
|
|
307
|
-
Import
|
|
341
|
+
Import a context entity from a YAML file and create it in the backend.
|
|
342
|
+
|
|
343
|
+
Reads entity configuration from a YAML file and creates a new
|
|
344
|
+
context entity in the backend. Raises an error if the entity
|
|
345
|
+
already exists.
|
|
308
346
|
|
|
309
347
|
Parameters
|
|
310
348
|
----------
|
|
311
349
|
file : str
|
|
312
|
-
Path to YAML file.
|
|
350
|
+
Path to the YAML file containing entity configuration.
|
|
313
351
|
|
|
314
352
|
Returns
|
|
315
353
|
-------
|
|
316
354
|
ContextEntity
|
|
317
|
-
|
|
355
|
+
The imported and created context entity.
|
|
356
|
+
|
|
357
|
+
Raises
|
|
358
|
+
------
|
|
359
|
+
EntityError
|
|
360
|
+
If the entity already exists in the backend.
|
|
318
361
|
"""
|
|
319
362
|
dict_obj: dict = read_yaml(file)
|
|
320
363
|
dict_obj["status"] = {}
|
|
@@ -331,17 +374,27 @@ class ContextEntityOperationsProcessor:
|
|
|
331
374
|
file: str,
|
|
332
375
|
) -> ExecutableEntity:
|
|
333
376
|
"""
|
|
334
|
-
Import
|
|
377
|
+
Import an executable entity from a YAML file and create it in the backend.
|
|
378
|
+
|
|
379
|
+
Reads executable entity configuration from a YAML file and creates
|
|
380
|
+
a new executable entity (function or workflow) in the backend.
|
|
381
|
+
Also imports associated task definitions if present in the file.
|
|
335
382
|
|
|
336
383
|
Parameters
|
|
337
384
|
----------
|
|
338
385
|
file : str
|
|
339
|
-
Path to YAML file.
|
|
386
|
+
Path to the YAML file containing executable entity configuration.
|
|
387
|
+
Can contain a single entity or a list with the executable and tasks.
|
|
340
388
|
|
|
341
389
|
Returns
|
|
342
390
|
-------
|
|
343
391
|
ExecutableEntity
|
|
344
|
-
|
|
392
|
+
The imported and created executable entity.
|
|
393
|
+
|
|
394
|
+
Raises
|
|
395
|
+
------
|
|
396
|
+
EntityError
|
|
397
|
+
If the entity already exists in the backend.
|
|
345
398
|
"""
|
|
346
399
|
dict_obj: dict | list[dict] = read_yaml(file)
|
|
347
400
|
if isinstance(dict_obj, list):
|
|
@@ -371,17 +424,21 @@ class ContextEntityOperationsProcessor:
|
|
|
371
424
|
file: str,
|
|
372
425
|
) -> ContextEntity:
|
|
373
426
|
"""
|
|
374
|
-
Load
|
|
427
|
+
Load a context entity from a YAML file and update it in the backend.
|
|
428
|
+
|
|
429
|
+
Reads entity configuration from a YAML file and updates an existing
|
|
430
|
+
entity in the backend. If the entity doesn't exist, it creates a
|
|
431
|
+
new one.
|
|
375
432
|
|
|
376
433
|
Parameters
|
|
377
434
|
----------
|
|
378
435
|
file : str
|
|
379
|
-
Path to YAML file.
|
|
436
|
+
Path to the YAML file containing entity configuration.
|
|
380
437
|
|
|
381
438
|
Returns
|
|
382
439
|
-------
|
|
383
440
|
ContextEntity
|
|
384
|
-
|
|
441
|
+
The loaded and updated context entity.
|
|
385
442
|
"""
|
|
386
443
|
dict_obj: dict = read_yaml(file)
|
|
387
444
|
context = get_context_from_project(dict_obj["project"])
|
|
@@ -397,17 +454,22 @@ class ContextEntityOperationsProcessor:
|
|
|
397
454
|
file: str,
|
|
398
455
|
) -> ExecutableEntity:
|
|
399
456
|
"""
|
|
400
|
-
Load
|
|
457
|
+
Load an executable entity from a YAML file and update it in the backend.
|
|
458
|
+
|
|
459
|
+
Reads executable entity configuration from a YAML file and updates
|
|
460
|
+
an existing executable entity in the backend. If the entity doesn't
|
|
461
|
+
exist, it creates a new one. Also handles task imports.
|
|
401
462
|
|
|
402
463
|
Parameters
|
|
403
464
|
----------
|
|
404
465
|
file : str
|
|
405
|
-
Path to YAML file.
|
|
466
|
+
Path to the YAML file containing executable entity configuration.
|
|
467
|
+
Can contain a single entity or a list with the executable and tasks.
|
|
406
468
|
|
|
407
469
|
Returns
|
|
408
470
|
-------
|
|
409
471
|
ExecutableEntity
|
|
410
|
-
|
|
472
|
+
The loaded and updated executable entity.
|
|
411
473
|
"""
|
|
412
474
|
dict_obj: dict | list[dict] = read_yaml(file)
|
|
413
475
|
if isinstance(dict_obj, list):
|
|
@@ -436,25 +498,28 @@ class ContextEntityOperationsProcessor:
|
|
|
436
498
|
**kwargs,
|
|
437
499
|
) -> list[dict]:
|
|
438
500
|
"""
|
|
439
|
-
|
|
501
|
+
Read all versions of a context entity from the backend.
|
|
502
|
+
|
|
503
|
+
Retrieves all available versions of a named entity from the
|
|
504
|
+
backend using the entity name identifier.
|
|
440
505
|
|
|
441
506
|
Parameters
|
|
442
507
|
----------
|
|
443
508
|
context : Context
|
|
444
|
-
|
|
509
|
+
The project context instance.
|
|
445
510
|
identifier : str
|
|
446
|
-
Entity key (store://...) or entity name.
|
|
447
|
-
entity_type : str
|
|
448
|
-
|
|
449
|
-
project : str
|
|
450
|
-
Project name.
|
|
511
|
+
Entity key (store://...) or entity name identifier.
|
|
512
|
+
entity_type : str, optional
|
|
513
|
+
The type of entity to read versions for.
|
|
514
|
+
project : str, optional
|
|
515
|
+
Project name (used for identifier parsing).
|
|
451
516
|
**kwargs : dict
|
|
452
|
-
|
|
517
|
+
Additional parameters to pass to the API call.
|
|
453
518
|
|
|
454
519
|
Returns
|
|
455
520
|
-------
|
|
456
521
|
list[dict]
|
|
457
|
-
|
|
522
|
+
List of entity data dictionaries for all versions.
|
|
458
523
|
"""
|
|
459
524
|
project, entity_type, _, entity_name, _ = parse_identifier(
|
|
460
525
|
identifier,
|
|
@@ -485,23 +550,27 @@ class ContextEntityOperationsProcessor:
|
|
|
485
550
|
**kwargs,
|
|
486
551
|
) -> list[ContextEntity]:
|
|
487
552
|
"""
|
|
488
|
-
Read
|
|
553
|
+
Read all versions of a context entity from the backend.
|
|
554
|
+
|
|
555
|
+
Retrieves all available versions of a named entity and constructs
|
|
556
|
+
context entity objects for each version. Applies post-processing
|
|
557
|
+
for metrics and file info.
|
|
489
558
|
|
|
490
559
|
Parameters
|
|
491
560
|
----------
|
|
492
561
|
identifier : str
|
|
493
|
-
Entity key (store://...) or entity name.
|
|
494
|
-
entity_type : str
|
|
495
|
-
|
|
496
|
-
project : str
|
|
497
|
-
Project name.
|
|
562
|
+
Entity key (store://...) or entity name identifier.
|
|
563
|
+
entity_type : str, optional
|
|
564
|
+
The type of entity to read versions for.
|
|
565
|
+
project : str, optional
|
|
566
|
+
Project name for context resolution.
|
|
498
567
|
**kwargs : dict
|
|
499
|
-
|
|
568
|
+
Additional parameters to pass to the API call.
|
|
500
569
|
|
|
501
570
|
Returns
|
|
502
571
|
-------
|
|
503
572
|
list[ContextEntity]
|
|
504
|
-
List of
|
|
573
|
+
List of context entity objects for all versions.
|
|
505
574
|
"""
|
|
506
575
|
context = get_context_from_identifier(identifier, project)
|
|
507
576
|
objs = self._read_context_entity_versions(
|
|
@@ -525,21 +594,25 @@ class ContextEntityOperationsProcessor:
|
|
|
525
594
|
**kwargs,
|
|
526
595
|
) -> list[dict]:
|
|
527
596
|
"""
|
|
528
|
-
List
|
|
597
|
+
List context entities from the backend.
|
|
598
|
+
|
|
599
|
+
Retrieves a list of entities of a specific type from the backend
|
|
600
|
+
within the project context.
|
|
529
601
|
|
|
530
602
|
Parameters
|
|
531
603
|
----------
|
|
532
604
|
context : Context
|
|
533
|
-
|
|
605
|
+
The project context instance.
|
|
534
606
|
entity_type : str
|
|
535
|
-
|
|
607
|
+
The type of entities to list.
|
|
536
608
|
**kwargs : dict
|
|
537
|
-
|
|
609
|
+
Additional parameters to pass to the API call for filtering
|
|
610
|
+
or pagination.
|
|
538
611
|
|
|
539
612
|
Returns
|
|
540
613
|
-------
|
|
541
614
|
list[dict]
|
|
542
|
-
List of
|
|
615
|
+
List of entity data dictionaries from the backend.
|
|
543
616
|
"""
|
|
544
617
|
api = context.client.build_api(
|
|
545
618
|
ApiCategories.CONTEXT.value,
|
|
@@ -556,21 +629,27 @@ class ContextEntityOperationsProcessor:
|
|
|
556
629
|
**kwargs,
|
|
557
630
|
) -> list[ContextEntity]:
|
|
558
631
|
"""
|
|
559
|
-
List all latest version
|
|
632
|
+
List all latest version context entities from the backend.
|
|
633
|
+
|
|
634
|
+
Retrieves a list of entities of a specific type from the backend
|
|
635
|
+
and constructs context entity objects. Only returns the latest
|
|
636
|
+
version of each entity. Applies post-processing for metrics and
|
|
637
|
+
file info.
|
|
560
638
|
|
|
561
639
|
Parameters
|
|
562
640
|
----------
|
|
563
641
|
project : str
|
|
564
|
-
|
|
642
|
+
The project name to list entities from.
|
|
565
643
|
entity_type : str
|
|
566
|
-
|
|
644
|
+
The type of entities to list.
|
|
567
645
|
**kwargs : dict
|
|
568
|
-
|
|
646
|
+
Additional parameters to pass to the API call for filtering
|
|
647
|
+
or pagination.
|
|
569
648
|
|
|
570
649
|
Returns
|
|
571
650
|
-------
|
|
572
651
|
list[ContextEntity]
|
|
573
|
-
List of
|
|
652
|
+
List of context entity objects (latest versions only).
|
|
574
653
|
"""
|
|
575
654
|
context = get_context_from_project(project)
|
|
576
655
|
objs = self._list_context_entities(context, entity_type, **kwargs)
|
|
@@ -586,17 +665,20 @@ class ContextEntityOperationsProcessor:
|
|
|
586
665
|
new_obj: MaterialEntity,
|
|
587
666
|
) -> dict:
|
|
588
667
|
"""
|
|
589
|
-
Update material
|
|
668
|
+
Update a material entity using a shortcut method.
|
|
669
|
+
|
|
670
|
+
Convenience method for updating material entities during
|
|
671
|
+
file upload operations.
|
|
590
672
|
|
|
591
673
|
Parameters
|
|
592
674
|
----------
|
|
593
675
|
new_obj : MaterialEntity
|
|
594
|
-
|
|
676
|
+
The material entity object to update.
|
|
595
677
|
|
|
596
678
|
Returns
|
|
597
679
|
-------
|
|
598
680
|
dict
|
|
599
|
-
Response from backend.
|
|
681
|
+
Response data from the backend update operation.
|
|
600
682
|
"""
|
|
601
683
|
return self.update_context_entity(
|
|
602
684
|
new_obj.project,
|
|
@@ -614,25 +696,29 @@ class ContextEntityOperationsProcessor:
|
|
|
614
696
|
**kwargs,
|
|
615
697
|
) -> dict:
|
|
616
698
|
"""
|
|
617
|
-
Update
|
|
699
|
+
Update a context entity in the backend.
|
|
700
|
+
|
|
701
|
+
Updates an existing context entity with new data. Entity
|
|
702
|
+
specifications are typically immutable, so this primarily
|
|
703
|
+
updates status and metadata.
|
|
618
704
|
|
|
619
705
|
Parameters
|
|
620
706
|
----------
|
|
621
707
|
context : Context
|
|
622
|
-
|
|
708
|
+
The project context instance.
|
|
623
709
|
entity_type : str
|
|
624
|
-
|
|
710
|
+
The type of entity to update.
|
|
625
711
|
entity_id : str
|
|
626
|
-
|
|
712
|
+
The unique identifier of the entity to update.
|
|
627
713
|
entity_dict : dict
|
|
628
|
-
|
|
714
|
+
The updated entity data dictionary.
|
|
629
715
|
**kwargs : dict
|
|
630
|
-
|
|
716
|
+
Additional parameters to pass to the API call.
|
|
631
717
|
|
|
632
718
|
Returns
|
|
633
719
|
-------
|
|
634
720
|
dict
|
|
635
|
-
Response from backend.
|
|
721
|
+
Response data from the backend update operation.
|
|
636
722
|
"""
|
|
637
723
|
api = context.client.build_api(
|
|
638
724
|
ApiCategories.CONTEXT.value,
|
|
@@ -652,25 +738,29 @@ class ContextEntityOperationsProcessor:
|
|
|
652
738
|
**kwargs,
|
|
653
739
|
) -> ContextEntity:
|
|
654
740
|
"""
|
|
655
|
-
Update
|
|
741
|
+
Update a context entity in the backend.
|
|
742
|
+
|
|
743
|
+
Updates an existing context entity with new data and returns
|
|
744
|
+
the updated context entity object. Entity specifications are
|
|
745
|
+
typically immutable.
|
|
656
746
|
|
|
657
747
|
Parameters
|
|
658
748
|
----------
|
|
659
749
|
project : str
|
|
660
|
-
|
|
750
|
+
The project name containing the entity.
|
|
661
751
|
entity_type : str
|
|
662
|
-
|
|
752
|
+
The type of entity to update.
|
|
663
753
|
entity_id : str
|
|
664
|
-
|
|
754
|
+
The unique identifier of the entity to update.
|
|
665
755
|
entity_dict : dict
|
|
666
|
-
|
|
756
|
+
The updated entity data dictionary.
|
|
667
757
|
**kwargs : dict
|
|
668
|
-
|
|
758
|
+
Additional parameters to pass to the API call.
|
|
669
759
|
|
|
670
760
|
Returns
|
|
671
761
|
-------
|
|
672
762
|
ContextEntity
|
|
673
|
-
|
|
763
|
+
The updated context entity object.
|
|
674
764
|
"""
|
|
675
765
|
context = get_context_from_project(project)
|
|
676
766
|
obj = self._update_context_entity(
|
|
@@ -692,27 +782,33 @@ class ContextEntityOperationsProcessor:
|
|
|
692
782
|
**kwargs,
|
|
693
783
|
) -> dict:
|
|
694
784
|
"""
|
|
695
|
-
Delete
|
|
785
|
+
Delete a context entity from the backend.
|
|
786
|
+
|
|
787
|
+
Removes an entity from the backend, with options for deleting
|
|
788
|
+
specific versions or all versions of a named entity. Handles
|
|
789
|
+
cascade deletion if supported.
|
|
696
790
|
|
|
697
791
|
Parameters
|
|
698
792
|
----------
|
|
699
793
|
context : Context
|
|
700
|
-
|
|
794
|
+
The project context instance.
|
|
701
795
|
identifier : str
|
|
702
|
-
Entity key (store://...) or entity name.
|
|
703
|
-
entity_type : str
|
|
704
|
-
|
|
705
|
-
project : str
|
|
706
|
-
Project name.
|
|
707
|
-
entity_id : str
|
|
708
|
-
|
|
796
|
+
Entity key (store://...) or entity name identifier.
|
|
797
|
+
entity_type : str, optional
|
|
798
|
+
The type of entity to delete.
|
|
799
|
+
project : str, optional
|
|
800
|
+
Project name (used for identifier parsing).
|
|
801
|
+
entity_id : str, optional
|
|
802
|
+
Specific entity ID to delete.
|
|
709
803
|
**kwargs : dict
|
|
710
|
-
|
|
804
|
+
Additional parameters including:
|
|
805
|
+
- 'delete_all_versions': delete all versions of named entity
|
|
806
|
+
- 'cascade': cascade deletion options
|
|
711
807
|
|
|
712
808
|
Returns
|
|
713
809
|
-------
|
|
714
810
|
dict
|
|
715
|
-
Response from backend.
|
|
811
|
+
Response data from the backend delete operation.
|
|
716
812
|
"""
|
|
717
813
|
project, entity_type, _, entity_name, entity_id = parse_identifier(
|
|
718
814
|
identifier,
|
|
@@ -758,25 +854,28 @@ class ContextEntityOperationsProcessor:
|
|
|
758
854
|
**kwargs,
|
|
759
855
|
) -> dict:
|
|
760
856
|
"""
|
|
761
|
-
Delete
|
|
857
|
+
Delete a context entity from the backend.
|
|
858
|
+
|
|
859
|
+
Removes an entity from the backend with support for deleting
|
|
860
|
+
specific versions or all versions of a named entity.
|
|
762
861
|
|
|
763
862
|
Parameters
|
|
764
863
|
----------
|
|
765
864
|
identifier : str
|
|
766
|
-
Entity key (store://...) or entity name.
|
|
767
|
-
project : str
|
|
768
|
-
Project name.
|
|
769
|
-
entity_type : str
|
|
770
|
-
|
|
771
|
-
entity_id : str
|
|
772
|
-
|
|
865
|
+
Entity key (store://...) or entity name identifier.
|
|
866
|
+
project : str, optional
|
|
867
|
+
Project name for context resolution.
|
|
868
|
+
entity_type : str, optional
|
|
869
|
+
The type of entity to delete.
|
|
870
|
+
entity_id : str, optional
|
|
871
|
+
Specific entity ID to delete.
|
|
773
872
|
**kwargs : dict
|
|
774
|
-
|
|
873
|
+
Additional parameters including deletion options.
|
|
775
874
|
|
|
776
875
|
Returns
|
|
777
876
|
-------
|
|
778
877
|
dict
|
|
779
|
-
Response from backend.
|
|
878
|
+
Response data from the backend delete operation.
|
|
780
879
|
"""
|
|
781
880
|
context = get_context_from_identifier(identifier, project)
|
|
782
881
|
return self._delete_context_entity(
|
|
@@ -790,17 +889,20 @@ class ContextEntityOperationsProcessor:
|
|
|
790
889
|
|
|
791
890
|
def _post_process_get(self, entity: ContextEntity) -> ContextEntity:
|
|
792
891
|
"""
|
|
793
|
-
Post
|
|
892
|
+
Post-process a retrieved context entity.
|
|
893
|
+
|
|
894
|
+
Applies additional processing to entities after retrieval,
|
|
895
|
+
including loading metrics and file information if available.
|
|
794
896
|
|
|
795
897
|
Parameters
|
|
796
898
|
----------
|
|
797
899
|
entity : ContextEntity
|
|
798
|
-
|
|
900
|
+
The entity to post-process.
|
|
799
901
|
|
|
800
902
|
Returns
|
|
801
903
|
-------
|
|
802
904
|
ContextEntity
|
|
803
|
-
|
|
905
|
+
The post-processed entity with additional data loaded.
|
|
804
906
|
"""
|
|
805
907
|
if hasattr(entity.status, "metrics"):
|
|
806
908
|
entity._get_metrics()
|
|
@@ -821,25 +923,28 @@ class ContextEntityOperationsProcessor:
|
|
|
821
923
|
entity_id: str | None = None,
|
|
822
924
|
) -> str:
|
|
823
925
|
"""
|
|
824
|
-
Build
|
|
926
|
+
Build a storage key for a context entity.
|
|
927
|
+
|
|
928
|
+
Creates a standardized key string for context entity identification
|
|
929
|
+
and storage within a project context.
|
|
825
930
|
|
|
826
931
|
Parameters
|
|
827
932
|
----------
|
|
828
933
|
context : Context
|
|
829
|
-
|
|
934
|
+
The project context instance.
|
|
830
935
|
entity_type : str
|
|
831
|
-
|
|
936
|
+
The type of entity.
|
|
832
937
|
entity_kind : str
|
|
833
|
-
|
|
938
|
+
The kind/subtype of entity.
|
|
834
939
|
entity_name : str
|
|
835
|
-
|
|
836
|
-
entity_id : str
|
|
837
|
-
|
|
940
|
+
The name of the entity.
|
|
941
|
+
entity_id : str, optional
|
|
942
|
+
The unique identifier of the entity version.
|
|
838
943
|
|
|
839
944
|
Returns
|
|
840
945
|
-------
|
|
841
946
|
str
|
|
842
|
-
|
|
947
|
+
The constructed context entity key string.
|
|
843
948
|
"""
|
|
844
949
|
return context.client.build_key(
|
|
845
950
|
ApiCategories.CONTEXT.value,
|
|
@@ -859,25 +964,28 @@ class ContextEntityOperationsProcessor:
|
|
|
859
964
|
entity_id: str | None = None,
|
|
860
965
|
) -> str:
|
|
861
966
|
"""
|
|
862
|
-
Build
|
|
967
|
+
Build a storage key for a context entity.
|
|
968
|
+
|
|
969
|
+
Creates a standardized key string for context entity identification
|
|
970
|
+
and storage, resolving the project context automatically.
|
|
863
971
|
|
|
864
972
|
Parameters
|
|
865
973
|
----------
|
|
866
974
|
project : str
|
|
867
|
-
|
|
975
|
+
The project name containing the entity.
|
|
868
976
|
entity_type : str
|
|
869
|
-
|
|
977
|
+
The type of entity.
|
|
870
978
|
entity_kind : str
|
|
871
|
-
|
|
979
|
+
The kind/subtype of entity.
|
|
872
980
|
entity_name : str
|
|
873
|
-
|
|
874
|
-
entity_id : str
|
|
875
|
-
|
|
981
|
+
The name of the entity.
|
|
982
|
+
entity_id : str, optional
|
|
983
|
+
The unique identifier of the entity version.
|
|
876
984
|
|
|
877
985
|
Returns
|
|
878
986
|
-------
|
|
879
987
|
str
|
|
880
|
-
|
|
988
|
+
The constructed context entity key string.
|
|
881
989
|
"""
|
|
882
990
|
context = get_context_from_project(project)
|
|
883
991
|
return self._build_context_entity_key(context, entity_type, entity_kind, entity_name, entity_id)
|
|
@@ -889,21 +997,24 @@ class ContextEntityOperationsProcessor:
|
|
|
889
997
|
**kwargs,
|
|
890
998
|
) -> dict:
|
|
891
999
|
"""
|
|
892
|
-
|
|
1000
|
+
Read secret data from the backend.
|
|
1001
|
+
|
|
1002
|
+
Retrieves secret data stored in the backend for a specific
|
|
1003
|
+
project and entity type.
|
|
893
1004
|
|
|
894
1005
|
Parameters
|
|
895
1006
|
----------
|
|
896
1007
|
project : str
|
|
897
|
-
|
|
1008
|
+
The project name containing the secrets.
|
|
898
1009
|
entity_type : str
|
|
899
|
-
|
|
1010
|
+
The type of entity (typically 'secret').
|
|
900
1011
|
**kwargs : dict
|
|
901
|
-
|
|
1012
|
+
Additional parameters to pass to the API call.
|
|
902
1013
|
|
|
903
1014
|
Returns
|
|
904
1015
|
-------
|
|
905
1016
|
dict
|
|
906
|
-
|
|
1017
|
+
Secret data retrieved from the backend.
|
|
907
1018
|
"""
|
|
908
1019
|
context = get_context_from_project(project)
|
|
909
1020
|
api = context.client.build_api(
|
|
@@ -922,18 +1033,21 @@ class ContextEntityOperationsProcessor:
|
|
|
922
1033
|
**kwargs,
|
|
923
1034
|
) -> None:
|
|
924
1035
|
"""
|
|
925
|
-
|
|
1036
|
+
Update secret data in the backend.
|
|
1037
|
+
|
|
1038
|
+
Stores or updates secret data in the backend for a specific
|
|
1039
|
+
project and entity type.
|
|
926
1040
|
|
|
927
1041
|
Parameters
|
|
928
1042
|
----------
|
|
929
1043
|
project : str
|
|
930
|
-
|
|
1044
|
+
The project name to store secrets in.
|
|
931
1045
|
entity_type : str
|
|
932
|
-
|
|
1046
|
+
The type of entity (typically 'secret').
|
|
933
1047
|
data : dict
|
|
934
|
-
|
|
1048
|
+
The secret data dictionary to store.
|
|
935
1049
|
**kwargs : dict
|
|
936
|
-
|
|
1050
|
+
Additional parameters to pass to the API call.
|
|
937
1051
|
|
|
938
1052
|
Returns
|
|
939
1053
|
-------
|
|
@@ -956,23 +1070,26 @@ class ContextEntityOperationsProcessor:
|
|
|
956
1070
|
**kwargs,
|
|
957
1071
|
) -> dict:
|
|
958
1072
|
"""
|
|
959
|
-
|
|
1073
|
+
Read execution logs from the backend.
|
|
1074
|
+
|
|
1075
|
+
Retrieves logs for a specific run or task execution from
|
|
1076
|
+
the backend.
|
|
960
1077
|
|
|
961
1078
|
Parameters
|
|
962
1079
|
----------
|
|
963
1080
|
project : str
|
|
964
|
-
|
|
1081
|
+
The project name containing the entity.
|
|
965
1082
|
entity_type : str
|
|
966
|
-
|
|
1083
|
+
The type of entity (typically 'run' or 'task').
|
|
967
1084
|
entity_id : str
|
|
968
|
-
|
|
1085
|
+
The unique identifier of the entity to get logs for.
|
|
969
1086
|
**kwargs : dict
|
|
970
|
-
|
|
1087
|
+
Additional parameters to pass to the API call.
|
|
971
1088
|
|
|
972
1089
|
Returns
|
|
973
1090
|
-------
|
|
974
1091
|
dict
|
|
975
|
-
|
|
1092
|
+
Log data retrieved from the backend.
|
|
976
1093
|
"""
|
|
977
1094
|
context = get_context_from_project(project)
|
|
978
1095
|
api = context.client.build_api(
|
|
@@ -984,7 +1101,7 @@ class ContextEntityOperationsProcessor:
|
|
|
984
1101
|
)
|
|
985
1102
|
return context.client.read_object(api, **kwargs)
|
|
986
1103
|
|
|
987
|
-
def
|
|
1104
|
+
def stop_entity(
|
|
988
1105
|
self,
|
|
989
1106
|
project: str,
|
|
990
1107
|
entity_type: str,
|
|
@@ -992,18 +1109,21 @@ class ContextEntityOperationsProcessor:
|
|
|
992
1109
|
**kwargs,
|
|
993
1110
|
) -> None:
|
|
994
1111
|
"""
|
|
995
|
-
Stop
|
|
1112
|
+
Stop a running entity in the backend.
|
|
1113
|
+
|
|
1114
|
+
Sends a stop signal to halt execution of a running entity
|
|
1115
|
+
such as a workflow or long-running task.
|
|
996
1116
|
|
|
997
1117
|
Parameters
|
|
998
1118
|
----------
|
|
999
1119
|
project : str
|
|
1000
|
-
|
|
1120
|
+
The project name containing the entity.
|
|
1001
1121
|
entity_type : str
|
|
1002
|
-
|
|
1122
|
+
The type of entity to stop.
|
|
1003
1123
|
entity_id : str
|
|
1004
|
-
|
|
1124
|
+
The unique identifier of the entity to stop.
|
|
1005
1125
|
**kwargs : dict
|
|
1006
|
-
|
|
1126
|
+
Additional parameters to pass to the API call.
|
|
1007
1127
|
|
|
1008
1128
|
Returns
|
|
1009
1129
|
-------
|
|
@@ -1019,7 +1139,7 @@ class ContextEntityOperationsProcessor:
|
|
|
1019
1139
|
)
|
|
1020
1140
|
context.client.create_object(api, **kwargs)
|
|
1021
1141
|
|
|
1022
|
-
def
|
|
1142
|
+
def resume_entity(
|
|
1023
1143
|
self,
|
|
1024
1144
|
project: str,
|
|
1025
1145
|
entity_type: str,
|
|
@@ -1027,18 +1147,21 @@ class ContextEntityOperationsProcessor:
|
|
|
1027
1147
|
**kwargs,
|
|
1028
1148
|
) -> None:
|
|
1029
1149
|
"""
|
|
1030
|
-
Resume
|
|
1150
|
+
Resume a stopped entity in the backend.
|
|
1151
|
+
|
|
1152
|
+
Sends a resume signal to restart execution of a previously
|
|
1153
|
+
stopped entity such as a workflow or task.
|
|
1031
1154
|
|
|
1032
1155
|
Parameters
|
|
1033
1156
|
----------
|
|
1034
1157
|
project : str
|
|
1035
|
-
|
|
1158
|
+
The project name containing the entity.
|
|
1036
1159
|
entity_type : str
|
|
1037
|
-
|
|
1160
|
+
The type of entity to resume.
|
|
1038
1161
|
entity_id : str
|
|
1039
|
-
|
|
1162
|
+
The unique identifier of the entity to resume.
|
|
1040
1163
|
**kwargs : dict
|
|
1041
|
-
|
|
1164
|
+
Additional parameters to pass to the API call.
|
|
1042
1165
|
|
|
1043
1166
|
Returns
|
|
1044
1167
|
-------
|
|
@@ -1062,23 +1185,26 @@ class ContextEntityOperationsProcessor:
|
|
|
1062
1185
|
**kwargs,
|
|
1063
1186
|
) -> list[dict]:
|
|
1064
1187
|
"""
|
|
1065
|
-
|
|
1188
|
+
Read file information from the backend.
|
|
1189
|
+
|
|
1190
|
+
Retrieves metadata about files associated with an entity,
|
|
1191
|
+
including file paths, sizes, and other attributes.
|
|
1066
1192
|
|
|
1067
1193
|
Parameters
|
|
1068
1194
|
----------
|
|
1069
1195
|
project : str
|
|
1070
|
-
|
|
1196
|
+
The project name containing the entity.
|
|
1071
1197
|
entity_type : str
|
|
1072
|
-
|
|
1198
|
+
The type of entity to get file info for.
|
|
1073
1199
|
entity_id : str
|
|
1074
|
-
|
|
1200
|
+
The unique identifier of the entity.
|
|
1075
1201
|
**kwargs : dict
|
|
1076
|
-
|
|
1202
|
+
Additional parameters to pass to the API call.
|
|
1077
1203
|
|
|
1078
1204
|
Returns
|
|
1079
1205
|
-------
|
|
1080
1206
|
list[dict]
|
|
1081
|
-
|
|
1207
|
+
List of file information dictionaries from the backend.
|
|
1082
1208
|
"""
|
|
1083
1209
|
context = get_context_from_project(project)
|
|
1084
1210
|
api = context.client.build_api(
|
|
@@ -1137,23 +1263,30 @@ class ContextEntityOperationsProcessor:
|
|
|
1137
1263
|
**kwargs,
|
|
1138
1264
|
) -> dict:
|
|
1139
1265
|
"""
|
|
1140
|
-
|
|
1266
|
+
Read metrics from the backend for a specific entity.
|
|
1267
|
+
|
|
1268
|
+
Retrieves metrics data associated with an entity. Can fetch either
|
|
1269
|
+
all metrics or a specific metric by name. Used for performance
|
|
1270
|
+
monitoring and analysis of entity operations.
|
|
1141
1271
|
|
|
1142
1272
|
Parameters
|
|
1143
1273
|
----------
|
|
1144
1274
|
project : str
|
|
1145
|
-
|
|
1275
|
+
The project name containing the entity.
|
|
1146
1276
|
entity_type : str
|
|
1147
|
-
|
|
1277
|
+
The type of entity to read metrics from.
|
|
1148
1278
|
entity_id : str
|
|
1149
|
-
|
|
1279
|
+
The unique identifier of the entity.
|
|
1280
|
+
metric_name : str, optional
|
|
1281
|
+
The name of a specific metric to retrieve.
|
|
1282
|
+
If None, retrieves all available metrics.
|
|
1150
1283
|
**kwargs : dict
|
|
1151
|
-
|
|
1284
|
+
Additional parameters to pass to the API call.
|
|
1152
1285
|
|
|
1153
1286
|
Returns
|
|
1154
1287
|
-------
|
|
1155
1288
|
dict
|
|
1156
|
-
|
|
1289
|
+
Dictionary containing metric data from the backend.
|
|
1157
1290
|
"""
|
|
1158
1291
|
context = get_context_from_project(project)
|
|
1159
1292
|
api = context.client.build_api(
|
|
@@ -1176,18 +1309,27 @@ class ContextEntityOperationsProcessor:
|
|
|
1176
1309
|
**kwargs,
|
|
1177
1310
|
) -> None:
|
|
1178
1311
|
"""
|
|
1179
|
-
|
|
1312
|
+
Update or create a metric value for an entity in the backend.
|
|
1313
|
+
|
|
1314
|
+
Updates an existing metric or creates a new one with the specified
|
|
1315
|
+
value. Metrics are used for tracking performance, status, and
|
|
1316
|
+
other quantitative aspects of entity operations.
|
|
1180
1317
|
|
|
1181
1318
|
Parameters
|
|
1182
1319
|
----------
|
|
1183
1320
|
project : str
|
|
1184
|
-
|
|
1321
|
+
The project name containing the entity.
|
|
1185
1322
|
entity_type : str
|
|
1186
|
-
|
|
1323
|
+
The type of entity to update metrics for.
|
|
1187
1324
|
entity_id : str
|
|
1188
|
-
|
|
1325
|
+
The unique identifier of the entity.
|
|
1326
|
+
metric_name : str
|
|
1327
|
+
The name of the metric to update or create.
|
|
1328
|
+
metric_value : Any
|
|
1329
|
+
The value to set for the metric.
|
|
1330
|
+
Can be numeric, string, or other supported types.
|
|
1189
1331
|
**kwargs : dict
|
|
1190
|
-
|
|
1332
|
+
Additional parameters to pass to the API call.
|
|
1191
1333
|
|
|
1192
1334
|
Returns
|
|
1193
1335
|
-------
|
|
@@ -1210,19 +1352,23 @@ class ContextEntityOperationsProcessor:
|
|
|
1210
1352
|
**kwargs,
|
|
1211
1353
|
) -> dict:
|
|
1212
1354
|
"""
|
|
1213
|
-
|
|
1355
|
+
Execute search query against the backend API.
|
|
1356
|
+
|
|
1357
|
+
Internal method that performs the actual search operation
|
|
1358
|
+
by building API parameters, executing the search request,
|
|
1359
|
+
and processing the results into entity objects.
|
|
1214
1360
|
|
|
1215
1361
|
Parameters
|
|
1216
1362
|
----------
|
|
1217
1363
|
context : Context
|
|
1218
|
-
|
|
1364
|
+
The context instance containing client and project information.
|
|
1219
1365
|
**kwargs : dict
|
|
1220
|
-
|
|
1366
|
+
Search parameters and filters to pass to the API call.
|
|
1221
1367
|
|
|
1222
1368
|
Returns
|
|
1223
1369
|
-------
|
|
1224
1370
|
dict
|
|
1225
|
-
|
|
1371
|
+
List of context entity objects matching the search criteria.
|
|
1226
1372
|
"""
|
|
1227
1373
|
kwargs = context.client.build_parameters(
|
|
1228
1374
|
ApiCategories.CONTEXT.value,
|
|
@@ -1251,35 +1397,40 @@ class ContextEntityOperationsProcessor:
|
|
|
1251
1397
|
**kwargs,
|
|
1252
1398
|
) -> list[ContextEntity]:
|
|
1253
1399
|
"""
|
|
1254
|
-
Search
|
|
1400
|
+
Search for entities in the backend using various criteria.
|
|
1401
|
+
|
|
1402
|
+
Performs a flexible search across multiple entity attributes,
|
|
1403
|
+
allowing for complex queries and filtering. Returns matching
|
|
1404
|
+
entities from the project context.
|
|
1255
1405
|
|
|
1256
1406
|
Parameters
|
|
1257
1407
|
----------
|
|
1258
1408
|
project : str
|
|
1259
|
-
|
|
1260
|
-
query : str
|
|
1261
|
-
|
|
1262
|
-
entity_types : list[str]
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1409
|
+
The project name to search within.
|
|
1410
|
+
query : str, optional
|
|
1411
|
+
Free-text search query to match against entity content.
|
|
1412
|
+
entity_types : list[str], optional
|
|
1413
|
+
List of entity types to filter by.
|
|
1414
|
+
If None, searches all entity types.
|
|
1415
|
+
name : str, optional
|
|
1416
|
+
Entity name pattern to match.
|
|
1417
|
+
kind : str, optional
|
|
1418
|
+
Entity kind to filter by.
|
|
1419
|
+
created : str, optional
|
|
1420
|
+
Creation date filter (ISO format).
|
|
1421
|
+
updated : str, optional
|
|
1422
|
+
Last update date filter (ISO format).
|
|
1423
|
+
description : str, optional
|
|
1424
|
+
Description pattern to match.
|
|
1425
|
+
labels : list[str], optional
|
|
1426
|
+
List of label patterns to match.
|
|
1276
1427
|
**kwargs : dict
|
|
1277
|
-
|
|
1428
|
+
Additional search parameters to pass to the API call.
|
|
1278
1429
|
|
|
1279
1430
|
Returns
|
|
1280
1431
|
-------
|
|
1281
1432
|
list[ContextEntity]
|
|
1282
|
-
List of
|
|
1433
|
+
List of matching entity instances from the search.
|
|
1283
1434
|
"""
|
|
1284
1435
|
context = get_context_from_project(project)
|
|
1285
1436
|
return self._search(
|