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.

Files changed (67) hide show
  1. digitalhub/__init__.py +3 -8
  2. digitalhub/entities/_base/_base/entity.py +0 -11
  3. digitalhub/entities/_base/entity/builder.py +5 -5
  4. digitalhub/entities/_base/executable/entity.py +1 -1
  5. digitalhub/entities/_base/runtime_entity/builder.py +53 -18
  6. digitalhub/entities/_commons/metrics.py +64 -30
  7. digitalhub/entities/_commons/utils.py +100 -30
  8. digitalhub/entities/_processors/base.py +160 -81
  9. digitalhub/entities/_processors/context.py +424 -224
  10. digitalhub/entities/_processors/utils.py +77 -33
  11. digitalhub/entities/artifact/crud.py +20 -4
  12. digitalhub/entities/artifact/utils.py +29 -14
  13. digitalhub/entities/dataitem/crud.py +20 -4
  14. digitalhub/entities/dataitem/table/entity.py +0 -21
  15. digitalhub/entities/dataitem/utils.py +84 -34
  16. digitalhub/entities/function/_base/entity.py +1 -1
  17. digitalhub/entities/function/crud.py +15 -4
  18. digitalhub/entities/model/_base/entity.py +21 -1
  19. digitalhub/entities/model/crud.py +21 -5
  20. digitalhub/entities/model/utils.py +29 -14
  21. digitalhub/entities/project/_base/entity.py +65 -33
  22. digitalhub/entities/project/crud.py +8 -1
  23. digitalhub/entities/run/_base/entity.py +21 -1
  24. digitalhub/entities/run/crud.py +22 -5
  25. digitalhub/entities/secret/crud.py +22 -5
  26. digitalhub/entities/task/crud.py +22 -5
  27. digitalhub/entities/trigger/crud.py +20 -4
  28. digitalhub/entities/workflow/_base/entity.py +1 -1
  29. digitalhub/entities/workflow/crud.py +15 -4
  30. digitalhub/factory/enums.py +18 -0
  31. digitalhub/factory/factory.py +136 -57
  32. digitalhub/factory/utils.py +3 -54
  33. digitalhub/stores/client/api.py +6 -10
  34. digitalhub/stores/client/builder.py +3 -3
  35. digitalhub/stores/client/dhcore/client.py +104 -162
  36. digitalhub/stores/client/dhcore/configurator.py +92 -289
  37. digitalhub/stores/client/dhcore/enums.py +0 -16
  38. digitalhub/stores/client/dhcore/params_builder.py +41 -83
  39. digitalhub/stores/client/dhcore/utils.py +14 -22
  40. digitalhub/stores/client/local/client.py +77 -45
  41. digitalhub/stores/credentials/enums.py +1 -0
  42. digitalhub/stores/credentials/ini_module.py +0 -16
  43. digitalhub/stores/data/api.py +1 -1
  44. digitalhub/stores/data/builder.py +66 -4
  45. digitalhub/stores/data/local/store.py +0 -103
  46. digitalhub/stores/data/s3/configurator.py +60 -6
  47. digitalhub/stores/data/s3/store.py +44 -2
  48. digitalhub/stores/data/sql/configurator.py +57 -7
  49. digitalhub/stores/data/sql/store.py +184 -78
  50. digitalhub/utils/file_utils.py +0 -17
  51. digitalhub/utils/generic_utils.py +1 -2
  52. digitalhub/utils/store_utils.py +44 -0
  53. {digitalhub-0.13.0b3.dist-info → digitalhub-0.14.0b0.dist-info}/METADATA +3 -2
  54. {digitalhub-0.13.0b3.dist-info → digitalhub-0.14.0b0.dist-info}/RECORD +63 -65
  55. digitalhub/entities/_commons/types.py +0 -9
  56. digitalhub/entities/task/_base/utils.py +0 -22
  57. digitalhub/stores/client/dhcore/models.py +0 -40
  58. digitalhub/stores/data/s3/utils.py +0 -78
  59. /digitalhub/entities/{_base/entity/_constructors → _constructors}/__init__.py +0 -0
  60. /digitalhub/entities/{_base/entity/_constructors → _constructors}/metadata.py +0 -0
  61. /digitalhub/entities/{_base/entity/_constructors → _constructors}/name.py +0 -0
  62. /digitalhub/entities/{_base/entity/_constructors → _constructors}/spec.py +0 -0
  63. /digitalhub/entities/{_base/entity/_constructors → _constructors}/status.py +0 -0
  64. /digitalhub/entities/{_base/entity/_constructors → _constructors}/uuid.py +0 -0
  65. {digitalhub-0.13.0b3.dist-info → digitalhub-0.14.0b0.dist-info}/WHEEL +0 -0
  66. {digitalhub-0.13.0b3.dist-info → digitalhub-0.14.0b0.dist-info}/licenses/AUTHORS +0 -0
  67. {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 Entity operations.
33
+ Processor for context entity operations.
32
34
 
33
- This object interacts with the context, check the category of the object,
34
- and then calls the appropriate method to perform the requested operation.
35
- Operations can be CRUD, search, list, etc.
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 object in backend.
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
- Context instance.
55
- project : str
56
- Project name.
61
+ The project context instance.
57
62
  entity_type : str
58
- Entity type.
63
+ The type of entity to create (e.g., 'artifact', 'function').
59
64
  entity_dict : dict
60
- Object instance.
65
+ The entity data dictionary to create.
61
66
 
62
67
  Returns
63
68
  -------
64
69
  dict
65
- Object instance.
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 object in backend.
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 to pass to entity builder.
98
+ Parameters for entity creation, including 'project' and
99
+ entity-specific parameters.
87
100
 
88
101
  Returns
89
102
  -------
90
103
  ContextEntity
91
- Object instance.
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 object in backend and upload file.
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 to pass to entity builder.
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
- Object instance.
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 object from backend.
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
- Context instance.
197
+ The project context instance.
169
198
  identifier : str
170
- Entity key (store://...) or entity name.
171
- entity_type : str
172
- Entity type.
173
- project : str
174
- Project name.
175
- entity_id : str
176
- Entity ID.
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
- Parameters to pass to the API call.
207
+ Additional parameters to pass to the API call.
179
208
 
180
209
  Returns
181
210
  -------
182
211
  dict
183
- Object instance.
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 object from backend.
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
- Entity type.
235
- project : str
236
- Project name.
237
- entity_id : str
238
- Entity ID.
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
- Parameters to pass to the API call.
272
+ Additional parameters to pass to the API call.
241
273
 
242
274
  Returns
243
275
  -------
244
- VersionedEntity
245
- Object instance.
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 object from backend.
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 name.
274
- entity_type : str
275
- Entity type.
276
- project : str
277
- Project name.
278
- entity_id : str
279
- Entity ID.
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
- Parameters to pass to the API call.
317
+ Additional parameters to pass to the API call.
282
318
 
283
319
  Returns
284
320
  -------
285
321
  UnversionedEntity
286
- Object instance.
322
+ The unversioned entity object populated with backend data.
287
323
  """
288
- if not identifier.startswith("store://"):
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 object from a YAML file and create a new object into the backend.
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
- Object instance.
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
- dict_obj: dict = read_yaml(file)
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
- context = get_context_from_project(dict_obj["project"])
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(context, obj.ENTITY_TYPE, obj.to_dict())
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 obj
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 object from a YAML file and create a new object into the backend.
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
- Object instance.
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
- dict_obj: dict | list[dict] = read_yaml(file)
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 = get_context_from_project(exec_dict["project"])
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(context, obj.ENTITY_TYPE, obj.to_dict())
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
- obj.import_tasks(tsk_dicts)
467
+ new_obj.import_tasks(tsk_dicts)
366
468
 
367
- return obj
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 object from a YAML file and update an existing object into the backend.
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
- Object instance.
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 object from a YAML file and update an existing object into the backend.
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
- Object instance.
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
- Get all versions object from backend.
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
- Context instance.
558
+ The project context instance.
445
559
  identifier : str
446
- Entity key (store://...) or entity name.
447
- entity_type : str
448
- Entity type.
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
- Parameters to pass to the API call.
566
+ Additional parameters to pass to the API call.
453
567
 
454
568
  Returns
455
569
  -------
456
570
  list[dict]
457
- Object instances.
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 object versions from backend.
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
- Entity type.
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
- Parameters to pass to the API call.
617
+ Additional parameters to pass to the API call.
500
618
 
501
619
  Returns
502
620
  -------
503
621
  list[ContextEntity]
504
- List of object instances.
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 objects from backend.
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
- Context instance.
654
+ The project context instance.
534
655
  entity_type : str
535
- Entity type.
656
+ The type of entities to list.
536
657
  **kwargs : dict
537
- Parameters to pass to the API call.
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 objects.
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 objects from backend.
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
- Project name.
691
+ The project name to list entities from.
565
692
  entity_type : str
566
- Entity type.
693
+ The type of entities to list.
567
694
  **kwargs : dict
568
- Parameters to pass to the API call.
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 object instances.
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 object shortcut.
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
- Object instance.
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 object. Note that object spec are immutable.
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
- Context instance.
757
+ The project context instance.
623
758
  entity_type : str
624
- Entity type.
759
+ The type of entity to update.
625
760
  entity_id : str
626
- Entity ID.
761
+ The unique identifier of the entity to update.
627
762
  entity_dict : dict
628
- Entity dictionary.
763
+ The updated entity data dictionary.
629
764
  **kwargs : dict
630
- Parameters to pass to the API call.
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 object. Note that object spec are immutable.
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
- Project name.
799
+ The project name containing the entity.
661
800
  entity_type : str
662
- Entity type.
801
+ The type of entity to update.
663
802
  entity_id : str
664
- Entity ID.
803
+ The unique identifier of the entity to update.
665
804
  entity_dict : dict
666
- Entity dictionary.
805
+ The updated entity data dictionary.
667
806
  **kwargs : dict
668
- Parameters to pass to the API call.
807
+ Additional parameters to pass to the API call.
669
808
 
670
809
  Returns
671
810
  -------
672
811
  ContextEntity
673
- Object instance.
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 object from backend.
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
- Context instance.
843
+ The project context instance.
701
844
  identifier : str
702
- Entity key (store://...) or entity name.
703
- entity_type : str
704
- Entity type.
705
- project : str
706
- Project name.
707
- entity_id : str
708
- Entity ID.
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
- Parameters to pass to the API call.
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 object from backend.
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
- Entity type.
771
- entity_id : str
772
- Entity ID.
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
- Parameters to pass to the API call.
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 process get (files, metrics).
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
- Entity to post process.
949
+ The entity to post-process.
799
950
 
800
951
  Returns
801
952
  -------
802
953
  ContextEntity
803
- Post processed entity.
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 object key.
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
- Context instance.
983
+ The project context instance.
830
984
  entity_type : str
831
- Entity type.
985
+ The type of entity.
832
986
  entity_kind : str
833
- Entity kind.
987
+ The kind/subtype of entity.
834
988
  entity_name : str
835
- Entity name.
836
- entity_id : str
837
- Entity ID.
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
- Object key.
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 object key.
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
- Project name.
1024
+ The project name containing the entity.
868
1025
  entity_type : str
869
- Entity type.
1026
+ The type of entity.
870
1027
  entity_kind : str
871
- Entity kind.
1028
+ The kind/subtype of entity.
872
1029
  entity_name : str
873
- Entity name.
874
- entity_id : str
875
- Entity ID.
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
- Object key.
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
- Get data from backend.
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
- Project name.
1057
+ The project name containing the secrets.
898
1058
  entity_type : str
899
- Entity type.
1059
+ The type of entity (typically 'secret').
900
1060
  **kwargs : dict
901
- Parameters to pass to the API call.
1061
+ Additional parameters to pass to the API call.
902
1062
 
903
1063
  Returns
904
1064
  -------
905
1065
  dict
906
- Response from backend.
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
- Set data in backend.
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
- Project name.
1093
+ The project name to store secrets in.
931
1094
  entity_type : str
932
- Entity type.
1095
+ The type of entity (typically 'secret').
933
1096
  data : dict
934
- Data dictionary.
1097
+ The secret data dictionary to store.
935
1098
  **kwargs : dict
936
- Parameters to pass to the API call.
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
- Get logs from backend.
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
- Project name.
1130
+ The project name containing the entity.
965
1131
  entity_type : str
966
- Entity type.
1132
+ The type of entity (typically 'run' or 'task').
967
1133
  entity_id : str
968
- Entity ID.
1134
+ The unique identifier of the entity to get logs for.
969
1135
  **kwargs : dict
970
- Parameters to pass to the API call.
1136
+ Additional parameters to pass to the API call.
971
1137
 
972
1138
  Returns
973
1139
  -------
974
1140
  dict
975
- Response from backend.
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 object in backend.
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
- Project name.
1169
+ The project name containing the entity.
1001
1170
  entity_type : str
1002
- Entity type.
1171
+ The type of entity to stop.
1003
1172
  entity_id : str
1004
- Entity ID.
1173
+ The unique identifier of the entity to stop.
1005
1174
  **kwargs : dict
1006
- Parameters to pass to the API call.
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 object in backend.
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
- Project name.
1207
+ The project name containing the entity.
1036
1208
  entity_type : str
1037
- Entity type.
1209
+ The type of entity to resume.
1038
1210
  entity_id : str
1039
- Entity ID.
1211
+ The unique identifier of the entity to resume.
1040
1212
  **kwargs : dict
1041
- Parameters to pass to the API call.
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
- Get files info from backend.
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
- Project name.
1245
+ The project name containing the entity.
1071
1246
  entity_type : str
1072
- Entity type.
1247
+ The type of entity to get file info for.
1073
1248
  entity_id : str
1074
- Entity ID.
1249
+ The unique identifier of the entity.
1075
1250
  **kwargs : dict
1076
- Parameters to pass to the API call.
1251
+ Additional parameters to pass to the API call.
1077
1252
 
1078
1253
  Returns
1079
1254
  -------
1080
1255
  list[dict]
1081
- Response from backend.
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
- Get metrics from backend.
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
- Project name.
1324
+ The project name containing the entity.
1146
1325
  entity_type : str
1147
- Entity type.
1326
+ The type of entity to read metrics from.
1148
1327
  entity_id : str
1149
- Entity ID.
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
- Parameters to pass to the API call.
1333
+ Additional parameters to pass to the API call.
1152
1334
 
1153
1335
  Returns
1154
1336
  -------
1155
1337
  dict
1156
- Response from backend.
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
- Get single metric from backend.
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
- Project name.
1370
+ The project name containing the entity.
1185
1371
  entity_type : str
1186
- Entity type.
1372
+ The type of entity to update metrics for.
1187
1373
  entity_id : str
1188
- Entity ID.
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
- Parameters to pass to the API call.
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
- Search in backend.
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
- Context instance.
1413
+ The context instance containing client and project information.
1219
1414
  **kwargs : dict
1220
- Parameters to pass to the API call.
1415
+ Search parameters and filters to pass to the API call.
1221
1416
 
1222
1417
  Returns
1223
1418
  -------
1224
1419
  dict
1225
- Response from backend.
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 objects from backend.
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
- Project name.
1260
- query : str
1261
- Search query.
1262
- entity_types : list[str]
1263
- Entity types.
1264
- name : str
1265
- Entity name.
1266
- kind : str
1267
- Entity kind.
1268
- created : str
1269
- Entity creation date.
1270
- updated : str
1271
- Entity update date.
1272
- description : str
1273
- Entity description.
1274
- labels : list[str]
1275
- Entity labels.
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
- Parameters to pass to the API call.
1477
+ Additional search parameters to pass to the API call.
1278
1478
 
1279
1479
  Returns
1280
1480
  -------
1281
1481
  list[ContextEntity]
1282
- List of object instances.
1482
+ List of matching entity instances from the search.
1283
1483
  """
1284
1484
  context = get_context_from_project(project)
1285
1485
  return self._search(