digitalhub 0.13.3__py3-none-any.whl → 0.14.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of digitalhub might be problematic. Click here for more details.
- digitalhub/__init__.py +3 -8
- digitalhub/context/api.py +1 -5
- digitalhub/context/builder.py +1 -5
- digitalhub/context/context.py +15 -9
- digitalhub/entities/_base/_base/entity.py +0 -15
- digitalhub/entities/_base/context/entity.py +1 -1
- digitalhub/entities/_base/entity/builder.py +5 -5
- digitalhub/entities/_base/entity/entity.py +0 -8
- digitalhub/entities/_base/executable/entity.py +169 -79
- digitalhub/entities/_base/material/entity.py +6 -22
- digitalhub/entities/_base/material/utils.py +1 -4
- digitalhub/entities/_base/runtime_entity/builder.py +53 -18
- digitalhub/entities/_base/unversioned/entity.py +1 -1
- digitalhub/entities/_base/versioned/entity.py +1 -1
- digitalhub/entities/_commons/enums.py +1 -31
- digitalhub/entities/_commons/utils.py +83 -21
- digitalhub/entities/_constructors/_resources.py +151 -0
- digitalhub/entities/{_base/entity/_constructors → _constructors}/name.py +18 -0
- digitalhub/entities/_processors/base/__init__.py +3 -0
- digitalhub/entities/_processors/{base.py → base/crud.py} +14 -226
- digitalhub/entities/_processors/base/import_export.py +123 -0
- digitalhub/entities/_processors/base/processor.py +302 -0
- digitalhub/entities/_processors/base/special_ops.py +108 -0
- digitalhub/entities/_processors/context/__init__.py +3 -0
- digitalhub/entities/_processors/context/crud.py +652 -0
- digitalhub/entities/_processors/context/import_export.py +242 -0
- digitalhub/entities/_processors/context/material.py +123 -0
- digitalhub/entities/_processors/context/processor.py +400 -0
- digitalhub/entities/_processors/context/special_ops.py +476 -0
- digitalhub/entities/_processors/processors.py +12 -0
- digitalhub/entities/_processors/utils.py +12 -11
- digitalhub/entities/artifact/crud.py +58 -22
- digitalhub/entities/artifact/utils.py +3 -3
- digitalhub/entities/dataitem/crud.py +63 -20
- digitalhub/entities/dataitem/table/entity.py +24 -22
- digitalhub/entities/dataitem/utils.py +15 -15
- digitalhub/entities/function/_base/entity.py +3 -3
- digitalhub/entities/function/crud.py +55 -24
- digitalhub/entities/model/_base/entity.py +62 -20
- digitalhub/entities/model/crud.py +58 -22
- digitalhub/entities/model/utils.py +3 -3
- digitalhub/entities/project/_base/entity.py +321 -152
- digitalhub/entities/project/crud.py +15 -23
- digitalhub/entities/run/_base/builder.py +0 -4
- digitalhub/entities/run/_base/entity.py +70 -63
- digitalhub/entities/run/crud.py +79 -26
- digitalhub/entities/secret/_base/entity.py +1 -5
- digitalhub/entities/secret/crud.py +29 -26
- digitalhub/entities/task/_base/builder.py +0 -4
- digitalhub/entities/task/_base/entity.py +5 -5
- digitalhub/entities/task/_base/models.py +13 -16
- digitalhub/entities/task/crud.py +61 -29
- digitalhub/entities/trigger/_base/entity.py +1 -5
- digitalhub/entities/trigger/crud.py +64 -24
- digitalhub/entities/workflow/_base/entity.py +3 -3
- digitalhub/entities/workflow/crud.py +55 -21
- digitalhub/factory/entity.py +283 -0
- digitalhub/factory/enums.py +18 -0
- digitalhub/factory/registry.py +197 -0
- digitalhub/factory/runtime.py +44 -0
- digitalhub/factory/utils.py +3 -54
- digitalhub/runtimes/_base.py +2 -2
- digitalhub/stores/client/_base/enums.py +39 -0
- digitalhub/stores/client/_base/key_builder.py +2 -2
- digitalhub/stores/client/_base/params_builder.py +48 -0
- digitalhub/stores/client/api.py +6 -10
- digitalhub/stores/client/builder.py +4 -4
- digitalhub/stores/client/dhcore/api_builder.py +2 -1
- digitalhub/stores/client/dhcore/client.py +85 -429
- digitalhub/stores/client/dhcore/configurator.py +109 -328
- digitalhub/stores/client/dhcore/enums.py +0 -16
- digitalhub/stores/client/dhcore/error_parser.py +0 -4
- digitalhub/stores/client/dhcore/header_manager.py +61 -0
- digitalhub/stores/client/dhcore/http_handler.py +133 -0
- digitalhub/stores/client/dhcore/params_builder.py +147 -134
- digitalhub/stores/client/dhcore/response_processor.py +102 -0
- digitalhub/stores/client/dhcore/utils.py +6 -72
- digitalhub/stores/client/local/api_builder.py +1 -1
- digitalhub/stores/client/local/client.py +79 -47
- digitalhub/stores/client/local/params_builder.py +18 -41
- digitalhub/stores/credentials/api.py +0 -4
- digitalhub/stores/credentials/configurator.py +2 -28
- digitalhub/stores/credentials/enums.py +3 -0
- digitalhub/stores/credentials/handler.py +0 -12
- digitalhub/stores/credentials/ini_module.py +0 -22
- digitalhub/stores/credentials/store.py +0 -4
- digitalhub/stores/data/_base/store.py +0 -16
- digitalhub/stores/data/builder.py +1 -5
- digitalhub/stores/data/local/store.py +0 -103
- digitalhub/stores/data/remote/store.py +0 -4
- digitalhub/stores/data/s3/configurator.py +60 -14
- digitalhub/stores/data/s3/store.py +49 -16
- digitalhub/stores/data/sql/configurator.py +0 -8
- digitalhub/stores/data/sql/store.py +21 -10
- digitalhub/stores/readers/data/factory.py +0 -8
- digitalhub/stores/readers/data/pandas/reader.py +0 -16
- digitalhub/utils/file_utils.py +0 -17
- digitalhub/utils/generic_utils.py +0 -12
- digitalhub/utils/git_utils.py +0 -8
- digitalhub/utils/io_utils.py +0 -12
- digitalhub/utils/store_utils.py +44 -0
- {digitalhub-0.13.3.dist-info → digitalhub-0.14.0.dist-info}/METADATA +3 -2
- {digitalhub-0.13.3.dist-info → digitalhub-0.14.0.dist-info}/RECORD +111 -95
- digitalhub/entities/_processors/context.py +0 -1450
- digitalhub/entities/task/_base/utils.py +0 -22
- digitalhub/factory/factory.py +0 -381
- 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}/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.3.dist-info → digitalhub-0.14.0.dist-info}/WHEEL +0 -0
- {digitalhub-0.13.3.dist-info → digitalhub-0.14.0.dist-info}/licenses/AUTHORS +0 -0
- {digitalhub-0.13.3.dist-info → digitalhub-0.14.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: © 2025 DSLab - Fondazione Bruno Kessler
|
|
2
|
-
#
|
|
3
|
-
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
|
|
5
|
-
from __future__ import annotations
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def build_task_actions(kind_action_list: list[tuple[str, str]]) -> list[dict[str, str]]:
|
|
9
|
-
"""
|
|
10
|
-
Build task actions.
|
|
11
|
-
|
|
12
|
-
Parameters
|
|
13
|
-
----------
|
|
14
|
-
kind_action_list : list[tuple[str, str]]
|
|
15
|
-
List of kind-action couples.
|
|
16
|
-
|
|
17
|
-
Returns
|
|
18
|
-
-------
|
|
19
|
-
list[dict[str, str]]
|
|
20
|
-
Returns the task actions.
|
|
21
|
-
"""
|
|
22
|
-
return [{"kind": kind, "action": action} for (kind, action) in kind_action_list]
|
digitalhub/factory/factory.py
DELETED
|
@@ -1,381 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: © 2025 DSLab - Fondazione Bruno Kessler
|
|
2
|
-
#
|
|
3
|
-
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
|
|
5
|
-
from __future__ import annotations
|
|
6
|
-
|
|
7
|
-
import typing
|
|
8
|
-
|
|
9
|
-
from digitalhub.utils.exceptions import BuilderError
|
|
10
|
-
|
|
11
|
-
if typing.TYPE_CHECKING:
|
|
12
|
-
from digitalhub.entities._base.entity.builder import EntityBuilder
|
|
13
|
-
from digitalhub.entities._base.entity.entity import Entity
|
|
14
|
-
from digitalhub.entities._base.entity.metadata import Metadata
|
|
15
|
-
from digitalhub.entities._base.entity.spec import Spec, SpecValidator
|
|
16
|
-
from digitalhub.entities._base.entity.status import Status
|
|
17
|
-
from digitalhub.entities._base.runtime_entity.builder import RuntimeEntityBuilder
|
|
18
|
-
from digitalhub.runtimes._base import Runtime
|
|
19
|
-
from digitalhub.runtimes.builder import RuntimeBuilder
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class Factory:
|
|
23
|
-
"""
|
|
24
|
-
Factory for creating and managing entity and runtime builders.
|
|
25
|
-
|
|
26
|
-
This class implements the Factory pattern to manage the creation of
|
|
27
|
-
entities and runtimes through their respective builders. It maintains
|
|
28
|
-
separate registries for entity and runtime builders.
|
|
29
|
-
|
|
30
|
-
Many function arguments are called kind_to_build_from to avoid overwriting
|
|
31
|
-
kind in kwargs.
|
|
32
|
-
|
|
33
|
-
Attributes
|
|
34
|
-
----------
|
|
35
|
-
_entity_builders : dict[str, EntityBuilder | RuntimeEntityBuilder]
|
|
36
|
-
Registry of entity builders indexed by kind.
|
|
37
|
-
_runtime_builders : dict[str, RuntimeBuilder]
|
|
38
|
-
Registry of runtime builders indexed by kind.
|
|
39
|
-
|
|
40
|
-
Notes
|
|
41
|
-
-----
|
|
42
|
-
All builder methods may raise BuilderError if the requested kind
|
|
43
|
-
is not found in the registry.
|
|
44
|
-
"""
|
|
45
|
-
|
|
46
|
-
def __init__(self):
|
|
47
|
-
self._entity_builders: dict[str, EntityBuilder | RuntimeEntityBuilder] = {}
|
|
48
|
-
self._runtime_builders: dict[str, RuntimeBuilder] = {}
|
|
49
|
-
|
|
50
|
-
def add_entity_builder(self, name: str, builder: EntityBuilder | RuntimeEntityBuilder) -> None:
|
|
51
|
-
"""
|
|
52
|
-
Register an entity builder.
|
|
53
|
-
|
|
54
|
-
Parameters
|
|
55
|
-
----------
|
|
56
|
-
name : str
|
|
57
|
-
The unique identifier for the builder.
|
|
58
|
-
builder : EntityBuilder or RuntimeEntityBuilder
|
|
59
|
-
The builder instance to register.
|
|
60
|
-
|
|
61
|
-
Returns
|
|
62
|
-
-------
|
|
63
|
-
None
|
|
64
|
-
|
|
65
|
-
Raises
|
|
66
|
-
------
|
|
67
|
-
BuilderError
|
|
68
|
-
If a builder with the same name already exists.
|
|
69
|
-
"""
|
|
70
|
-
if name in self._entity_builders:
|
|
71
|
-
raise BuilderError(f"Builder {name} already exists.")
|
|
72
|
-
self._entity_builders[name] = builder()
|
|
73
|
-
|
|
74
|
-
def add_runtime_builder(self, name: str, builder: RuntimeBuilder) -> None:
|
|
75
|
-
"""
|
|
76
|
-
Register a runtime builder.
|
|
77
|
-
|
|
78
|
-
Parameters
|
|
79
|
-
----------
|
|
80
|
-
name : str
|
|
81
|
-
The unique identifier for the builder.
|
|
82
|
-
builder : RuntimeBuilder
|
|
83
|
-
The builder instance to register.
|
|
84
|
-
|
|
85
|
-
Returns
|
|
86
|
-
-------
|
|
87
|
-
None
|
|
88
|
-
|
|
89
|
-
Raises
|
|
90
|
-
------
|
|
91
|
-
BuilderError
|
|
92
|
-
If a builder with the same name already exists.
|
|
93
|
-
"""
|
|
94
|
-
if name in self._runtime_builders:
|
|
95
|
-
raise BuilderError(f"Builder {name} already exists.")
|
|
96
|
-
self._runtime_builders[name] = builder()
|
|
97
|
-
|
|
98
|
-
def build_entity_from_params(self, **kwargs) -> Entity:
|
|
99
|
-
"""
|
|
100
|
-
Build an entity from parameters.
|
|
101
|
-
|
|
102
|
-
Parameters
|
|
103
|
-
----------
|
|
104
|
-
**kwargs
|
|
105
|
-
Entity parameters.
|
|
106
|
-
|
|
107
|
-
Returns
|
|
108
|
-
-------
|
|
109
|
-
Entity
|
|
110
|
-
Entity object.
|
|
111
|
-
"""
|
|
112
|
-
try:
|
|
113
|
-
kind = kwargs["kind"]
|
|
114
|
-
except KeyError:
|
|
115
|
-
raise BuilderError("Missing 'kind' parameter.")
|
|
116
|
-
self._raise_if_entity_builder_not_found(kind)
|
|
117
|
-
return self._entity_builders[kind].build(**kwargs)
|
|
118
|
-
|
|
119
|
-
def build_entity_from_dict(self, obj: dict) -> Entity:
|
|
120
|
-
"""
|
|
121
|
-
Build an entity from a dictionary.
|
|
122
|
-
|
|
123
|
-
Parameters
|
|
124
|
-
----------
|
|
125
|
-
obj : dict
|
|
126
|
-
Dictionary with entity data.
|
|
127
|
-
|
|
128
|
-
Returns
|
|
129
|
-
-------
|
|
130
|
-
Entity
|
|
131
|
-
Entity object.
|
|
132
|
-
"""
|
|
133
|
-
try:
|
|
134
|
-
kind = obj["kind"]
|
|
135
|
-
except KeyError:
|
|
136
|
-
raise BuilderError("Missing 'kind' parameter.")
|
|
137
|
-
self._raise_if_entity_builder_not_found(kind)
|
|
138
|
-
return self._entity_builders[kind].from_dict(obj)
|
|
139
|
-
|
|
140
|
-
def build_spec(self, kind_to_build_from: str, **kwargs) -> Spec:
|
|
141
|
-
"""
|
|
142
|
-
Build an entity spec.
|
|
143
|
-
|
|
144
|
-
Parameters
|
|
145
|
-
----------
|
|
146
|
-
kind_to_build_from : str
|
|
147
|
-
Entity type.
|
|
148
|
-
**kwargs
|
|
149
|
-
Additional spec parameters.
|
|
150
|
-
|
|
151
|
-
Returns
|
|
152
|
-
-------
|
|
153
|
-
Spec
|
|
154
|
-
Spec object.
|
|
155
|
-
"""
|
|
156
|
-
self._raise_if_entity_builder_not_found(kind_to_build_from)
|
|
157
|
-
return self._entity_builders[kind_to_build_from].build_spec(**kwargs)
|
|
158
|
-
|
|
159
|
-
def build_metadata(self, kind_to_build_from: str, **kwargs) -> Metadata:
|
|
160
|
-
"""
|
|
161
|
-
Build an entity metadata.
|
|
162
|
-
|
|
163
|
-
Parameters
|
|
164
|
-
----------
|
|
165
|
-
kind_to_build_from : str
|
|
166
|
-
Entity type.
|
|
167
|
-
**kwargs
|
|
168
|
-
Additional metadata parameters.
|
|
169
|
-
|
|
170
|
-
Returns
|
|
171
|
-
-------
|
|
172
|
-
Metadata
|
|
173
|
-
Metadata object.
|
|
174
|
-
"""
|
|
175
|
-
self._raise_if_entity_builder_not_found(kind_to_build_from)
|
|
176
|
-
return self._entity_builders[kind_to_build_from].build_metadata(**kwargs)
|
|
177
|
-
|
|
178
|
-
def build_status(self, kind_to_build_from: str, **kwargs) -> Status:
|
|
179
|
-
"""
|
|
180
|
-
Build an entity status.
|
|
181
|
-
|
|
182
|
-
Parameters
|
|
183
|
-
----------
|
|
184
|
-
kind_to_build_from : str
|
|
185
|
-
Entity type.
|
|
186
|
-
**kwargs
|
|
187
|
-
Additional status parameters.
|
|
188
|
-
|
|
189
|
-
Returns
|
|
190
|
-
-------
|
|
191
|
-
Status
|
|
192
|
-
Status object.
|
|
193
|
-
"""
|
|
194
|
-
self._raise_if_entity_builder_not_found(kind_to_build_from)
|
|
195
|
-
return self._entity_builders[kind_to_build_from].build_status(**kwargs)
|
|
196
|
-
|
|
197
|
-
def build_runtime(self, kind_to_build_from: str, project: str) -> Runtime:
|
|
198
|
-
"""
|
|
199
|
-
Build a runtime.
|
|
200
|
-
|
|
201
|
-
Parameters
|
|
202
|
-
----------
|
|
203
|
-
kind_to_build_from : str
|
|
204
|
-
Runtime type.
|
|
205
|
-
project : str
|
|
206
|
-
Project name.
|
|
207
|
-
|
|
208
|
-
Returns
|
|
209
|
-
-------
|
|
210
|
-
Runtime
|
|
211
|
-
Runtime object.
|
|
212
|
-
"""
|
|
213
|
-
self._raise_if_runtime_builder_not_found(kind_to_build_from)
|
|
214
|
-
return self._runtime_builders[kind_to_build_from].build(project=project)
|
|
215
|
-
|
|
216
|
-
def get_entity_type_from_kind(self, kind: str) -> str:
|
|
217
|
-
"""
|
|
218
|
-
Get entity type from builder.
|
|
219
|
-
|
|
220
|
-
Parameters
|
|
221
|
-
----------
|
|
222
|
-
kind : str
|
|
223
|
-
Entity type.
|
|
224
|
-
|
|
225
|
-
Returns
|
|
226
|
-
-------
|
|
227
|
-
str
|
|
228
|
-
Entity type.
|
|
229
|
-
"""
|
|
230
|
-
self._raise_if_entity_builder_not_found(kind)
|
|
231
|
-
return self._entity_builders[kind].get_entity_type()
|
|
232
|
-
|
|
233
|
-
def get_executable_kind(self, kind: str) -> str:
|
|
234
|
-
"""
|
|
235
|
-
Get executable kind.
|
|
236
|
-
|
|
237
|
-
Parameters
|
|
238
|
-
----------
|
|
239
|
-
kind : str
|
|
240
|
-
Kind.
|
|
241
|
-
|
|
242
|
-
Returns
|
|
243
|
-
-------
|
|
244
|
-
str
|
|
245
|
-
Executable kind.
|
|
246
|
-
"""
|
|
247
|
-
self._raise_if_entity_builder_not_found(kind)
|
|
248
|
-
return self._entity_builders[kind].get_executable_kind()
|
|
249
|
-
|
|
250
|
-
def get_action_from_task_kind(self, kind: str, task_kind: str) -> str:
|
|
251
|
-
"""
|
|
252
|
-
Get action from task.
|
|
253
|
-
|
|
254
|
-
Parameters
|
|
255
|
-
----------
|
|
256
|
-
kind : str
|
|
257
|
-
Kind.
|
|
258
|
-
task_kind : str
|
|
259
|
-
Task kind.
|
|
260
|
-
|
|
261
|
-
Returns
|
|
262
|
-
-------
|
|
263
|
-
str
|
|
264
|
-
Action.
|
|
265
|
-
"""
|
|
266
|
-
self._raise_if_entity_builder_not_found(kind)
|
|
267
|
-
return self._entity_builders[kind].get_action_from_task_kind(task_kind)
|
|
268
|
-
|
|
269
|
-
def get_task_kind_from_action(self, kind: str, action: str) -> list[str]:
|
|
270
|
-
"""
|
|
271
|
-
Get task kinds from action.
|
|
272
|
-
|
|
273
|
-
Parameters
|
|
274
|
-
----------
|
|
275
|
-
kind : str
|
|
276
|
-
Kind.
|
|
277
|
-
action : str
|
|
278
|
-
Action.
|
|
279
|
-
|
|
280
|
-
Returns
|
|
281
|
-
-------
|
|
282
|
-
list of str
|
|
283
|
-
Task kinds.
|
|
284
|
-
"""
|
|
285
|
-
self._raise_if_entity_builder_not_found(kind)
|
|
286
|
-
return self._entity_builders[kind].get_task_kind_from_action(action)
|
|
287
|
-
|
|
288
|
-
def get_run_kind(self, kind: str) -> str:
|
|
289
|
-
"""
|
|
290
|
-
Get run kind.
|
|
291
|
-
|
|
292
|
-
Parameters
|
|
293
|
-
----------
|
|
294
|
-
kind : str
|
|
295
|
-
Kind.
|
|
296
|
-
|
|
297
|
-
Returns
|
|
298
|
-
-------
|
|
299
|
-
str
|
|
300
|
-
Run kind.
|
|
301
|
-
"""
|
|
302
|
-
self._raise_if_entity_builder_not_found(kind)
|
|
303
|
-
return self._entity_builders[kind].get_run_kind()
|
|
304
|
-
|
|
305
|
-
def get_all_kinds(self, kind: str) -> list[str]:
|
|
306
|
-
"""
|
|
307
|
-
Get all kinds.
|
|
308
|
-
|
|
309
|
-
Parameters
|
|
310
|
-
----------
|
|
311
|
-
kind : str
|
|
312
|
-
Kind.
|
|
313
|
-
|
|
314
|
-
Returns
|
|
315
|
-
-------
|
|
316
|
-
list of str
|
|
317
|
-
All kinds.
|
|
318
|
-
"""
|
|
319
|
-
return self._entity_builders[kind].get_all_kinds()
|
|
320
|
-
|
|
321
|
-
def get_spec_validator(self, kind: str) -> SpecValidator:
|
|
322
|
-
"""
|
|
323
|
-
Get spec validators.
|
|
324
|
-
|
|
325
|
-
Parameters
|
|
326
|
-
----------
|
|
327
|
-
kind : str
|
|
328
|
-
Kind.
|
|
329
|
-
|
|
330
|
-
Returns
|
|
331
|
-
-------
|
|
332
|
-
SpecValidator
|
|
333
|
-
Spec validator.
|
|
334
|
-
"""
|
|
335
|
-
self._raise_if_entity_builder_not_found(kind)
|
|
336
|
-
return self._entity_builders[kind].get_spec_validator()
|
|
337
|
-
|
|
338
|
-
def _raise_if_entity_builder_not_found(self, kind: str) -> None:
|
|
339
|
-
"""
|
|
340
|
-
Verify entity builder existence.
|
|
341
|
-
|
|
342
|
-
Parameters
|
|
343
|
-
----------
|
|
344
|
-
kind : str
|
|
345
|
-
The entity kind to verify.
|
|
346
|
-
|
|
347
|
-
Returns
|
|
348
|
-
-------
|
|
349
|
-
None
|
|
350
|
-
|
|
351
|
-
Raises
|
|
352
|
-
------
|
|
353
|
-
BuilderError
|
|
354
|
-
If no builder exists for the specified kind.
|
|
355
|
-
"""
|
|
356
|
-
if kind not in self._entity_builders:
|
|
357
|
-
raise BuilderError(f"Entity builder for kind '{kind}' not found.")
|
|
358
|
-
|
|
359
|
-
def _raise_if_runtime_builder_not_found(self, kind: str) -> None:
|
|
360
|
-
"""
|
|
361
|
-
Verify runtime builder existence.
|
|
362
|
-
|
|
363
|
-
Parameters
|
|
364
|
-
----------
|
|
365
|
-
kind : str
|
|
366
|
-
The runtime kind to verify.
|
|
367
|
-
|
|
368
|
-
Returns
|
|
369
|
-
-------
|
|
370
|
-
None
|
|
371
|
-
|
|
372
|
-
Raises
|
|
373
|
-
------
|
|
374
|
-
BuilderError
|
|
375
|
-
If no builder exists for the specified kind.
|
|
376
|
-
"""
|
|
377
|
-
if kind not in self._runtime_builders:
|
|
378
|
-
raise BuilderError(f"Runtime builder for kind '{kind}' not found.")
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
factory = Factory()
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: © 2025 DSLab - Fondazione Bruno Kessler
|
|
2
|
-
#
|
|
3
|
-
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
|
|
5
|
-
from __future__ import annotations
|
|
6
|
-
|
|
7
|
-
from pydantic import BaseModel
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class ClientConfig(BaseModel):
|
|
11
|
-
"""Client configuration model."""
|
|
12
|
-
|
|
13
|
-
endpoint: str
|
|
14
|
-
"""API endpoint."""
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class BasicAuth(ClientConfig):
|
|
18
|
-
"""Basic authentication model."""
|
|
19
|
-
|
|
20
|
-
user: str
|
|
21
|
-
"""Username."""
|
|
22
|
-
|
|
23
|
-
password: str
|
|
24
|
-
"""Basic authentication password."""
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class OAuth2TokenAuth(ClientConfig):
|
|
28
|
-
"""OAuth2 token authentication model."""
|
|
29
|
-
|
|
30
|
-
access_token: str
|
|
31
|
-
"""OAuth2 token."""
|
|
32
|
-
|
|
33
|
-
refresh_token: str
|
|
34
|
-
"""OAuth2 refresh token."""
|
|
35
|
-
|
|
36
|
-
client_id: str
|
|
37
|
-
"""OAuth2 client id."""
|
|
38
|
-
|
|
39
|
-
issuer_endpoint: str
|
|
40
|
-
"""OAuth2 issuer endpoint."""
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: © 2025 DSLab - Fondazione Bruno Kessler
|
|
2
|
-
#
|
|
3
|
-
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
|
|
5
|
-
from __future__ import annotations
|
|
6
|
-
|
|
7
|
-
from pathlib import Path
|
|
8
|
-
from urllib.parse import urlparse
|
|
9
|
-
|
|
10
|
-
from boto3 import client as boto3_client
|
|
11
|
-
|
|
12
|
-
from digitalhub.stores.credentials.enums import CredsOrigin
|
|
13
|
-
from digitalhub.stores.data.s3.configurator import S3StoreConfigurator
|
|
14
|
-
from digitalhub.utils.exceptions import StoreError
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def get_bucket_name(path: str) -> str:
|
|
18
|
-
"""
|
|
19
|
-
Extract the bucket name from an S3 path.
|
|
20
|
-
|
|
21
|
-
Parameters
|
|
22
|
-
----------
|
|
23
|
-
path : str
|
|
24
|
-
S3 URI (e.g., 's3://bucket/key').
|
|
25
|
-
|
|
26
|
-
Returns
|
|
27
|
-
-------
|
|
28
|
-
str
|
|
29
|
-
The bucket name extracted from the URI.
|
|
30
|
-
"""
|
|
31
|
-
return urlparse(path).netloc
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def get_bucket_and_key(path: str) -> tuple[str, str]:
|
|
35
|
-
"""
|
|
36
|
-
Extract the bucket name and key from an S3 path.
|
|
37
|
-
|
|
38
|
-
Parameters
|
|
39
|
-
----------
|
|
40
|
-
path : str
|
|
41
|
-
S3 URI (e.g., 's3://bucket/key').
|
|
42
|
-
|
|
43
|
-
Returns
|
|
44
|
-
-------
|
|
45
|
-
tuple of str
|
|
46
|
-
Tuple containing (bucket, key) extracted from the URI.
|
|
47
|
-
"""
|
|
48
|
-
parsed = urlparse(path)
|
|
49
|
-
return parsed.netloc, parsed.path
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
def get_s3_source(bucket: str, key: str, filename: Path) -> None:
|
|
53
|
-
"""
|
|
54
|
-
Download an object from S3 and save it to a local file.
|
|
55
|
-
|
|
56
|
-
Parameters
|
|
57
|
-
----------
|
|
58
|
-
bucket : str
|
|
59
|
-
S3 bucket name.
|
|
60
|
-
key : str
|
|
61
|
-
S3 object key.
|
|
62
|
-
filename : Path
|
|
63
|
-
Local path where the downloaded object will be saved.
|
|
64
|
-
|
|
65
|
-
Returns
|
|
66
|
-
-------
|
|
67
|
-
None
|
|
68
|
-
"""
|
|
69
|
-
# Try to get client from environment variables
|
|
70
|
-
try:
|
|
71
|
-
cfg = S3StoreConfigurator().get_boto3_client_config(CredsOrigin.ENV.value)
|
|
72
|
-
s3 = boto3_client("s3", **cfg)
|
|
73
|
-
s3.download_file(bucket, key, filename)
|
|
74
|
-
|
|
75
|
-
# Fallback to file
|
|
76
|
-
except StoreError:
|
|
77
|
-
cfg = S3StoreConfigurator().get_boto3_client_config(CredsOrigin.FILE.value)
|
|
78
|
-
s3.download_file(bucket, key, filename)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|