digitalhub 0.13.0b3__py3-none-any.whl → 0.14.0b0__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 +3 -8
- digitalhub/entities/_base/_base/entity.py +0 -11
- digitalhub/entities/_base/entity/builder.py +5 -5
- digitalhub/entities/_base/executable/entity.py +1 -1
- digitalhub/entities/_base/runtime_entity/builder.py +53 -18
- digitalhub/entities/_commons/metrics.py +64 -30
- digitalhub/entities/_commons/utils.py +100 -30
- digitalhub/entities/_processors/base.py +160 -81
- digitalhub/entities/_processors/context.py +424 -224
- digitalhub/entities/_processors/utils.py +77 -33
- digitalhub/entities/artifact/crud.py +20 -4
- digitalhub/entities/artifact/utils.py +29 -14
- digitalhub/entities/dataitem/crud.py +20 -4
- digitalhub/entities/dataitem/table/entity.py +0 -21
- digitalhub/entities/dataitem/utils.py +84 -34
- digitalhub/entities/function/_base/entity.py +1 -1
- digitalhub/entities/function/crud.py +15 -4
- digitalhub/entities/model/_base/entity.py +21 -1
- digitalhub/entities/model/crud.py +21 -5
- digitalhub/entities/model/utils.py +29 -14
- digitalhub/entities/project/_base/entity.py +65 -33
- digitalhub/entities/project/crud.py +8 -1
- digitalhub/entities/run/_base/entity.py +21 -1
- digitalhub/entities/run/crud.py +22 -5
- digitalhub/entities/secret/crud.py +22 -5
- digitalhub/entities/task/crud.py +22 -5
- digitalhub/entities/trigger/crud.py +20 -4
- digitalhub/entities/workflow/_base/entity.py +1 -1
- digitalhub/entities/workflow/crud.py +15 -4
- digitalhub/factory/enums.py +18 -0
- digitalhub/factory/factory.py +136 -57
- digitalhub/factory/utils.py +3 -54
- digitalhub/stores/client/api.py +6 -10
- digitalhub/stores/client/builder.py +3 -3
- digitalhub/stores/client/dhcore/client.py +104 -162
- digitalhub/stores/client/dhcore/configurator.py +92 -289
- digitalhub/stores/client/dhcore/enums.py +0 -16
- digitalhub/stores/client/dhcore/params_builder.py +41 -83
- digitalhub/stores/client/dhcore/utils.py +14 -22
- digitalhub/stores/client/local/client.py +77 -45
- digitalhub/stores/credentials/enums.py +1 -0
- digitalhub/stores/credentials/ini_module.py +0 -16
- digitalhub/stores/data/api.py +1 -1
- digitalhub/stores/data/builder.py +66 -4
- digitalhub/stores/data/local/store.py +0 -103
- digitalhub/stores/data/s3/configurator.py +60 -6
- digitalhub/stores/data/s3/store.py +44 -2
- digitalhub/stores/data/sql/configurator.py +57 -7
- digitalhub/stores/data/sql/store.py +184 -78
- digitalhub/utils/file_utils.py +0 -17
- digitalhub/utils/generic_utils.py +1 -2
- digitalhub/utils/store_utils.py +44 -0
- {digitalhub-0.13.0b3.dist-info → digitalhub-0.14.0b0.dist-info}/METADATA +3 -2
- {digitalhub-0.13.0b3.dist-info → digitalhub-0.14.0b0.dist-info}/RECORD +63 -65
- digitalhub/entities/_commons/types.py +0 -9
- digitalhub/entities/task/_base/utils.py +0 -22
- digitalhub/stores/client/dhcore/models.py +0 -40
- 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}/name.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-0.13.0b3.dist-info → digitalhub-0.14.0b0.dist-info}/WHEEL +0 -0
- {digitalhub-0.13.0b3.dist-info → digitalhub-0.14.0b0.dist-info}/licenses/AUTHORS +0 -0
- {digitalhub-0.13.0b3.dist-info → digitalhub-0.14.0b0.dist-info}/licenses/LICENSE +0 -0
|
@@ -8,6 +8,8 @@ import typing
|
|
|
8
8
|
from typing import Any
|
|
9
9
|
|
|
10
10
|
from digitalhub.entities._commons.enums import ApiCategories, BackendOperations, Relationship, State
|
|
11
|
+
from digitalhub.entities._commons.utils import is_valid_key
|
|
12
|
+
from digitalhub.entities._constructors.uuid import build_uuid
|
|
11
13
|
from digitalhub.entities._processors.utils import (
|
|
12
14
|
get_context_from_identifier,
|
|
13
15
|
get_context_from_project,
|
|
@@ -28,11 +30,13 @@ if typing.TYPE_CHECKING:
|
|
|
28
30
|
|
|
29
31
|
class ContextEntityOperationsProcessor:
|
|
30
32
|
"""
|
|
31
|
-
Processor for
|
|
33
|
+
Processor for context entity operations.
|
|
32
34
|
|
|
33
|
-
This
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
This class handles CRUD operations and other entity management tasks
|
|
36
|
+
for context-level entities (artifacts, functions, workflows, runs, etc.)
|
|
37
|
+
within projects. It manages the full lifecycle of versioned and
|
|
38
|
+
unversioned entities including creation, reading, updating, deletion,
|
|
39
|
+
import/export, and specialized operations like file uploads and metrics.
|
|
36
40
|
"""
|
|
37
41
|
|
|
38
42
|
##############################
|
|
@@ -46,23 +50,24 @@ class ContextEntityOperationsProcessor:
|
|
|
46
50
|
entity_dict: dict,
|
|
47
51
|
) -> dict:
|
|
48
52
|
"""
|
|
49
|
-
Create
|
|
53
|
+
Create a context entity in the backend.
|
|
54
|
+
|
|
55
|
+
Builds the appropriate API endpoint and sends a create request
|
|
56
|
+
to the backend for context-level entities within a project.
|
|
50
57
|
|
|
51
58
|
Parameters
|
|
52
59
|
----------
|
|
53
60
|
context : Context
|
|
54
|
-
|
|
55
|
-
project : str
|
|
56
|
-
Project name.
|
|
61
|
+
The project context instance.
|
|
57
62
|
entity_type : str
|
|
58
|
-
|
|
63
|
+
The type of entity to create (e.g., 'artifact', 'function').
|
|
59
64
|
entity_dict : dict
|
|
60
|
-
|
|
65
|
+
The entity data dictionary to create.
|
|
61
66
|
|
|
62
67
|
Returns
|
|
63
68
|
-------
|
|
64
69
|
dict
|
|
65
|
-
|
|
70
|
+
The created entity data returned from the backend.
|
|
66
71
|
"""
|
|
67
72
|
api = context.client.build_api(
|
|
68
73
|
ApiCategories.CONTEXT.value,
|
|
@@ -78,17 +83,25 @@ class ContextEntityOperationsProcessor:
|
|
|
78
83
|
**kwargs,
|
|
79
84
|
) -> ContextEntity:
|
|
80
85
|
"""
|
|
81
|
-
Create
|
|
86
|
+
Create a context entity in the backend.
|
|
87
|
+
|
|
88
|
+
Creates a new context entity either from an existing entity object
|
|
89
|
+
or by building one from the provided parameters. Handles entity
|
|
90
|
+
creation within a project context.
|
|
82
91
|
|
|
83
92
|
Parameters
|
|
84
93
|
----------
|
|
94
|
+
_entity : ContextEntity, optional
|
|
95
|
+
An existing context entity object to create. If None,
|
|
96
|
+
a new entity will be built from kwargs.
|
|
85
97
|
**kwargs : dict
|
|
86
|
-
Parameters
|
|
98
|
+
Parameters for entity creation, including 'project' and
|
|
99
|
+
entity-specific parameters.
|
|
87
100
|
|
|
88
101
|
Returns
|
|
89
102
|
-------
|
|
90
103
|
ContextEntity
|
|
91
|
-
|
|
104
|
+
The created context entity with backend data populated.
|
|
92
105
|
"""
|
|
93
106
|
if _entity is not None:
|
|
94
107
|
context = _entity._context()
|
|
@@ -104,17 +117,29 @@ class ContextEntityOperationsProcessor:
|
|
|
104
117
|
**kwargs,
|
|
105
118
|
) -> MaterialEntity:
|
|
106
119
|
"""
|
|
107
|
-
Create
|
|
120
|
+
Create a material entity in the backend and upload associated files.
|
|
121
|
+
|
|
122
|
+
Creates a new material entity (artifact, dataitem, or model) and
|
|
123
|
+
handles file upload operations. Manages upload state transitions
|
|
124
|
+
and error handling during the upload process.
|
|
108
125
|
|
|
109
126
|
Parameters
|
|
110
127
|
----------
|
|
111
128
|
**kwargs : dict
|
|
112
|
-
Parameters
|
|
129
|
+
Parameters for entity creation including:
|
|
130
|
+
- 'source': file source(s) to upload
|
|
131
|
+
- 'project': project name
|
|
132
|
+
- other entity-specific parameters
|
|
113
133
|
|
|
114
134
|
Returns
|
|
115
135
|
-------
|
|
116
136
|
MaterialEntity
|
|
117
|
-
|
|
137
|
+
The created material entity with uploaded files.
|
|
138
|
+
|
|
139
|
+
Raises
|
|
140
|
+
------
|
|
141
|
+
EntityError
|
|
142
|
+
If file upload fails during the process.
|
|
118
143
|
"""
|
|
119
144
|
source: SourcesOrListOfSources = kwargs.pop("source")
|
|
120
145
|
context = get_context_from_project(kwargs["project"])
|
|
@@ -160,27 +185,31 @@ class ContextEntityOperationsProcessor:
|
|
|
160
185
|
**kwargs,
|
|
161
186
|
) -> dict:
|
|
162
187
|
"""
|
|
163
|
-
Read
|
|
188
|
+
Read a context entity from the backend.
|
|
189
|
+
|
|
190
|
+
Retrieves entity data from the backend using either entity ID
|
|
191
|
+
for direct access or entity name for latest version lookup.
|
|
192
|
+
Handles both specific version reads and latest version queries.
|
|
164
193
|
|
|
165
194
|
Parameters
|
|
166
195
|
----------
|
|
167
196
|
context : Context
|
|
168
|
-
|
|
197
|
+
The project context instance.
|
|
169
198
|
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
|
-
|
|
199
|
+
Entity key (store://...) or entity name identifier.
|
|
200
|
+
entity_type : str, optional
|
|
201
|
+
The type of entity to read.
|
|
202
|
+
project : str, optional
|
|
203
|
+
Project name (used for identifier parsing).
|
|
204
|
+
entity_id : str, optional
|
|
205
|
+
Specific entity ID to read.
|
|
177
206
|
**kwargs : dict
|
|
178
|
-
|
|
207
|
+
Additional parameters to pass to the API call.
|
|
179
208
|
|
|
180
209
|
Returns
|
|
181
210
|
-------
|
|
182
211
|
dict
|
|
183
|
-
|
|
212
|
+
The entity data retrieved from the backend.
|
|
184
213
|
"""
|
|
185
214
|
project, entity_type, _, entity_name, entity_id = parse_identifier(
|
|
186
215
|
identifier,
|
|
@@ -224,25 +253,28 @@ class ContextEntityOperationsProcessor:
|
|
|
224
253
|
**kwargs,
|
|
225
254
|
) -> ContextEntity:
|
|
226
255
|
"""
|
|
227
|
-
Read
|
|
256
|
+
Read a context entity from the backend.
|
|
257
|
+
|
|
258
|
+
Retrieves entity data from the backend and constructs a context
|
|
259
|
+
entity object. Handles post-processing for metrics and file info.
|
|
228
260
|
|
|
229
261
|
Parameters
|
|
230
262
|
----------
|
|
231
263
|
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
|
-
|
|
264
|
+
Entity key (store://...) or entity name identifier.
|
|
265
|
+
entity_type : str, optional
|
|
266
|
+
The type of entity to read.
|
|
267
|
+
project : str, optional
|
|
268
|
+
Project name for context resolution.
|
|
269
|
+
entity_id : str, optional
|
|
270
|
+
Specific entity ID to read.
|
|
239
271
|
**kwargs : dict
|
|
240
|
-
|
|
272
|
+
Additional parameters to pass to the API call.
|
|
241
273
|
|
|
242
274
|
Returns
|
|
243
275
|
-------
|
|
244
|
-
|
|
245
|
-
|
|
276
|
+
ContextEntity
|
|
277
|
+
The context entity object populated with backend data.
|
|
246
278
|
"""
|
|
247
279
|
context = get_context_from_identifier(identifier, project)
|
|
248
280
|
obj = self._read_context_entity(
|
|
@@ -265,27 +297,31 @@ class ContextEntityOperationsProcessor:
|
|
|
265
297
|
**kwargs,
|
|
266
298
|
) -> UnversionedEntity:
|
|
267
299
|
"""
|
|
268
|
-
Read
|
|
300
|
+
Read an unversioned entity from the backend.
|
|
301
|
+
|
|
302
|
+
Retrieves unversioned entity data (runs, tasks) from the backend.
|
|
303
|
+
Handles identifier parsing for entities that don't follow the
|
|
304
|
+
standard versioned naming convention.
|
|
269
305
|
|
|
270
306
|
Parameters
|
|
271
307
|
----------
|
|
272
308
|
identifier : str
|
|
273
|
-
Entity key (store://...) or entity
|
|
274
|
-
entity_type : str
|
|
275
|
-
|
|
276
|
-
project : str
|
|
277
|
-
Project name.
|
|
278
|
-
entity_id : str
|
|
279
|
-
|
|
309
|
+
Entity key (store://...) or entity ID.
|
|
310
|
+
entity_type : str, optional
|
|
311
|
+
The type of entity to read.
|
|
312
|
+
project : str, optional
|
|
313
|
+
Project name for context resolution.
|
|
314
|
+
entity_id : str, optional
|
|
315
|
+
Specific entity ID to read.
|
|
280
316
|
**kwargs : dict
|
|
281
|
-
|
|
317
|
+
Additional parameters to pass to the API call.
|
|
282
318
|
|
|
283
319
|
Returns
|
|
284
320
|
-------
|
|
285
321
|
UnversionedEntity
|
|
286
|
-
|
|
322
|
+
The unversioned entity object populated with backend data.
|
|
287
323
|
"""
|
|
288
|
-
if not identifier
|
|
324
|
+
if not is_valid_key(identifier):
|
|
289
325
|
entity_id = identifier
|
|
290
326
|
else:
|
|
291
327
|
splt = identifier.split(":")
|
|
@@ -301,49 +337,104 @@ class ContextEntityOperationsProcessor:
|
|
|
301
337
|
|
|
302
338
|
def import_context_entity(
|
|
303
339
|
self,
|
|
304
|
-
file: str,
|
|
340
|
+
file: str | None = None,
|
|
341
|
+
key: str | None = None,
|
|
342
|
+
reset_id: bool = False,
|
|
343
|
+
context: str | None = None,
|
|
305
344
|
) -> ContextEntity:
|
|
306
345
|
"""
|
|
307
|
-
Import
|
|
346
|
+
Import a context entity from a YAML file or from a storage key.
|
|
308
347
|
|
|
309
348
|
Parameters
|
|
310
349
|
----------
|
|
311
350
|
file : str
|
|
312
|
-
Path to YAML file.
|
|
351
|
+
Path to the YAML file containing entity configuration.
|
|
352
|
+
key : str
|
|
353
|
+
Storage key (store://...) to read the entity from.
|
|
354
|
+
reset_id : bool
|
|
355
|
+
Flag to determine if the ID of context entities should be reset.
|
|
356
|
+
context : str, optional
|
|
357
|
+
Project name to use for context resolution. If None, uses
|
|
358
|
+
the project specified in the YAML file.
|
|
313
359
|
|
|
314
360
|
Returns
|
|
315
361
|
-------
|
|
316
362
|
ContextEntity
|
|
317
|
-
|
|
363
|
+
The imported and created context entity.
|
|
364
|
+
|
|
365
|
+
Raises
|
|
366
|
+
------
|
|
367
|
+
EntityError
|
|
368
|
+
If the entity already exists in the backend.
|
|
318
369
|
"""
|
|
319
|
-
|
|
370
|
+
if (file is None) == (key is None):
|
|
371
|
+
raise ValueError("Provide key or file, not both or none.")
|
|
372
|
+
|
|
373
|
+
if file is not None:
|
|
374
|
+
dict_obj: dict = read_yaml(file)
|
|
375
|
+
else:
|
|
376
|
+
ctx = get_context_from_identifier(key)
|
|
377
|
+
dict_obj: dict = self._read_context_entity(ctx, key)
|
|
378
|
+
|
|
320
379
|
dict_obj["status"] = {}
|
|
321
|
-
|
|
380
|
+
|
|
381
|
+
if context is None:
|
|
382
|
+
context = dict_obj["project"]
|
|
383
|
+
|
|
384
|
+
ctx = get_context_from_project(context)
|
|
322
385
|
obj = factory.build_entity_from_dict(dict_obj)
|
|
386
|
+
if reset_id:
|
|
387
|
+
new_id = build_uuid()
|
|
388
|
+
obj.id = new_id
|
|
389
|
+
obj.metadata.version = new_id
|
|
323
390
|
try:
|
|
324
|
-
self._create_context_entity(
|
|
391
|
+
bck_obj = self._create_context_entity(ctx, obj.ENTITY_TYPE, obj.to_dict())
|
|
392
|
+
new_obj: ContextEntity = factory.build_entity_from_dict(bck_obj)
|
|
325
393
|
except EntityAlreadyExistsError:
|
|
326
394
|
raise EntityError(f"Entity {obj.name} already exists. If you want to update it, use load instead.")
|
|
327
|
-
return
|
|
395
|
+
return new_obj
|
|
328
396
|
|
|
329
397
|
def import_executable_entity(
|
|
330
398
|
self,
|
|
331
|
-
file: str,
|
|
399
|
+
file: str | None = None,
|
|
400
|
+
key: str | None = None,
|
|
401
|
+
reset_id: bool = False,
|
|
402
|
+
context: str | None = None,
|
|
332
403
|
) -> ExecutableEntity:
|
|
333
404
|
"""
|
|
334
|
-
Import
|
|
405
|
+
Import an executable entity from a YAML file or from a storage key.
|
|
335
406
|
|
|
336
407
|
Parameters
|
|
337
408
|
----------
|
|
338
409
|
file : str
|
|
339
|
-
Path to YAML file.
|
|
410
|
+
Path to the YAML file containing executable entity configuration.
|
|
411
|
+
Can contain a single entity or a list with the executable and tasks.
|
|
412
|
+
key : str
|
|
413
|
+
Storage key (store://...) to read the entity from.
|
|
414
|
+
reset_id : bool
|
|
415
|
+
Flag to determine if the ID of executable entities should be reset.
|
|
416
|
+
context : str, optional
|
|
417
|
+
Project name to use for context resolution.
|
|
340
418
|
|
|
341
419
|
Returns
|
|
342
420
|
-------
|
|
343
421
|
ExecutableEntity
|
|
344
|
-
|
|
422
|
+
The imported and created executable entity.
|
|
423
|
+
|
|
424
|
+
Raises
|
|
425
|
+
------
|
|
426
|
+
EntityError
|
|
427
|
+
If the entity already exists in the backend.
|
|
345
428
|
"""
|
|
346
|
-
|
|
429
|
+
if (file is None) == (key is None):
|
|
430
|
+
raise ValueError("Provide key or file, not both or none.")
|
|
431
|
+
|
|
432
|
+
if file is not None:
|
|
433
|
+
dict_obj: dict | list[dict] = read_yaml(file)
|
|
434
|
+
else:
|
|
435
|
+
ctx = get_context_from_identifier(key)
|
|
436
|
+
dict_obj: dict = self._read_context_entity(ctx, key)
|
|
437
|
+
|
|
347
438
|
if isinstance(dict_obj, list):
|
|
348
439
|
exec_dict = dict_obj[0]
|
|
349
440
|
exec_dict["status"] = {}
|
|
@@ -353,35 +444,50 @@ class ContextEntityOperationsProcessor:
|
|
|
353
444
|
tsk_dicts.append(i)
|
|
354
445
|
else:
|
|
355
446
|
exec_dict = dict_obj
|
|
447
|
+
exec_dict["status"] = {}
|
|
356
448
|
tsk_dicts = []
|
|
357
449
|
|
|
358
|
-
context
|
|
450
|
+
if context is None:
|
|
451
|
+
context = exec_dict["project"]
|
|
452
|
+
|
|
453
|
+
ctx = get_context_from_project(context)
|
|
359
454
|
obj: ExecutableEntity = factory.build_entity_from_dict(exec_dict)
|
|
455
|
+
|
|
456
|
+
if reset_id:
|
|
457
|
+
new_id = build_uuid()
|
|
458
|
+
obj.id = new_id
|
|
459
|
+
obj.metadata.version = new_id
|
|
460
|
+
|
|
360
461
|
try:
|
|
361
|
-
self._create_context_entity(
|
|
462
|
+
bck_obj = self._create_context_entity(ctx, obj.ENTITY_TYPE, obj.to_dict())
|
|
463
|
+
new_obj: ExecutableEntity = factory.build_entity_from_dict(bck_obj)
|
|
362
464
|
except EntityAlreadyExistsError:
|
|
363
465
|
raise EntityError(f"Entity {obj.name} already exists. If you want to update it, use load instead.")
|
|
364
466
|
|
|
365
|
-
|
|
467
|
+
new_obj.import_tasks(tsk_dicts)
|
|
366
468
|
|
|
367
|
-
return
|
|
469
|
+
return new_obj
|
|
368
470
|
|
|
369
471
|
def load_context_entity(
|
|
370
472
|
self,
|
|
371
473
|
file: str,
|
|
372
474
|
) -> ContextEntity:
|
|
373
475
|
"""
|
|
374
|
-
Load
|
|
476
|
+
Load a context entity from a YAML file and update it in the backend.
|
|
477
|
+
|
|
478
|
+
Reads entity configuration from a YAML file and updates an existing
|
|
479
|
+
entity in the backend. If the entity doesn't exist, it creates a
|
|
480
|
+
new one.
|
|
375
481
|
|
|
376
482
|
Parameters
|
|
377
483
|
----------
|
|
378
484
|
file : str
|
|
379
|
-
Path to YAML file.
|
|
485
|
+
Path to the YAML file containing entity configuration.
|
|
380
486
|
|
|
381
487
|
Returns
|
|
382
488
|
-------
|
|
383
489
|
ContextEntity
|
|
384
|
-
|
|
490
|
+
The loaded and updated context entity.
|
|
385
491
|
"""
|
|
386
492
|
dict_obj: dict = read_yaml(file)
|
|
387
493
|
context = get_context_from_project(dict_obj["project"])
|
|
@@ -397,17 +503,22 @@ class ContextEntityOperationsProcessor:
|
|
|
397
503
|
file: str,
|
|
398
504
|
) -> ExecutableEntity:
|
|
399
505
|
"""
|
|
400
|
-
Load
|
|
506
|
+
Load an executable entity from a YAML file and update it in the backend.
|
|
507
|
+
|
|
508
|
+
Reads executable entity configuration from a YAML file and updates
|
|
509
|
+
an existing executable entity in the backend. If the entity doesn't
|
|
510
|
+
exist, it creates a new one. Also handles task imports.
|
|
401
511
|
|
|
402
512
|
Parameters
|
|
403
513
|
----------
|
|
404
514
|
file : str
|
|
405
|
-
Path to YAML file.
|
|
515
|
+
Path to the YAML file containing executable entity configuration.
|
|
516
|
+
Can contain a single entity or a list with the executable and tasks.
|
|
406
517
|
|
|
407
518
|
Returns
|
|
408
519
|
-------
|
|
409
520
|
ExecutableEntity
|
|
410
|
-
|
|
521
|
+
The loaded and updated executable entity.
|
|
411
522
|
"""
|
|
412
523
|
dict_obj: dict | list[dict] = read_yaml(file)
|
|
413
524
|
if isinstance(dict_obj, list):
|
|
@@ -436,25 +547,28 @@ class ContextEntityOperationsProcessor:
|
|
|
436
547
|
**kwargs,
|
|
437
548
|
) -> list[dict]:
|
|
438
549
|
"""
|
|
439
|
-
|
|
550
|
+
Read all versions of a context entity from the backend.
|
|
551
|
+
|
|
552
|
+
Retrieves all available versions of a named entity from the
|
|
553
|
+
backend using the entity name identifier.
|
|
440
554
|
|
|
441
555
|
Parameters
|
|
442
556
|
----------
|
|
443
557
|
context : Context
|
|
444
|
-
|
|
558
|
+
The project context instance.
|
|
445
559
|
identifier : str
|
|
446
|
-
Entity key (store://...) or entity name.
|
|
447
|
-
entity_type : str
|
|
448
|
-
|
|
449
|
-
project : str
|
|
450
|
-
Project name.
|
|
560
|
+
Entity key (store://...) or entity name identifier.
|
|
561
|
+
entity_type : str, optional
|
|
562
|
+
The type of entity to read versions for.
|
|
563
|
+
project : str, optional
|
|
564
|
+
Project name (used for identifier parsing).
|
|
451
565
|
**kwargs : dict
|
|
452
|
-
|
|
566
|
+
Additional parameters to pass to the API call.
|
|
453
567
|
|
|
454
568
|
Returns
|
|
455
569
|
-------
|
|
456
570
|
list[dict]
|
|
457
|
-
|
|
571
|
+
List of entity data dictionaries for all versions.
|
|
458
572
|
"""
|
|
459
573
|
project, entity_type, _, entity_name, _ = parse_identifier(
|
|
460
574
|
identifier,
|
|
@@ -485,23 +599,27 @@ class ContextEntityOperationsProcessor:
|
|
|
485
599
|
**kwargs,
|
|
486
600
|
) -> list[ContextEntity]:
|
|
487
601
|
"""
|
|
488
|
-
Read
|
|
602
|
+
Read all versions of a context entity from the backend.
|
|
603
|
+
|
|
604
|
+
Retrieves all available versions of a named entity and constructs
|
|
605
|
+
context entity objects for each version. Applies post-processing
|
|
606
|
+
for metrics and file info.
|
|
489
607
|
|
|
490
608
|
Parameters
|
|
491
609
|
----------
|
|
492
610
|
identifier : str
|
|
493
|
-
Entity key (store://...) or entity name.
|
|
494
|
-
entity_type : str
|
|
495
|
-
|
|
496
|
-
project : str
|
|
497
|
-
Project name.
|
|
611
|
+
Entity key (store://...) or entity name identifier.
|
|
612
|
+
entity_type : str, optional
|
|
613
|
+
The type of entity to read versions for.
|
|
614
|
+
project : str, optional
|
|
615
|
+
Project name for context resolution.
|
|
498
616
|
**kwargs : dict
|
|
499
|
-
|
|
617
|
+
Additional parameters to pass to the API call.
|
|
500
618
|
|
|
501
619
|
Returns
|
|
502
620
|
-------
|
|
503
621
|
list[ContextEntity]
|
|
504
|
-
List of
|
|
622
|
+
List of context entity objects for all versions.
|
|
505
623
|
"""
|
|
506
624
|
context = get_context_from_identifier(identifier, project)
|
|
507
625
|
objs = self._read_context_entity_versions(
|
|
@@ -525,21 +643,25 @@ class ContextEntityOperationsProcessor:
|
|
|
525
643
|
**kwargs,
|
|
526
644
|
) -> list[dict]:
|
|
527
645
|
"""
|
|
528
|
-
List
|
|
646
|
+
List context entities from the backend.
|
|
647
|
+
|
|
648
|
+
Retrieves a list of entities of a specific type from the backend
|
|
649
|
+
within the project context.
|
|
529
650
|
|
|
530
651
|
Parameters
|
|
531
652
|
----------
|
|
532
653
|
context : Context
|
|
533
|
-
|
|
654
|
+
The project context instance.
|
|
534
655
|
entity_type : str
|
|
535
|
-
|
|
656
|
+
The type of entities to list.
|
|
536
657
|
**kwargs : dict
|
|
537
|
-
|
|
658
|
+
Additional parameters to pass to the API call for filtering
|
|
659
|
+
or pagination.
|
|
538
660
|
|
|
539
661
|
Returns
|
|
540
662
|
-------
|
|
541
663
|
list[dict]
|
|
542
|
-
List of
|
|
664
|
+
List of entity data dictionaries from the backend.
|
|
543
665
|
"""
|
|
544
666
|
api = context.client.build_api(
|
|
545
667
|
ApiCategories.CONTEXT.value,
|
|
@@ -556,21 +678,27 @@ class ContextEntityOperationsProcessor:
|
|
|
556
678
|
**kwargs,
|
|
557
679
|
) -> list[ContextEntity]:
|
|
558
680
|
"""
|
|
559
|
-
List all latest version
|
|
681
|
+
List all latest version context entities from the backend.
|
|
682
|
+
|
|
683
|
+
Retrieves a list of entities of a specific type from the backend
|
|
684
|
+
and constructs context entity objects. Only returns the latest
|
|
685
|
+
version of each entity. Applies post-processing for metrics and
|
|
686
|
+
file info.
|
|
560
687
|
|
|
561
688
|
Parameters
|
|
562
689
|
----------
|
|
563
690
|
project : str
|
|
564
|
-
|
|
691
|
+
The project name to list entities from.
|
|
565
692
|
entity_type : str
|
|
566
|
-
|
|
693
|
+
The type of entities to list.
|
|
567
694
|
**kwargs : dict
|
|
568
|
-
|
|
695
|
+
Additional parameters to pass to the API call for filtering
|
|
696
|
+
or pagination.
|
|
569
697
|
|
|
570
698
|
Returns
|
|
571
699
|
-------
|
|
572
700
|
list[ContextEntity]
|
|
573
|
-
List of
|
|
701
|
+
List of context entity objects (latest versions only).
|
|
574
702
|
"""
|
|
575
703
|
context = get_context_from_project(project)
|
|
576
704
|
objs = self._list_context_entities(context, entity_type, **kwargs)
|
|
@@ -586,17 +714,20 @@ class ContextEntityOperationsProcessor:
|
|
|
586
714
|
new_obj: MaterialEntity,
|
|
587
715
|
) -> dict:
|
|
588
716
|
"""
|
|
589
|
-
Update material
|
|
717
|
+
Update a material entity using a shortcut method.
|
|
718
|
+
|
|
719
|
+
Convenience method for updating material entities during
|
|
720
|
+
file upload operations.
|
|
590
721
|
|
|
591
722
|
Parameters
|
|
592
723
|
----------
|
|
593
724
|
new_obj : MaterialEntity
|
|
594
|
-
|
|
725
|
+
The material entity object to update.
|
|
595
726
|
|
|
596
727
|
Returns
|
|
597
728
|
-------
|
|
598
729
|
dict
|
|
599
|
-
Response from backend.
|
|
730
|
+
Response data from the backend update operation.
|
|
600
731
|
"""
|
|
601
732
|
return self.update_context_entity(
|
|
602
733
|
new_obj.project,
|
|
@@ -614,25 +745,29 @@ class ContextEntityOperationsProcessor:
|
|
|
614
745
|
**kwargs,
|
|
615
746
|
) -> dict:
|
|
616
747
|
"""
|
|
617
|
-
Update
|
|
748
|
+
Update a context entity in the backend.
|
|
749
|
+
|
|
750
|
+
Updates an existing context entity with new data. Entity
|
|
751
|
+
specifications are typically immutable, so this primarily
|
|
752
|
+
updates status and metadata.
|
|
618
753
|
|
|
619
754
|
Parameters
|
|
620
755
|
----------
|
|
621
756
|
context : Context
|
|
622
|
-
|
|
757
|
+
The project context instance.
|
|
623
758
|
entity_type : str
|
|
624
|
-
|
|
759
|
+
The type of entity to update.
|
|
625
760
|
entity_id : str
|
|
626
|
-
|
|
761
|
+
The unique identifier of the entity to update.
|
|
627
762
|
entity_dict : dict
|
|
628
|
-
|
|
763
|
+
The updated entity data dictionary.
|
|
629
764
|
**kwargs : dict
|
|
630
|
-
|
|
765
|
+
Additional parameters to pass to the API call.
|
|
631
766
|
|
|
632
767
|
Returns
|
|
633
768
|
-------
|
|
634
769
|
dict
|
|
635
|
-
Response from backend.
|
|
770
|
+
Response data from the backend update operation.
|
|
636
771
|
"""
|
|
637
772
|
api = context.client.build_api(
|
|
638
773
|
ApiCategories.CONTEXT.value,
|
|
@@ -652,25 +787,29 @@ class ContextEntityOperationsProcessor:
|
|
|
652
787
|
**kwargs,
|
|
653
788
|
) -> ContextEntity:
|
|
654
789
|
"""
|
|
655
|
-
Update
|
|
790
|
+
Update a context entity in the backend.
|
|
791
|
+
|
|
792
|
+
Updates an existing context entity with new data and returns
|
|
793
|
+
the updated context entity object. Entity specifications are
|
|
794
|
+
typically immutable.
|
|
656
795
|
|
|
657
796
|
Parameters
|
|
658
797
|
----------
|
|
659
798
|
project : str
|
|
660
|
-
|
|
799
|
+
The project name containing the entity.
|
|
661
800
|
entity_type : str
|
|
662
|
-
|
|
801
|
+
The type of entity to update.
|
|
663
802
|
entity_id : str
|
|
664
|
-
|
|
803
|
+
The unique identifier of the entity to update.
|
|
665
804
|
entity_dict : dict
|
|
666
|
-
|
|
805
|
+
The updated entity data dictionary.
|
|
667
806
|
**kwargs : dict
|
|
668
|
-
|
|
807
|
+
Additional parameters to pass to the API call.
|
|
669
808
|
|
|
670
809
|
Returns
|
|
671
810
|
-------
|
|
672
811
|
ContextEntity
|
|
673
|
-
|
|
812
|
+
The updated context entity object.
|
|
674
813
|
"""
|
|
675
814
|
context = get_context_from_project(project)
|
|
676
815
|
obj = self._update_context_entity(
|
|
@@ -692,27 +831,33 @@ class ContextEntityOperationsProcessor:
|
|
|
692
831
|
**kwargs,
|
|
693
832
|
) -> dict:
|
|
694
833
|
"""
|
|
695
|
-
Delete
|
|
834
|
+
Delete a context entity from the backend.
|
|
835
|
+
|
|
836
|
+
Removes an entity from the backend, with options for deleting
|
|
837
|
+
specific versions or all versions of a named entity. Handles
|
|
838
|
+
cascade deletion if supported.
|
|
696
839
|
|
|
697
840
|
Parameters
|
|
698
841
|
----------
|
|
699
842
|
context : Context
|
|
700
|
-
|
|
843
|
+
The project context instance.
|
|
701
844
|
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
|
-
|
|
845
|
+
Entity key (store://...) or entity name identifier.
|
|
846
|
+
entity_type : str, optional
|
|
847
|
+
The type of entity to delete.
|
|
848
|
+
project : str, optional
|
|
849
|
+
Project name (used for identifier parsing).
|
|
850
|
+
entity_id : str, optional
|
|
851
|
+
Specific entity ID to delete.
|
|
709
852
|
**kwargs : dict
|
|
710
|
-
|
|
853
|
+
Additional parameters including:
|
|
854
|
+
- 'delete_all_versions': delete all versions of named entity
|
|
855
|
+
- 'cascade': cascade deletion options
|
|
711
856
|
|
|
712
857
|
Returns
|
|
713
858
|
-------
|
|
714
859
|
dict
|
|
715
|
-
Response from backend.
|
|
860
|
+
Response data from the backend delete operation.
|
|
716
861
|
"""
|
|
717
862
|
project, entity_type, _, entity_name, entity_id = parse_identifier(
|
|
718
863
|
identifier,
|
|
@@ -758,25 +903,28 @@ class ContextEntityOperationsProcessor:
|
|
|
758
903
|
**kwargs,
|
|
759
904
|
) -> dict:
|
|
760
905
|
"""
|
|
761
|
-
Delete
|
|
906
|
+
Delete a context entity from the backend.
|
|
907
|
+
|
|
908
|
+
Removes an entity from the backend with support for deleting
|
|
909
|
+
specific versions or all versions of a named entity.
|
|
762
910
|
|
|
763
911
|
Parameters
|
|
764
912
|
----------
|
|
765
913
|
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
|
-
|
|
914
|
+
Entity key (store://...) or entity name identifier.
|
|
915
|
+
project : str, optional
|
|
916
|
+
Project name for context resolution.
|
|
917
|
+
entity_type : str, optional
|
|
918
|
+
The type of entity to delete.
|
|
919
|
+
entity_id : str, optional
|
|
920
|
+
Specific entity ID to delete.
|
|
773
921
|
**kwargs : dict
|
|
774
|
-
|
|
922
|
+
Additional parameters including deletion options.
|
|
775
923
|
|
|
776
924
|
Returns
|
|
777
925
|
-------
|
|
778
926
|
dict
|
|
779
|
-
Response from backend.
|
|
927
|
+
Response data from the backend delete operation.
|
|
780
928
|
"""
|
|
781
929
|
context = get_context_from_identifier(identifier, project)
|
|
782
930
|
return self._delete_context_entity(
|
|
@@ -790,17 +938,20 @@ class ContextEntityOperationsProcessor:
|
|
|
790
938
|
|
|
791
939
|
def _post_process_get(self, entity: ContextEntity) -> ContextEntity:
|
|
792
940
|
"""
|
|
793
|
-
Post
|
|
941
|
+
Post-process a retrieved context entity.
|
|
942
|
+
|
|
943
|
+
Applies additional processing to entities after retrieval,
|
|
944
|
+
including loading metrics and file information if available.
|
|
794
945
|
|
|
795
946
|
Parameters
|
|
796
947
|
----------
|
|
797
948
|
entity : ContextEntity
|
|
798
|
-
|
|
949
|
+
The entity to post-process.
|
|
799
950
|
|
|
800
951
|
Returns
|
|
801
952
|
-------
|
|
802
953
|
ContextEntity
|
|
803
|
-
|
|
954
|
+
The post-processed entity with additional data loaded.
|
|
804
955
|
"""
|
|
805
956
|
if hasattr(entity.status, "metrics"):
|
|
806
957
|
entity._get_metrics()
|
|
@@ -821,25 +972,28 @@ class ContextEntityOperationsProcessor:
|
|
|
821
972
|
entity_id: str | None = None,
|
|
822
973
|
) -> str:
|
|
823
974
|
"""
|
|
824
|
-
Build
|
|
975
|
+
Build a storage key for a context entity.
|
|
976
|
+
|
|
977
|
+
Creates a standardized key string for context entity identification
|
|
978
|
+
and storage within a project context.
|
|
825
979
|
|
|
826
980
|
Parameters
|
|
827
981
|
----------
|
|
828
982
|
context : Context
|
|
829
|
-
|
|
983
|
+
The project context instance.
|
|
830
984
|
entity_type : str
|
|
831
|
-
|
|
985
|
+
The type of entity.
|
|
832
986
|
entity_kind : str
|
|
833
|
-
|
|
987
|
+
The kind/subtype of entity.
|
|
834
988
|
entity_name : str
|
|
835
|
-
|
|
836
|
-
entity_id : str
|
|
837
|
-
|
|
989
|
+
The name of the entity.
|
|
990
|
+
entity_id : str, optional
|
|
991
|
+
The unique identifier of the entity version.
|
|
838
992
|
|
|
839
993
|
Returns
|
|
840
994
|
-------
|
|
841
995
|
str
|
|
842
|
-
|
|
996
|
+
The constructed context entity key string.
|
|
843
997
|
"""
|
|
844
998
|
return context.client.build_key(
|
|
845
999
|
ApiCategories.CONTEXT.value,
|
|
@@ -859,25 +1013,28 @@ class ContextEntityOperationsProcessor:
|
|
|
859
1013
|
entity_id: str | None = None,
|
|
860
1014
|
) -> str:
|
|
861
1015
|
"""
|
|
862
|
-
Build
|
|
1016
|
+
Build a storage key for a context entity.
|
|
1017
|
+
|
|
1018
|
+
Creates a standardized key string for context entity identification
|
|
1019
|
+
and storage, resolving the project context automatically.
|
|
863
1020
|
|
|
864
1021
|
Parameters
|
|
865
1022
|
----------
|
|
866
1023
|
project : str
|
|
867
|
-
|
|
1024
|
+
The project name containing the entity.
|
|
868
1025
|
entity_type : str
|
|
869
|
-
|
|
1026
|
+
The type of entity.
|
|
870
1027
|
entity_kind : str
|
|
871
|
-
|
|
1028
|
+
The kind/subtype of entity.
|
|
872
1029
|
entity_name : str
|
|
873
|
-
|
|
874
|
-
entity_id : str
|
|
875
|
-
|
|
1030
|
+
The name of the entity.
|
|
1031
|
+
entity_id : str, optional
|
|
1032
|
+
The unique identifier of the entity version.
|
|
876
1033
|
|
|
877
1034
|
Returns
|
|
878
1035
|
-------
|
|
879
1036
|
str
|
|
880
|
-
|
|
1037
|
+
The constructed context entity key string.
|
|
881
1038
|
"""
|
|
882
1039
|
context = get_context_from_project(project)
|
|
883
1040
|
return self._build_context_entity_key(context, entity_type, entity_kind, entity_name, entity_id)
|
|
@@ -889,21 +1046,24 @@ class ContextEntityOperationsProcessor:
|
|
|
889
1046
|
**kwargs,
|
|
890
1047
|
) -> dict:
|
|
891
1048
|
"""
|
|
892
|
-
|
|
1049
|
+
Read secret data from the backend.
|
|
1050
|
+
|
|
1051
|
+
Retrieves secret data stored in the backend for a specific
|
|
1052
|
+
project and entity type.
|
|
893
1053
|
|
|
894
1054
|
Parameters
|
|
895
1055
|
----------
|
|
896
1056
|
project : str
|
|
897
|
-
|
|
1057
|
+
The project name containing the secrets.
|
|
898
1058
|
entity_type : str
|
|
899
|
-
|
|
1059
|
+
The type of entity (typically 'secret').
|
|
900
1060
|
**kwargs : dict
|
|
901
|
-
|
|
1061
|
+
Additional parameters to pass to the API call.
|
|
902
1062
|
|
|
903
1063
|
Returns
|
|
904
1064
|
-------
|
|
905
1065
|
dict
|
|
906
|
-
|
|
1066
|
+
Secret data retrieved from the backend.
|
|
907
1067
|
"""
|
|
908
1068
|
context = get_context_from_project(project)
|
|
909
1069
|
api = context.client.build_api(
|
|
@@ -922,18 +1082,21 @@ class ContextEntityOperationsProcessor:
|
|
|
922
1082
|
**kwargs,
|
|
923
1083
|
) -> None:
|
|
924
1084
|
"""
|
|
925
|
-
|
|
1085
|
+
Update secret data in the backend.
|
|
1086
|
+
|
|
1087
|
+
Stores or updates secret data in the backend for a specific
|
|
1088
|
+
project and entity type.
|
|
926
1089
|
|
|
927
1090
|
Parameters
|
|
928
1091
|
----------
|
|
929
1092
|
project : str
|
|
930
|
-
|
|
1093
|
+
The project name to store secrets in.
|
|
931
1094
|
entity_type : str
|
|
932
|
-
|
|
1095
|
+
The type of entity (typically 'secret').
|
|
933
1096
|
data : dict
|
|
934
|
-
|
|
1097
|
+
The secret data dictionary to store.
|
|
935
1098
|
**kwargs : dict
|
|
936
|
-
|
|
1099
|
+
Additional parameters to pass to the API call.
|
|
937
1100
|
|
|
938
1101
|
Returns
|
|
939
1102
|
-------
|
|
@@ -956,23 +1119,26 @@ class ContextEntityOperationsProcessor:
|
|
|
956
1119
|
**kwargs,
|
|
957
1120
|
) -> dict:
|
|
958
1121
|
"""
|
|
959
|
-
|
|
1122
|
+
Read execution logs from the backend.
|
|
1123
|
+
|
|
1124
|
+
Retrieves logs for a specific run or task execution from
|
|
1125
|
+
the backend.
|
|
960
1126
|
|
|
961
1127
|
Parameters
|
|
962
1128
|
----------
|
|
963
1129
|
project : str
|
|
964
|
-
|
|
1130
|
+
The project name containing the entity.
|
|
965
1131
|
entity_type : str
|
|
966
|
-
|
|
1132
|
+
The type of entity (typically 'run' or 'task').
|
|
967
1133
|
entity_id : str
|
|
968
|
-
|
|
1134
|
+
The unique identifier of the entity to get logs for.
|
|
969
1135
|
**kwargs : dict
|
|
970
|
-
|
|
1136
|
+
Additional parameters to pass to the API call.
|
|
971
1137
|
|
|
972
1138
|
Returns
|
|
973
1139
|
-------
|
|
974
1140
|
dict
|
|
975
|
-
|
|
1141
|
+
Log data retrieved from the backend.
|
|
976
1142
|
"""
|
|
977
1143
|
context = get_context_from_project(project)
|
|
978
1144
|
api = context.client.build_api(
|
|
@@ -992,18 +1158,21 @@ class ContextEntityOperationsProcessor:
|
|
|
992
1158
|
**kwargs,
|
|
993
1159
|
) -> None:
|
|
994
1160
|
"""
|
|
995
|
-
Stop
|
|
1161
|
+
Stop a running entity in the backend.
|
|
1162
|
+
|
|
1163
|
+
Sends a stop signal to halt execution of a running entity
|
|
1164
|
+
such as a workflow or long-running task.
|
|
996
1165
|
|
|
997
1166
|
Parameters
|
|
998
1167
|
----------
|
|
999
1168
|
project : str
|
|
1000
|
-
|
|
1169
|
+
The project name containing the entity.
|
|
1001
1170
|
entity_type : str
|
|
1002
|
-
|
|
1171
|
+
The type of entity to stop.
|
|
1003
1172
|
entity_id : str
|
|
1004
|
-
|
|
1173
|
+
The unique identifier of the entity to stop.
|
|
1005
1174
|
**kwargs : dict
|
|
1006
|
-
|
|
1175
|
+
Additional parameters to pass to the API call.
|
|
1007
1176
|
|
|
1008
1177
|
Returns
|
|
1009
1178
|
-------
|
|
@@ -1027,18 +1196,21 @@ class ContextEntityOperationsProcessor:
|
|
|
1027
1196
|
**kwargs,
|
|
1028
1197
|
) -> None:
|
|
1029
1198
|
"""
|
|
1030
|
-
Resume
|
|
1199
|
+
Resume a stopped entity in the backend.
|
|
1200
|
+
|
|
1201
|
+
Sends a resume signal to restart execution of a previously
|
|
1202
|
+
stopped entity such as a workflow or task.
|
|
1031
1203
|
|
|
1032
1204
|
Parameters
|
|
1033
1205
|
----------
|
|
1034
1206
|
project : str
|
|
1035
|
-
|
|
1207
|
+
The project name containing the entity.
|
|
1036
1208
|
entity_type : str
|
|
1037
|
-
|
|
1209
|
+
The type of entity to resume.
|
|
1038
1210
|
entity_id : str
|
|
1039
|
-
|
|
1211
|
+
The unique identifier of the entity to resume.
|
|
1040
1212
|
**kwargs : dict
|
|
1041
|
-
|
|
1213
|
+
Additional parameters to pass to the API call.
|
|
1042
1214
|
|
|
1043
1215
|
Returns
|
|
1044
1216
|
-------
|
|
@@ -1062,23 +1234,26 @@ class ContextEntityOperationsProcessor:
|
|
|
1062
1234
|
**kwargs,
|
|
1063
1235
|
) -> list[dict]:
|
|
1064
1236
|
"""
|
|
1065
|
-
|
|
1237
|
+
Read file information from the backend.
|
|
1238
|
+
|
|
1239
|
+
Retrieves metadata about files associated with an entity,
|
|
1240
|
+
including file paths, sizes, and other attributes.
|
|
1066
1241
|
|
|
1067
1242
|
Parameters
|
|
1068
1243
|
----------
|
|
1069
1244
|
project : str
|
|
1070
|
-
|
|
1245
|
+
The project name containing the entity.
|
|
1071
1246
|
entity_type : str
|
|
1072
|
-
|
|
1247
|
+
The type of entity to get file info for.
|
|
1073
1248
|
entity_id : str
|
|
1074
|
-
|
|
1249
|
+
The unique identifier of the entity.
|
|
1075
1250
|
**kwargs : dict
|
|
1076
|
-
|
|
1251
|
+
Additional parameters to pass to the API call.
|
|
1077
1252
|
|
|
1078
1253
|
Returns
|
|
1079
1254
|
-------
|
|
1080
1255
|
list[dict]
|
|
1081
|
-
|
|
1256
|
+
List of file information dictionaries from the backend.
|
|
1082
1257
|
"""
|
|
1083
1258
|
context = get_context_from_project(project)
|
|
1084
1259
|
api = context.client.build_api(
|
|
@@ -1137,23 +1312,30 @@ class ContextEntityOperationsProcessor:
|
|
|
1137
1312
|
**kwargs,
|
|
1138
1313
|
) -> dict:
|
|
1139
1314
|
"""
|
|
1140
|
-
|
|
1315
|
+
Read metrics from the backend for a specific entity.
|
|
1316
|
+
|
|
1317
|
+
Retrieves metrics data associated with an entity. Can fetch either
|
|
1318
|
+
all metrics or a specific metric by name. Used for performance
|
|
1319
|
+
monitoring and analysis of entity operations.
|
|
1141
1320
|
|
|
1142
1321
|
Parameters
|
|
1143
1322
|
----------
|
|
1144
1323
|
project : str
|
|
1145
|
-
|
|
1324
|
+
The project name containing the entity.
|
|
1146
1325
|
entity_type : str
|
|
1147
|
-
|
|
1326
|
+
The type of entity to read metrics from.
|
|
1148
1327
|
entity_id : str
|
|
1149
|
-
|
|
1328
|
+
The unique identifier of the entity.
|
|
1329
|
+
metric_name : str, optional
|
|
1330
|
+
The name of a specific metric to retrieve.
|
|
1331
|
+
If None, retrieves all available metrics.
|
|
1150
1332
|
**kwargs : dict
|
|
1151
|
-
|
|
1333
|
+
Additional parameters to pass to the API call.
|
|
1152
1334
|
|
|
1153
1335
|
Returns
|
|
1154
1336
|
-------
|
|
1155
1337
|
dict
|
|
1156
|
-
|
|
1338
|
+
Dictionary containing metric data from the backend.
|
|
1157
1339
|
"""
|
|
1158
1340
|
context = get_context_from_project(project)
|
|
1159
1341
|
api = context.client.build_api(
|
|
@@ -1176,18 +1358,27 @@ class ContextEntityOperationsProcessor:
|
|
|
1176
1358
|
**kwargs,
|
|
1177
1359
|
) -> None:
|
|
1178
1360
|
"""
|
|
1179
|
-
|
|
1361
|
+
Update or create a metric value for an entity in the backend.
|
|
1362
|
+
|
|
1363
|
+
Updates an existing metric or creates a new one with the specified
|
|
1364
|
+
value. Metrics are used for tracking performance, status, and
|
|
1365
|
+
other quantitative aspects of entity operations.
|
|
1180
1366
|
|
|
1181
1367
|
Parameters
|
|
1182
1368
|
----------
|
|
1183
1369
|
project : str
|
|
1184
|
-
|
|
1370
|
+
The project name containing the entity.
|
|
1185
1371
|
entity_type : str
|
|
1186
|
-
|
|
1372
|
+
The type of entity to update metrics for.
|
|
1187
1373
|
entity_id : str
|
|
1188
|
-
|
|
1374
|
+
The unique identifier of the entity.
|
|
1375
|
+
metric_name : str
|
|
1376
|
+
The name of the metric to update or create.
|
|
1377
|
+
metric_value : Any
|
|
1378
|
+
The value to set for the metric.
|
|
1379
|
+
Can be numeric, string, or other supported types.
|
|
1189
1380
|
**kwargs : dict
|
|
1190
|
-
|
|
1381
|
+
Additional parameters to pass to the API call.
|
|
1191
1382
|
|
|
1192
1383
|
Returns
|
|
1193
1384
|
-------
|
|
@@ -1210,19 +1401,23 @@ class ContextEntityOperationsProcessor:
|
|
|
1210
1401
|
**kwargs,
|
|
1211
1402
|
) -> dict:
|
|
1212
1403
|
"""
|
|
1213
|
-
|
|
1404
|
+
Execute search query against the backend API.
|
|
1405
|
+
|
|
1406
|
+
Internal method that performs the actual search operation
|
|
1407
|
+
by building API parameters, executing the search request,
|
|
1408
|
+
and processing the results into entity objects.
|
|
1214
1409
|
|
|
1215
1410
|
Parameters
|
|
1216
1411
|
----------
|
|
1217
1412
|
context : Context
|
|
1218
|
-
|
|
1413
|
+
The context instance containing client and project information.
|
|
1219
1414
|
**kwargs : dict
|
|
1220
|
-
|
|
1415
|
+
Search parameters and filters to pass to the API call.
|
|
1221
1416
|
|
|
1222
1417
|
Returns
|
|
1223
1418
|
-------
|
|
1224
1419
|
dict
|
|
1225
|
-
|
|
1420
|
+
List of context entity objects matching the search criteria.
|
|
1226
1421
|
"""
|
|
1227
1422
|
kwargs = context.client.build_parameters(
|
|
1228
1423
|
ApiCategories.CONTEXT.value,
|
|
@@ -1251,35 +1446,40 @@ class ContextEntityOperationsProcessor:
|
|
|
1251
1446
|
**kwargs,
|
|
1252
1447
|
) -> list[ContextEntity]:
|
|
1253
1448
|
"""
|
|
1254
|
-
Search
|
|
1449
|
+
Search for entities in the backend using various criteria.
|
|
1450
|
+
|
|
1451
|
+
Performs a flexible search across multiple entity attributes,
|
|
1452
|
+
allowing for complex queries and filtering. Returns matching
|
|
1453
|
+
entities from the project context.
|
|
1255
1454
|
|
|
1256
1455
|
Parameters
|
|
1257
1456
|
----------
|
|
1258
1457
|
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
|
-
|
|
1458
|
+
The project name to search within.
|
|
1459
|
+
query : str, optional
|
|
1460
|
+
Free-text search query to match against entity content.
|
|
1461
|
+
entity_types : list[str], optional
|
|
1462
|
+
List of entity types to filter by.
|
|
1463
|
+
If None, searches all entity types.
|
|
1464
|
+
name : str, optional
|
|
1465
|
+
Entity name pattern to match.
|
|
1466
|
+
kind : str, optional
|
|
1467
|
+
Entity kind to filter by.
|
|
1468
|
+
created : str, optional
|
|
1469
|
+
Creation date filter (ISO format).
|
|
1470
|
+
updated : str, optional
|
|
1471
|
+
Last update date filter (ISO format).
|
|
1472
|
+
description : str, optional
|
|
1473
|
+
Description pattern to match.
|
|
1474
|
+
labels : list[str], optional
|
|
1475
|
+
List of label patterns to match.
|
|
1276
1476
|
**kwargs : dict
|
|
1277
|
-
|
|
1477
|
+
Additional search parameters to pass to the API call.
|
|
1278
1478
|
|
|
1279
1479
|
Returns
|
|
1280
1480
|
-------
|
|
1281
1481
|
list[ContextEntity]
|
|
1282
|
-
List of
|
|
1482
|
+
List of matching entity instances from the search.
|
|
1283
1483
|
"""
|
|
1284
1484
|
context = get_context_from_project(project)
|
|
1285
1485
|
return self._search(
|