digitalhub 0.14.0b5__py3-none-any.whl → 0.14.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- digitalhub/__init__.py +2 -2
- digitalhub/context/api.py +43 -6
- digitalhub/context/builder.py +1 -1
- digitalhub/context/context.py +3 -6
- digitalhub/entities/_base/context/entity.py +0 -3
- digitalhub/entities/_base/executable/entity.py +29 -11
- digitalhub/entities/_base/material/entity.py +2 -2
- digitalhub/entities/_base/material/utils.py +0 -4
- digitalhub/entities/_commons/enums.py +1 -0
- digitalhub/entities/_commons/utils.py +19 -0
- digitalhub/entities/_processors/base/crud.py +15 -24
- digitalhub/entities/_processors/base/import_export.py +3 -7
- digitalhub/entities/_processors/base/processor.py +4 -7
- digitalhub/entities/_processors/base/special_ops.py +4 -8
- digitalhub/entities/_processors/context/crud.py +27 -29
- digitalhub/entities/_processors/context/import_export.py +7 -7
- digitalhub/entities/_processors/context/material.py +2 -2
- digitalhub/entities/_processors/context/special_ops.py +25 -25
- digitalhub/entities/_processors/utils.py +7 -116
- digitalhub/entities/artifact/crud.py +3 -3
- digitalhub/entities/artifact/utils.py +2 -2
- digitalhub/entities/builders.py +2 -0
- digitalhub/entities/dataitem/crud.py +3 -3
- digitalhub/entities/dataitem/utils.py +10 -14
- digitalhub/entities/function/_base/entity.py +0 -3
- digitalhub/entities/function/crud.py +3 -3
- digitalhub/entities/model/crud.py +3 -3
- digitalhub/entities/model/mlflow/utils.py +29 -20
- digitalhub/entities/model/utils.py +2 -2
- digitalhub/entities/project/_base/builder.py +0 -6
- digitalhub/entities/project/_base/entity.py +264 -114
- digitalhub/entities/project/_base/spec.py +4 -4
- digitalhub/entities/project/crud.py +16 -51
- digitalhub/entities/project/utils.py +7 -3
- digitalhub/entities/secret/crud.py +2 -2
- digitalhub/entities/task/_base/models.py +13 -16
- digitalhub/entities/trigger/crud.py +28 -9
- digitalhub/entities/workflow/_base/entity.py +0 -5
- digitalhub/entities/workflow/crud.py +3 -6
- digitalhub/stores/client/{dhcore/api_builder.py → api_builder.py} +2 -3
- digitalhub/stores/client/builder.py +20 -32
- digitalhub/stores/client/client.py +322 -0
- digitalhub/stores/client/{dhcore/configurator.py → configurator.py} +148 -195
- digitalhub/stores/client/{_base/enums.py → enums.py} +11 -0
- digitalhub/stores/client/header_manager.py +61 -0
- digitalhub/stores/client/http_handler.py +152 -0
- digitalhub/stores/client/{_base/key_builder.py → key_builder.py} +14 -14
- digitalhub/stores/client/{dhcore/params_builder.py → params_builder.py} +51 -12
- digitalhub/stores/client/response_processor.py +102 -0
- digitalhub/stores/client/utils.py +35 -0
- digitalhub/stores/{credentials → configurator}/api.py +5 -9
- digitalhub/stores/configurator/configurator.py +123 -0
- digitalhub/stores/{credentials → configurator}/enums.py +26 -10
- digitalhub/stores/configurator/handler.py +213 -0
- digitalhub/stores/{credentials → configurator}/ini_module.py +31 -6
- digitalhub/stores/data/_base/store.py +0 -4
- digitalhub/stores/data/api.py +4 -6
- digitalhub/stores/data/builder.py +6 -38
- digitalhub/stores/data/s3/configurator.py +30 -114
- digitalhub/stores/data/s3/store.py +9 -22
- digitalhub/stores/data/sql/configurator.py +49 -71
- digitalhub/stores/data/sql/store.py +26 -61
- digitalhub/utils/generic_utils.py +0 -12
- digitalhub/utils/git_utils.py +0 -8
- digitalhub/utils/io_utils.py +0 -8
- digitalhub/utils/store_utils.py +1 -1
- {digitalhub-0.14.0b5.dist-info → digitalhub-0.14.9.dist-info}/METADATA +3 -3
- {digitalhub-0.14.0b5.dist-info → digitalhub-0.14.9.dist-info}/RECORD +73 -86
- {digitalhub-0.14.0b5.dist-info → digitalhub-0.14.9.dist-info}/WHEEL +1 -1
- digitalhub/stores/client/_base/api_builder.py +0 -34
- digitalhub/stores/client/_base/client.py +0 -243
- digitalhub/stores/client/_base/params_builder.py +0 -82
- digitalhub/stores/client/api.py +0 -32
- digitalhub/stores/client/dhcore/__init__.py +0 -3
- digitalhub/stores/client/dhcore/client.py +0 -553
- digitalhub/stores/client/dhcore/enums.py +0 -18
- digitalhub/stores/client/dhcore/key_builder.py +0 -62
- digitalhub/stores/client/dhcore/utils.py +0 -86
- digitalhub/stores/client/local/__init__.py +0 -3
- digitalhub/stores/client/local/api_builder.py +0 -116
- digitalhub/stores/client/local/client.py +0 -605
- digitalhub/stores/client/local/enums.py +0 -15
- digitalhub/stores/client/local/key_builder.py +0 -62
- digitalhub/stores/client/local/params_builder.py +0 -97
- digitalhub/stores/credentials/__init__.py +0 -3
- digitalhub/stores/credentials/configurator.py +0 -185
- digitalhub/stores/credentials/handler.py +0 -164
- digitalhub/stores/credentials/store.py +0 -77
- digitalhub/stores/data/enums.py +0 -15
- /digitalhub/stores/client/{dhcore/error_parser.py → error_parser.py} +0 -0
- /digitalhub/stores/{client/_base → configurator}/__init__.py +0 -0
- {digitalhub-0.14.0b5.dist-info → digitalhub-0.14.9.dist-info}/licenses/AUTHORS +0 -0
- {digitalhub-0.14.0b5.dist-info → digitalhub-0.14.9.dist-info}/licenses/LICENSE +0 -0
|
@@ -6,14 +6,14 @@ from __future__ import annotations
|
|
|
6
6
|
|
|
7
7
|
import typing
|
|
8
8
|
|
|
9
|
-
from digitalhub.entities._commons.utils import is_valid_key
|
|
9
|
+
from digitalhub.entities._commons.utils import is_valid_key, sanitize_unversioned_key
|
|
10
10
|
from digitalhub.entities._processors.utils import (
|
|
11
|
+
get_context,
|
|
11
12
|
get_context_from_identifier,
|
|
12
|
-
get_context_from_project,
|
|
13
13
|
parse_identifier,
|
|
14
14
|
)
|
|
15
15
|
from digitalhub.factory.entity import entity_factory
|
|
16
|
-
from digitalhub.stores.client.
|
|
16
|
+
from digitalhub.stores.client.enums import ApiCategories, BackendOperations
|
|
17
17
|
|
|
18
18
|
if typing.TYPE_CHECKING:
|
|
19
19
|
from digitalhub.context.context import Context
|
|
@@ -77,7 +77,7 @@ class ContextEntityCRUDProcessor:
|
|
|
77
77
|
|
|
78
78
|
Parameters
|
|
79
79
|
----------
|
|
80
|
-
_entity : ContextEntity
|
|
80
|
+
_entity : ContextEntity
|
|
81
81
|
An existing context entity object to create. If None,
|
|
82
82
|
a new entity will be built from kwargs.
|
|
83
83
|
**kwargs : dict
|
|
@@ -93,7 +93,7 @@ class ContextEntityCRUDProcessor:
|
|
|
93
93
|
context = _entity._context()
|
|
94
94
|
obj = _entity
|
|
95
95
|
else:
|
|
96
|
-
context =
|
|
96
|
+
context = get_context(kwargs["project"])
|
|
97
97
|
obj: ContextEntity = entity_factory.build_entity_from_params(**kwargs)
|
|
98
98
|
new_obj = self._create_context_entity(context, obj.ENTITY_TYPE, obj.to_dict())
|
|
99
99
|
return entity_factory.build_entity_from_dict(new_obj)
|
|
@@ -120,11 +120,11 @@ class ContextEntityCRUDProcessor:
|
|
|
120
120
|
The project context instance.
|
|
121
121
|
identifier : str
|
|
122
122
|
Entity key (store://...) or entity name identifier.
|
|
123
|
-
entity_type : str
|
|
123
|
+
entity_type : str
|
|
124
124
|
The type of entity to read.
|
|
125
|
-
project : str
|
|
125
|
+
project : str
|
|
126
126
|
Project name (used for identifier parsing).
|
|
127
|
-
entity_id : str
|
|
127
|
+
entity_id : str
|
|
128
128
|
Specific entity ID to read.
|
|
129
129
|
**kwargs : dict
|
|
130
130
|
Additional parameters to pass to the API call.
|
|
@@ -185,11 +185,11 @@ class ContextEntityCRUDProcessor:
|
|
|
185
185
|
----------
|
|
186
186
|
identifier : str
|
|
187
187
|
Entity key (store://...) or entity name identifier.
|
|
188
|
-
entity_type : str
|
|
188
|
+
entity_type : str
|
|
189
189
|
The type of entity to read.
|
|
190
|
-
project : str
|
|
190
|
+
project : str
|
|
191
191
|
Project name for context resolution.
|
|
192
|
-
entity_id : str
|
|
192
|
+
entity_id : str
|
|
193
193
|
Specific entity ID to read.
|
|
194
194
|
**kwargs : dict
|
|
195
195
|
Additional parameters to pass to the API call.
|
|
@@ -230,11 +230,11 @@ class ContextEntityCRUDProcessor:
|
|
|
230
230
|
----------
|
|
231
231
|
identifier : str
|
|
232
232
|
Entity key (store://...) or entity ID.
|
|
233
|
-
entity_type : str
|
|
233
|
+
entity_type : str
|
|
234
234
|
The type of entity to read.
|
|
235
|
-
project : str
|
|
235
|
+
project : str
|
|
236
236
|
Project name for context resolution.
|
|
237
|
-
entity_id : str
|
|
237
|
+
entity_id : str
|
|
238
238
|
Specific entity ID to read.
|
|
239
239
|
**kwargs : dict
|
|
240
240
|
Additional parameters to pass to the API call.
|
|
@@ -247,9 +247,7 @@ class ContextEntityCRUDProcessor:
|
|
|
247
247
|
if not is_valid_key(identifier):
|
|
248
248
|
entity_id = identifier
|
|
249
249
|
else:
|
|
250
|
-
|
|
251
|
-
if len(splt) == 3:
|
|
252
|
-
identifier = f"{splt[0]}:{splt[1]}"
|
|
250
|
+
identifier = sanitize_unversioned_key(identifier)
|
|
253
251
|
return self.read_context_entity(
|
|
254
252
|
identifier,
|
|
255
253
|
entity_type=entity_type,
|
|
@@ -278,9 +276,9 @@ class ContextEntityCRUDProcessor:
|
|
|
278
276
|
The project context instance.
|
|
279
277
|
identifier : str
|
|
280
278
|
Entity key (store://...) or entity name identifier.
|
|
281
|
-
entity_type : str
|
|
279
|
+
entity_type : str
|
|
282
280
|
The type of entity to read versions for.
|
|
283
|
-
project : str
|
|
281
|
+
project : str
|
|
284
282
|
Project name (used for identifier parsing).
|
|
285
283
|
**kwargs : dict
|
|
286
284
|
Additional parameters to pass to the API call.
|
|
@@ -329,9 +327,9 @@ class ContextEntityCRUDProcessor:
|
|
|
329
327
|
----------
|
|
330
328
|
identifier : str
|
|
331
329
|
Entity key (store://...) or entity name identifier.
|
|
332
|
-
entity_type : str
|
|
330
|
+
entity_type : str
|
|
333
331
|
The type of entity to read versions for.
|
|
334
|
-
project : str
|
|
332
|
+
project : str
|
|
335
333
|
Project name for context resolution.
|
|
336
334
|
**kwargs : dict
|
|
337
335
|
Additional parameters to pass to the API call.
|
|
@@ -425,7 +423,7 @@ class ContextEntityCRUDProcessor:
|
|
|
425
423
|
list[ContextEntity]
|
|
426
424
|
List of context entity objects (latest versions only).
|
|
427
425
|
"""
|
|
428
|
-
context =
|
|
426
|
+
context = get_context(project)
|
|
429
427
|
objs = self._list_context_entities(context, entity_type, **kwargs)
|
|
430
428
|
objects = []
|
|
431
429
|
for o in objs:
|
|
@@ -509,7 +507,7 @@ class ContextEntityCRUDProcessor:
|
|
|
509
507
|
ContextEntity
|
|
510
508
|
The updated context entity object.
|
|
511
509
|
"""
|
|
512
|
-
context =
|
|
510
|
+
context = get_context(project)
|
|
513
511
|
obj = self._update_context_entity(
|
|
514
512
|
context,
|
|
515
513
|
entity_type,
|
|
@@ -541,11 +539,11 @@ class ContextEntityCRUDProcessor:
|
|
|
541
539
|
The project context instance.
|
|
542
540
|
identifier : str
|
|
543
541
|
Entity key (store://...) or entity name identifier.
|
|
544
|
-
entity_type : str
|
|
542
|
+
entity_type : str
|
|
545
543
|
The type of entity to delete.
|
|
546
|
-
project : str
|
|
544
|
+
project : str
|
|
547
545
|
Project name (used for identifier parsing).
|
|
548
|
-
entity_id : str
|
|
546
|
+
entity_id : str
|
|
549
547
|
Specific entity ID to delete.
|
|
550
548
|
**kwargs : dict
|
|
551
549
|
Additional parameters including:
|
|
@@ -606,11 +604,11 @@ class ContextEntityCRUDProcessor:
|
|
|
606
604
|
----------
|
|
607
605
|
identifier : str
|
|
608
606
|
Entity key (store://...) or entity name identifier.
|
|
609
|
-
project : str
|
|
607
|
+
project : str
|
|
610
608
|
Project name for context resolution.
|
|
611
|
-
entity_type : str
|
|
609
|
+
entity_type : str
|
|
612
610
|
The type of entity to delete.
|
|
613
|
-
entity_id : str
|
|
611
|
+
entity_id : str
|
|
614
612
|
Specific entity ID to delete.
|
|
615
613
|
**kwargs : dict
|
|
616
614
|
Additional parameters including deletion options.
|
|
@@ -7,7 +7,7 @@ from __future__ import annotations
|
|
|
7
7
|
import typing
|
|
8
8
|
|
|
9
9
|
from digitalhub.entities._constructors.uuid import build_uuid
|
|
10
|
-
from digitalhub.entities._processors.utils import
|
|
10
|
+
from digitalhub.entities._processors.utils import get_context, get_context_from_identifier
|
|
11
11
|
from digitalhub.factory.entity import entity_factory
|
|
12
12
|
from digitalhub.utils.exceptions import EntityAlreadyExistsError, EntityError, EntityNotExistsError
|
|
13
13
|
from digitalhub.utils.io_utils import read_yaml
|
|
@@ -47,7 +47,7 @@ class ContextEntityImportExportProcessor:
|
|
|
47
47
|
Storage key (store://...) to read the entity from.
|
|
48
48
|
reset_id : bool
|
|
49
49
|
Flag to determine if the ID of context entities should be reset.
|
|
50
|
-
context : str
|
|
50
|
+
context : str
|
|
51
51
|
Project name to use for context resolution. If None, uses
|
|
52
52
|
the project specified in the YAML file.
|
|
53
53
|
|
|
@@ -75,7 +75,7 @@ class ContextEntityImportExportProcessor:
|
|
|
75
75
|
if context is None:
|
|
76
76
|
context = dict_obj["project"]
|
|
77
77
|
|
|
78
|
-
ctx =
|
|
78
|
+
ctx = get_context(context)
|
|
79
79
|
obj = entity_factory.build_entity_from_dict(dict_obj)
|
|
80
80
|
if reset_id:
|
|
81
81
|
new_id = build_uuid()
|
|
@@ -110,7 +110,7 @@ class ContextEntityImportExportProcessor:
|
|
|
110
110
|
Storage key (store://...) to read the entity from.
|
|
111
111
|
reset_id : bool
|
|
112
112
|
Flag to determine if the ID of executable entities should be reset.
|
|
113
|
-
context : str
|
|
113
|
+
context : str
|
|
114
114
|
Project name to use for context resolution.
|
|
115
115
|
|
|
116
116
|
Returns
|
|
@@ -147,7 +147,7 @@ class ContextEntityImportExportProcessor:
|
|
|
147
147
|
if context is None:
|
|
148
148
|
context = exec_dict["project"]
|
|
149
149
|
|
|
150
|
-
ctx =
|
|
150
|
+
ctx = get_context(context)
|
|
151
151
|
obj: ExecutableEntity = entity_factory.build_entity_from_dict(exec_dict)
|
|
152
152
|
|
|
153
153
|
if reset_id:
|
|
@@ -190,7 +190,7 @@ class ContextEntityImportExportProcessor:
|
|
|
190
190
|
The loaded and updated context entity.
|
|
191
191
|
"""
|
|
192
192
|
dict_obj: dict = read_yaml(file)
|
|
193
|
-
context =
|
|
193
|
+
context = get_context(dict_obj["project"])
|
|
194
194
|
obj: ContextEntity = entity_factory.build_entity_from_dict(dict_obj)
|
|
195
195
|
try:
|
|
196
196
|
crud_processor._update_context_entity(context, obj.ENTITY_TYPE, obj.id, obj.to_dict())
|
|
@@ -231,7 +231,7 @@ class ContextEntityImportExportProcessor:
|
|
|
231
231
|
exec_dict = dict_obj
|
|
232
232
|
tsk_dicts = []
|
|
233
233
|
|
|
234
|
-
context =
|
|
234
|
+
context = get_context(exec_dict["project"])
|
|
235
235
|
obj: ExecutableEntity = entity_factory.build_entity_from_dict(exec_dict)
|
|
236
236
|
|
|
237
237
|
try:
|
|
@@ -7,7 +7,7 @@ from __future__ import annotations
|
|
|
7
7
|
import typing
|
|
8
8
|
|
|
9
9
|
from digitalhub.entities._commons.enums import Relationship, State
|
|
10
|
-
from digitalhub.entities._processors.utils import
|
|
10
|
+
from digitalhub.entities._processors.utils import get_context
|
|
11
11
|
from digitalhub.factory.entity import entity_factory
|
|
12
12
|
from digitalhub.utils.exceptions import EntityError
|
|
13
13
|
from digitalhub.utils.types import SourcesOrListOfSources
|
|
@@ -59,7 +59,7 @@ class ContextEntityMaterialProcessor:
|
|
|
59
59
|
If file upload fails during the process.
|
|
60
60
|
"""
|
|
61
61
|
source: SourcesOrListOfSources = kwargs.pop("source")
|
|
62
|
-
context =
|
|
62
|
+
context = get_context(kwargs["project"])
|
|
63
63
|
obj = entity_factory.build_entity_from_params(**kwargs)
|
|
64
64
|
if context.is_running:
|
|
65
65
|
obj.add_relationship(Relationship.PRODUCEDBY.value, context.get_run_ctx())
|
|
@@ -7,8 +7,8 @@ from __future__ import annotations
|
|
|
7
7
|
import typing
|
|
8
8
|
from typing import Any
|
|
9
9
|
|
|
10
|
-
from digitalhub.entities._processors.utils import
|
|
11
|
-
from digitalhub.stores.client.
|
|
10
|
+
from digitalhub.entities._processors.utils import get_context
|
|
11
|
+
from digitalhub.stores.client.enums import ApiCategories, BackendOperations
|
|
12
12
|
|
|
13
13
|
if typing.TYPE_CHECKING:
|
|
14
14
|
from digitalhub.entities._base.context.entity import ContextEntity
|
|
@@ -47,7 +47,7 @@ class ContextEntitySpecialOpsProcessor:
|
|
|
47
47
|
The kind/subtype of entity.
|
|
48
48
|
entity_name : str
|
|
49
49
|
The name of the entity.
|
|
50
|
-
entity_id : str
|
|
50
|
+
entity_id : str
|
|
51
51
|
The unique identifier of the entity version.
|
|
52
52
|
|
|
53
53
|
Returns
|
|
@@ -55,7 +55,7 @@ class ContextEntitySpecialOpsProcessor:
|
|
|
55
55
|
str
|
|
56
56
|
The constructed context entity key string.
|
|
57
57
|
"""
|
|
58
|
-
context =
|
|
58
|
+
context = get_context(project)
|
|
59
59
|
return context.client.build_key(
|
|
60
60
|
ApiCategories.CONTEXT.value,
|
|
61
61
|
project=context.name,
|
|
@@ -91,7 +91,7 @@ class ContextEntitySpecialOpsProcessor:
|
|
|
91
91
|
dict
|
|
92
92
|
Secret data retrieved from the backend.
|
|
93
93
|
"""
|
|
94
|
-
context =
|
|
94
|
+
context = get_context(project)
|
|
95
95
|
api = context.client.build_api(
|
|
96
96
|
ApiCategories.CONTEXT.value,
|
|
97
97
|
BackendOperations.DATA.value,
|
|
@@ -124,7 +124,7 @@ class ContextEntitySpecialOpsProcessor:
|
|
|
124
124
|
**kwargs : dict
|
|
125
125
|
Additional parameters to pass to the API call.
|
|
126
126
|
"""
|
|
127
|
-
context =
|
|
127
|
+
context = get_context(project)
|
|
128
128
|
api = context.client.build_api(
|
|
129
129
|
ApiCategories.CONTEXT.value,
|
|
130
130
|
BackendOperations.DATA.value,
|
|
@@ -162,7 +162,7 @@ class ContextEntitySpecialOpsProcessor:
|
|
|
162
162
|
dict
|
|
163
163
|
Log data retrieved from the backend.
|
|
164
164
|
"""
|
|
165
|
-
context =
|
|
165
|
+
context = get_context(project)
|
|
166
166
|
api = context.client.build_api(
|
|
167
167
|
ApiCategories.CONTEXT.value,
|
|
168
168
|
BackendOperations.LOGS.value,
|
|
@@ -196,7 +196,7 @@ class ContextEntitySpecialOpsProcessor:
|
|
|
196
196
|
**kwargs : dict
|
|
197
197
|
Additional parameters to pass to the API call.
|
|
198
198
|
"""
|
|
199
|
-
context =
|
|
199
|
+
context = get_context(project)
|
|
200
200
|
api = context.client.build_api(
|
|
201
201
|
ApiCategories.CONTEXT.value,
|
|
202
202
|
BackendOperations.STOP.value,
|
|
@@ -204,7 +204,7 @@ class ContextEntitySpecialOpsProcessor:
|
|
|
204
204
|
entity_type=entity_type,
|
|
205
205
|
entity_id=entity_id,
|
|
206
206
|
)
|
|
207
|
-
context.client.create_object(api, **kwargs)
|
|
207
|
+
context.client.create_object(api, obj={}, **kwargs)
|
|
208
208
|
|
|
209
209
|
def resume_entity(
|
|
210
210
|
self,
|
|
@@ -230,7 +230,7 @@ class ContextEntitySpecialOpsProcessor:
|
|
|
230
230
|
**kwargs : dict
|
|
231
231
|
Additional parameters to pass to the API call.
|
|
232
232
|
"""
|
|
233
|
-
context =
|
|
233
|
+
context = get_context(project)
|
|
234
234
|
api = context.client.build_api(
|
|
235
235
|
ApiCategories.CONTEXT.value,
|
|
236
236
|
BackendOperations.RESUME.value,
|
|
@@ -238,7 +238,7 @@ class ContextEntitySpecialOpsProcessor:
|
|
|
238
238
|
entity_type=entity_type,
|
|
239
239
|
entity_id=entity_id,
|
|
240
240
|
)
|
|
241
|
-
context.client.create_object(api, **kwargs)
|
|
241
|
+
context.client.create_object(api, obj={}, **kwargs)
|
|
242
242
|
|
|
243
243
|
def read_files_info(
|
|
244
244
|
self,
|
|
@@ -269,7 +269,7 @@ class ContextEntitySpecialOpsProcessor:
|
|
|
269
269
|
list[dict]
|
|
270
270
|
List of file information dictionaries from the backend.
|
|
271
271
|
"""
|
|
272
|
-
context =
|
|
272
|
+
context = get_context(project)
|
|
273
273
|
api = context.client.build_api(
|
|
274
274
|
ApiCategories.CONTEXT.value,
|
|
275
275
|
BackendOperations.FILES.value,
|
|
@@ -303,7 +303,7 @@ class ContextEntitySpecialOpsProcessor:
|
|
|
303
303
|
**kwargs : dict
|
|
304
304
|
Parameters to pass to the API call.
|
|
305
305
|
"""
|
|
306
|
-
context =
|
|
306
|
+
context = get_context(project)
|
|
307
307
|
api = context.client.build_api(
|
|
308
308
|
ApiCategories.CONTEXT.value,
|
|
309
309
|
BackendOperations.FILES.value,
|
|
@@ -336,7 +336,7 @@ class ContextEntitySpecialOpsProcessor:
|
|
|
336
336
|
The type of entity to read metrics from.
|
|
337
337
|
entity_id : str
|
|
338
338
|
The unique identifier of the entity.
|
|
339
|
-
metric_name : str
|
|
339
|
+
metric_name : str
|
|
340
340
|
The name of a specific metric to retrieve.
|
|
341
341
|
If None, retrieves all available metrics.
|
|
342
342
|
**kwargs : dict
|
|
@@ -347,7 +347,7 @@ class ContextEntitySpecialOpsProcessor:
|
|
|
347
347
|
dict
|
|
348
348
|
Dictionary containing metric data from the backend.
|
|
349
349
|
"""
|
|
350
|
-
context =
|
|
350
|
+
context = get_context(project)
|
|
351
351
|
api = context.client.build_api(
|
|
352
352
|
ApiCategories.CONTEXT.value,
|
|
353
353
|
BackendOperations.METRICS.value,
|
|
@@ -390,7 +390,7 @@ class ContextEntitySpecialOpsProcessor:
|
|
|
390
390
|
**kwargs : dict
|
|
391
391
|
Additional parameters to pass to the API call.
|
|
392
392
|
"""
|
|
393
|
-
context =
|
|
393
|
+
context = get_context(project)
|
|
394
394
|
api = context.client.build_api(
|
|
395
395
|
ApiCategories.CONTEXT.value,
|
|
396
396
|
BackendOperations.METRICS.value,
|
|
@@ -428,22 +428,22 @@ class ContextEntitySpecialOpsProcessor:
|
|
|
428
428
|
The CRUD processor instance for entity operations.
|
|
429
429
|
project : str
|
|
430
430
|
The project name to search within.
|
|
431
|
-
query : str
|
|
431
|
+
query : str
|
|
432
432
|
Free-text search query to match against entity content.
|
|
433
|
-
entity_types : list[str]
|
|
433
|
+
entity_types : list[str]
|
|
434
434
|
List of entity types to filter by.
|
|
435
435
|
If None, searches all entity types.
|
|
436
|
-
name : str
|
|
436
|
+
name : str
|
|
437
437
|
Entity name pattern to match.
|
|
438
|
-
kind : str
|
|
438
|
+
kind : str
|
|
439
439
|
Entity kind to filter by.
|
|
440
|
-
created : str
|
|
440
|
+
created : str
|
|
441
441
|
Creation date filter (ISO format).
|
|
442
|
-
updated : str
|
|
442
|
+
updated : str
|
|
443
443
|
Last update date filter (ISO format).
|
|
444
|
-
description : str
|
|
444
|
+
description : str
|
|
445
445
|
Description pattern to match.
|
|
446
|
-
labels : list[str]
|
|
446
|
+
labels : list[str]
|
|
447
447
|
List of label patterns to match.
|
|
448
448
|
**kwargs : dict
|
|
449
449
|
Additional search parameters to pass to the API call.
|
|
@@ -453,7 +453,7 @@ class ContextEntitySpecialOpsProcessor:
|
|
|
453
453
|
list[ContextEntity]
|
|
454
454
|
List of matching entity instances from the search.
|
|
455
455
|
"""
|
|
456
|
-
context =
|
|
456
|
+
context = get_context(project)
|
|
457
457
|
kwargs = context.client.build_parameters(
|
|
458
458
|
ApiCategories.CONTEXT.value,
|
|
459
459
|
BackendOperations.SEARCH.value,
|
|
@@ -7,16 +7,11 @@ from __future__ import annotations
|
|
|
7
7
|
import typing
|
|
8
8
|
|
|
9
9
|
from digitalhub.context.api import get_context
|
|
10
|
-
from digitalhub.entities._commons.enums import EntityTypes
|
|
11
10
|
from digitalhub.entities._commons.utils import get_project_from_key, is_valid_key, parse_entity_key
|
|
12
|
-
from digitalhub.
|
|
13
|
-
from digitalhub.stores.client._base.enums import ApiCategories, BackendOperations
|
|
14
|
-
from digitalhub.stores.client.api import get_client
|
|
15
|
-
from digitalhub.utils.exceptions import ContextError, EntityError, EntityNotExistsError
|
|
11
|
+
from digitalhub.utils.exceptions import EntityError
|
|
16
12
|
|
|
17
13
|
if typing.TYPE_CHECKING:
|
|
18
14
|
from digitalhub.context.context import Context
|
|
19
|
-
from digitalhub.stores.client._base.client import Client
|
|
20
15
|
|
|
21
16
|
|
|
22
17
|
def parse_identifier(
|
|
@@ -38,13 +33,13 @@ def parse_identifier(
|
|
|
38
33
|
identifier : str
|
|
39
34
|
The entity identifier to parse. Can be either a full entity key
|
|
40
35
|
(store://project/entity_type/kind/name:id) or a simple entity name.
|
|
41
|
-
project : str
|
|
36
|
+
project : str
|
|
42
37
|
The project name. Required when identifier is not a full key.
|
|
43
|
-
entity_type : str
|
|
38
|
+
entity_type : str
|
|
44
39
|
The entity type. Required when identifier is not a full key.
|
|
45
|
-
entity_kind : str
|
|
40
|
+
entity_kind : str
|
|
46
41
|
The entity kind specification.
|
|
47
|
-
entity_id : str
|
|
42
|
+
entity_id : str
|
|
48
43
|
The entity version identifier.
|
|
49
44
|
|
|
50
45
|
Returns
|
|
@@ -81,7 +76,7 @@ def get_context_from_identifier(
|
|
|
81
76
|
identifier : str
|
|
82
77
|
The entity identifier to extract context from. Can be either
|
|
83
78
|
a full entity key (store://...) or a simple entity name.
|
|
84
|
-
project : str
|
|
79
|
+
project : str
|
|
85
80
|
The project name. Required when identifier is not a full key.
|
|
86
81
|
|
|
87
82
|
Returns
|
|
@@ -100,108 +95,4 @@ def get_context_from_identifier(
|
|
|
100
95
|
else:
|
|
101
96
|
project = get_project_from_key(identifier)
|
|
102
97
|
|
|
103
|
-
return
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
def get_context_from_project(
|
|
107
|
-
project: str,
|
|
108
|
-
) -> Context:
|
|
109
|
-
"""
|
|
110
|
-
Retrieve context for a project, fetching from remote if necessary.
|
|
111
|
-
|
|
112
|
-
Attempts to get the project context from the local cache first.
|
|
113
|
-
If the project is not found locally, tries to fetch it from the
|
|
114
|
-
remote backend and create the context.
|
|
115
|
-
|
|
116
|
-
Parameters
|
|
117
|
-
----------
|
|
118
|
-
project : str
|
|
119
|
-
The name of the project to get context for.
|
|
120
|
-
|
|
121
|
-
Returns
|
|
122
|
-
-------
|
|
123
|
-
Context
|
|
124
|
-
The context instance for the specified project.
|
|
125
|
-
|
|
126
|
-
Raises
|
|
127
|
-
------
|
|
128
|
-
ContextError
|
|
129
|
-
If the project cannot be found locally or remotely.
|
|
130
|
-
"""
|
|
131
|
-
try:
|
|
132
|
-
return get_context(project)
|
|
133
|
-
except ContextError:
|
|
134
|
-
return get_context_from_remote(project)
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
def get_context_from_remote(
|
|
138
|
-
project: str,
|
|
139
|
-
) -> Context:
|
|
140
|
-
"""
|
|
141
|
-
Fetch project context from remote backend and create local context.
|
|
142
|
-
|
|
143
|
-
Retrieves project information from the remote backend, builds the
|
|
144
|
-
project entity locally, and returns the corresponding context.
|
|
145
|
-
Used when a project is not available in the local context cache.
|
|
146
|
-
|
|
147
|
-
Parameters
|
|
148
|
-
----------
|
|
149
|
-
project : str
|
|
150
|
-
The name of the project to fetch from remote.
|
|
151
|
-
|
|
152
|
-
Returns
|
|
153
|
-
-------
|
|
154
|
-
Context
|
|
155
|
-
The context instance created from the remote project data.
|
|
156
|
-
|
|
157
|
-
Raises
|
|
158
|
-
------
|
|
159
|
-
ContextError
|
|
160
|
-
If the project is not found on the remote backend.
|
|
161
|
-
"""
|
|
162
|
-
try:
|
|
163
|
-
client = get_client()
|
|
164
|
-
obj = _read_base_entity(client, EntityTypes.PROJECT.value, project)
|
|
165
|
-
entity_factory.build_entity_from_dict(obj)
|
|
166
|
-
return get_context(project)
|
|
167
|
-
except EntityNotExistsError:
|
|
168
|
-
raise ContextError(f"Project '{project}' not found.")
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
def _read_base_entity(
|
|
172
|
-
client: Client,
|
|
173
|
-
entity_type: str,
|
|
174
|
-
entity_name: str,
|
|
175
|
-
**kwargs,
|
|
176
|
-
) -> dict:
|
|
177
|
-
"""
|
|
178
|
-
Read entity data from the backend API.
|
|
179
|
-
|
|
180
|
-
Internal utility function that performs a base-level entity read
|
|
181
|
-
operation through the client API. Builds the appropriate API
|
|
182
|
-
endpoint and retrieves the entity data as a dictionary.
|
|
183
|
-
|
|
184
|
-
Parameters
|
|
185
|
-
----------
|
|
186
|
-
client : Client
|
|
187
|
-
The client instance to use for the API request.
|
|
188
|
-
entity_type : str
|
|
189
|
-
The type of entity to read (e.g., 'project', 'function').
|
|
190
|
-
entity_name : str
|
|
191
|
-
The name identifier of the entity to retrieve.
|
|
192
|
-
**kwargs : dict
|
|
193
|
-
Additional parameters to pass to the API call, such as
|
|
194
|
-
version specifications or query filters.
|
|
195
|
-
|
|
196
|
-
Returns
|
|
197
|
-
-------
|
|
198
|
-
dict
|
|
199
|
-
Dictionary containing the entity data retrieved from the backend.
|
|
200
|
-
"""
|
|
201
|
-
api = client.build_api(
|
|
202
|
-
ApiCategories.BASE.value,
|
|
203
|
-
BackendOperations.READ.value,
|
|
204
|
-
entity_type=entity_type,
|
|
205
|
-
entity_name=entity_name,
|
|
206
|
-
)
|
|
207
|
-
return client.read_object(api, **kwargs)
|
|
98
|
+
return get_context(project)
|
|
@@ -212,7 +212,7 @@ def list_artifacts(
|
|
|
212
212
|
state: str | None = None,
|
|
213
213
|
created: str | None = None,
|
|
214
214
|
updated: str | None = None,
|
|
215
|
-
|
|
215
|
+
versions: str | None = None,
|
|
216
216
|
) -> list[Artifact]:
|
|
217
217
|
"""
|
|
218
218
|
List all latest version objects from backend.
|
|
@@ -235,7 +235,7 @@ def list_artifacts(
|
|
|
235
235
|
Creation date filter.
|
|
236
236
|
updated : str
|
|
237
237
|
Update date filter.
|
|
238
|
-
|
|
238
|
+
versions : str
|
|
239
239
|
Object version, default is latest.
|
|
240
240
|
|
|
241
241
|
Returns
|
|
@@ -257,7 +257,7 @@ def list_artifacts(
|
|
|
257
257
|
state=state,
|
|
258
258
|
created=created,
|
|
259
259
|
updated=updated,
|
|
260
|
-
|
|
260
|
+
versions=versions,
|
|
261
261
|
)
|
|
262
262
|
|
|
263
263
|
|
|
@@ -23,7 +23,7 @@ def eval_source(
|
|
|
23
23
|
|
|
24
24
|
Parameters
|
|
25
25
|
----------
|
|
26
|
-
source : str, list[str], or None
|
|
26
|
+
source : str, list[str], or None
|
|
27
27
|
The source specification(s) to evaluate. Can be a single
|
|
28
28
|
source string, a list of source strings, or None.
|
|
29
29
|
|
|
@@ -59,7 +59,7 @@ def process_kwargs(
|
|
|
59
59
|
source : str or list[str]
|
|
60
60
|
The source specification(s) for the artifact content.
|
|
61
61
|
Can be a single source or multiple sources.
|
|
62
|
-
path : str
|
|
62
|
+
path : str
|
|
63
63
|
The destination path for the artifact entity.
|
|
64
64
|
If None, a path will be automatically generated.
|
|
65
65
|
**kwargs : dict
|
digitalhub/entities/builders.py
CHANGED
|
@@ -10,6 +10,7 @@ from digitalhub.entities.dataitem.table.builder import DataitemTableBuilder
|
|
|
10
10
|
from digitalhub.entities.model.mlflow.builder import ModelModelBuilder
|
|
11
11
|
from digitalhub.entities.project._base.builder import ProjectProjectBuilder
|
|
12
12
|
from digitalhub.entities.secret._base.builder import SecretSecretBuilder
|
|
13
|
+
from digitalhub.entities.trigger.lifecycle.builder import TriggerLifecycleBuilder
|
|
13
14
|
from digitalhub.entities.trigger.scheduler.builder import TriggerSchedulerBuilder
|
|
14
15
|
|
|
15
16
|
entity_builders: tuple = (
|
|
@@ -20,6 +21,7 @@ entity_builders: tuple = (
|
|
|
20
21
|
(DataitemTableBuilder.ENTITY_KIND, DataitemTableBuilder),
|
|
21
22
|
(ModelModelBuilder.ENTITY_KIND, ModelModelBuilder),
|
|
22
23
|
(TriggerSchedulerBuilder.ENTITY_KIND, TriggerSchedulerBuilder),
|
|
24
|
+
(TriggerLifecycleBuilder.ENTITY_KIND, TriggerLifecycleBuilder),
|
|
23
25
|
)
|
|
24
26
|
|
|
25
27
|
##############################
|
|
@@ -241,7 +241,7 @@ def list_dataitems(
|
|
|
241
241
|
state: str | None = None,
|
|
242
242
|
created: str | None = None,
|
|
243
243
|
updated: str | None = None,
|
|
244
|
-
|
|
244
|
+
versions: str | None = None,
|
|
245
245
|
) -> list[Dataitem]:
|
|
246
246
|
"""
|
|
247
247
|
List all latest version objects from backend.
|
|
@@ -264,7 +264,7 @@ def list_dataitems(
|
|
|
264
264
|
Creation date filter.
|
|
265
265
|
updated : str
|
|
266
266
|
Update date filter.
|
|
267
|
-
|
|
267
|
+
versions : str
|
|
268
268
|
Object version, default is latest.
|
|
269
269
|
|
|
270
270
|
Returns
|
|
@@ -286,7 +286,7 @@ def list_dataitems(
|
|
|
286
286
|
state=state,
|
|
287
287
|
created=created,
|
|
288
288
|
updated=updated,
|
|
289
|
-
|
|
289
|
+
versions=versions,
|
|
290
290
|
)
|
|
291
291
|
|
|
292
292
|
|