digitalhub 0.8.1__py3-none-any.whl → 0.9.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 +19 -2
- digitalhub/client/_base/api_builder.py +16 -0
- digitalhub/client/_base/client.py +67 -0
- digitalhub/client/_base/key_builder.py +52 -0
- digitalhub/client/api.py +2 -38
- digitalhub/client/dhcore/api_builder.py +100 -0
- digitalhub/client/dhcore/client.py +81 -25
- digitalhub/client/dhcore/enums.py +27 -0
- digitalhub/client/dhcore/env.py +2 -2
- digitalhub/client/dhcore/key_builder.py +58 -0
- digitalhub/client/dhcore/utils.py +17 -17
- digitalhub/client/local/api_builder.py +100 -0
- digitalhub/client/local/client.py +22 -0
- digitalhub/client/local/key_builder.py +58 -0
- digitalhub/context/api.py +3 -38
- digitalhub/context/builder.py +10 -23
- digitalhub/context/context.py +20 -92
- digitalhub/entities/_base/context/entity.py +30 -22
- digitalhub/entities/_base/entity/_constructors/metadata.py +12 -1
- digitalhub/entities/_base/entity/_constructors/name.py +1 -1
- digitalhub/entities/_base/entity/_constructors/spec.py +1 -1
- digitalhub/entities/_base/entity/_constructors/status.py +3 -2
- digitalhub/entities/_base/entity/builder.py +6 -1
- digitalhub/entities/_base/entity/entity.py +32 -10
- digitalhub/entities/_base/entity/metadata.py +22 -0
- digitalhub/entities/_base/entity/spec.py +7 -2
- digitalhub/entities/_base/executable/entity.py +8 -8
- digitalhub/entities/_base/material/entity.py +49 -17
- digitalhub/entities/_base/material/status.py +0 -31
- digitalhub/entities/_base/material/utils.py +106 -0
- digitalhub/entities/_base/project/entity.py +341 -0
- digitalhub/entities/_base/unversioned/entity.py +3 -24
- digitalhub/entities/_base/versioned/entity.py +2 -26
- digitalhub/entities/_commons/enums.py +103 -0
- digitalhub/entities/_commons/utils.py +83 -0
- digitalhub/entities/_operations/processor.py +1873 -0
- digitalhub/entities/artifact/_base/builder.py +1 -1
- digitalhub/entities/artifact/_base/entity.py +1 -1
- digitalhub/entities/artifact/artifact/builder.py +2 -1
- digitalhub/entities/artifact/crud.py +46 -29
- digitalhub/entities/artifact/utils.py +62 -0
- digitalhub/entities/dataitem/_base/builder.py +1 -1
- digitalhub/entities/dataitem/_base/entity.py +6 -6
- digitalhub/entities/dataitem/crud.py +50 -66
- digitalhub/entities/dataitem/dataitem/builder.py +2 -1
- digitalhub/entities/dataitem/iceberg/builder.py +2 -1
- digitalhub/entities/dataitem/table/builder.py +2 -1
- digitalhub/entities/dataitem/table/entity.py +5 -10
- digitalhub/entities/dataitem/table/models.py +4 -5
- digitalhub/entities/dataitem/utils.py +137 -0
- digitalhub/entities/function/_base/builder.py +1 -1
- digitalhub/entities/function/_base/entity.py +6 -2
- digitalhub/entities/function/crud.py +36 -17
- digitalhub/entities/model/_base/builder.py +1 -1
- digitalhub/entities/model/_base/entity.py +1 -1
- digitalhub/entities/model/crud.py +46 -29
- digitalhub/entities/model/huggingface/builder.py +2 -1
- digitalhub/entities/model/huggingface/spec.py +4 -2
- digitalhub/entities/model/mlflow/builder.py +2 -1
- digitalhub/entities/model/mlflow/models.py +17 -9
- digitalhub/entities/model/mlflow/spec.py +6 -1
- digitalhub/entities/model/mlflow/utils.py +4 -2
- digitalhub/entities/model/model/builder.py +2 -1
- digitalhub/entities/model/sklearn/builder.py +2 -1
- digitalhub/entities/model/utils.py +62 -0
- digitalhub/entities/project/_base/builder.py +2 -2
- digitalhub/entities/project/_base/entity.py +82 -272
- digitalhub/entities/project/crud.py +110 -91
- digitalhub/entities/project/utils.py +35 -0
- digitalhub/entities/run/_base/builder.py +3 -1
- digitalhub/entities/run/_base/entity.py +52 -54
- digitalhub/entities/run/_base/spec.py +15 -7
- digitalhub/entities/run/crud.py +35 -17
- digitalhub/entities/secret/_base/builder.py +2 -2
- digitalhub/entities/secret/_base/entity.py +4 -10
- digitalhub/entities/secret/crud.py +36 -21
- digitalhub/entities/task/_base/builder.py +14 -14
- digitalhub/entities/task/_base/entity.py +21 -14
- digitalhub/entities/task/_base/models.py +35 -6
- digitalhub/entities/task/_base/spec.py +50 -13
- digitalhub/entities/task/_base/utils.py +18 -0
- digitalhub/entities/task/crud.py +35 -15
- digitalhub/entities/workflow/_base/builder.py +1 -1
- digitalhub/entities/workflow/_base/entity.py +22 -6
- digitalhub/entities/workflow/crud.py +36 -17
- digitalhub/factory/utils.py +1 -1
- digitalhub/readers/_base/reader.py +2 -2
- digitalhub/readers/_commons/enums.py +13 -0
- digitalhub/readers/api.py +3 -2
- digitalhub/readers/factory.py +12 -6
- digitalhub/readers/pandas/reader.py +20 -8
- digitalhub/runtimes/_base.py +0 -7
- digitalhub/runtimes/enums.py +12 -0
- digitalhub/stores/_base/store.py +59 -11
- digitalhub/stores/builder.py +5 -5
- digitalhub/stores/local/store.py +43 -4
- digitalhub/stores/remote/store.py +31 -5
- digitalhub/stores/s3/store.py +129 -48
- digitalhub/stores/sql/store.py +122 -47
- digitalhub/utils/exceptions.py +6 -0
- digitalhub/utils/file_utils.py +60 -2
- digitalhub/utils/generic_utils.py +45 -4
- digitalhub/utils/io_utils.py +18 -0
- digitalhub/utils/s3_utils.py +17 -0
- digitalhub/utils/uri_utils.py +153 -15
- {digitalhub-0.8.1.dist-info → digitalhub-0.9.0.dist-info}/LICENSE.txt +1 -1
- {digitalhub-0.8.1.dist-info → digitalhub-0.9.0.dist-info}/METADATA +3 -3
- {digitalhub-0.8.1.dist-info → digitalhub-0.9.0.dist-info}/RECORD +116 -114
- test/local/instances/test_validate.py +55 -0
- test/testkfp.py +4 -1
- digitalhub/datastores/_base/datastore.py +0 -85
- digitalhub/datastores/api.py +0 -37
- digitalhub/datastores/builder.py +0 -110
- digitalhub/datastores/local/datastore.py +0 -50
- digitalhub/datastores/remote/__init__.py +0 -0
- digitalhub/datastores/remote/datastore.py +0 -31
- digitalhub/datastores/s3/__init__.py +0 -0
- digitalhub/datastores/s3/datastore.py +0 -46
- digitalhub/datastores/sql/__init__.py +0 -0
- digitalhub/datastores/sql/datastore.py +0 -68
- digitalhub/entities/_base/api_utils.py +0 -620
- digitalhub/entities/_base/crud.py +0 -468
- digitalhub/entities/function/_base/models.py +0 -118
- digitalhub/entities/utils/__init__.py +0 -0
- digitalhub/entities/utils/api.py +0 -346
- digitalhub/entities/utils/entity_types.py +0 -19
- digitalhub/entities/utils/state.py +0 -31
- digitalhub/entities/utils/utils.py +0 -202
- /digitalhub/{context → entities/_base/project}/__init__.py +0 -0
- /digitalhub/{datastores → entities/_commons}/__init__.py +0 -0
- /digitalhub/{datastores/_base → entities/_operations}/__init__.py +0 -0
- /digitalhub/{datastores/local → readers/_commons}/__init__.py +0 -0
- {digitalhub-0.8.1.dist-info → digitalhub-0.9.0.dist-info}/WHEEL +0 -0
- {digitalhub-0.8.1.dist-info → digitalhub-0.9.0.dist-info}/top_level.txt +0 -0
|
@@ -1,620 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import typing
|
|
4
|
-
|
|
5
|
-
from digitalhub.context.api import get_context
|
|
6
|
-
from digitalhub.entities.utils.api import (
|
|
7
|
-
api_base_create,
|
|
8
|
-
api_base_delete,
|
|
9
|
-
api_base_list,
|
|
10
|
-
api_base_read,
|
|
11
|
-
api_base_update,
|
|
12
|
-
api_ctx_create,
|
|
13
|
-
api_ctx_data,
|
|
14
|
-
api_ctx_delete,
|
|
15
|
-
api_ctx_files,
|
|
16
|
-
api_ctx_list,
|
|
17
|
-
api_ctx_logs,
|
|
18
|
-
api_ctx_read,
|
|
19
|
-
api_ctx_resume,
|
|
20
|
-
api_ctx_stop,
|
|
21
|
-
api_ctx_update,
|
|
22
|
-
)
|
|
23
|
-
from digitalhub.entities.utils.utils import parse_entity_key
|
|
24
|
-
|
|
25
|
-
if typing.TYPE_CHECKING:
|
|
26
|
-
from digitalhub.client._base.client import Client
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
##############################
|
|
30
|
-
# CRUD base entity
|
|
31
|
-
##############################
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def create_entity_api_base(
|
|
35
|
-
client: Client,
|
|
36
|
-
entity_type: str,
|
|
37
|
-
entity_dict: dict,
|
|
38
|
-
**kwargs,
|
|
39
|
-
) -> dict:
|
|
40
|
-
"""
|
|
41
|
-
Create object in backend.
|
|
42
|
-
|
|
43
|
-
Parameters
|
|
44
|
-
----------
|
|
45
|
-
client : Client
|
|
46
|
-
Client instance.
|
|
47
|
-
entity_type : str
|
|
48
|
-
Entity type.
|
|
49
|
-
entity_dict : dict
|
|
50
|
-
Object instance.
|
|
51
|
-
**kwargs : dict
|
|
52
|
-
Parameters to pass to the API call.
|
|
53
|
-
|
|
54
|
-
Returns
|
|
55
|
-
-------
|
|
56
|
-
dict
|
|
57
|
-
Object instance.
|
|
58
|
-
"""
|
|
59
|
-
api = api_base_create(entity_type)
|
|
60
|
-
return client.create_object(api, entity_dict, **kwargs)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
def read_entity_api_base(
|
|
64
|
-
client: Client,
|
|
65
|
-
entity_type: str,
|
|
66
|
-
entity_name: str,
|
|
67
|
-
**kwargs,
|
|
68
|
-
) -> dict:
|
|
69
|
-
"""
|
|
70
|
-
Read object from backend.
|
|
71
|
-
|
|
72
|
-
Parameters
|
|
73
|
-
----------
|
|
74
|
-
client : Client
|
|
75
|
-
Client instance.
|
|
76
|
-
entity_type : str
|
|
77
|
-
Entity type.
|
|
78
|
-
entity_name : str
|
|
79
|
-
Entity name.
|
|
80
|
-
**kwargs : dict
|
|
81
|
-
Parameters to pass to the API call.
|
|
82
|
-
|
|
83
|
-
Returns
|
|
84
|
-
-------
|
|
85
|
-
dict
|
|
86
|
-
Object instance.
|
|
87
|
-
"""
|
|
88
|
-
api = api_base_read(entity_type, entity_name)
|
|
89
|
-
return client.read_object(api, **kwargs)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
def list_entity_api_base(
|
|
93
|
-
client: Client,
|
|
94
|
-
entity_type: str,
|
|
95
|
-
**kwargs,
|
|
96
|
-
) -> list[dict]:
|
|
97
|
-
"""
|
|
98
|
-
List objects from backend.
|
|
99
|
-
|
|
100
|
-
Parameters
|
|
101
|
-
----------
|
|
102
|
-
entity_type : str
|
|
103
|
-
Entity type.
|
|
104
|
-
**kwargs : dict
|
|
105
|
-
Parameters to pass to the API call.
|
|
106
|
-
|
|
107
|
-
Returns
|
|
108
|
-
-------
|
|
109
|
-
list[dict]
|
|
110
|
-
List of objects.
|
|
111
|
-
"""
|
|
112
|
-
api = api_base_list(entity_type)
|
|
113
|
-
return client.list_objects(api, **kwargs)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
def update_entity_api_base(
|
|
117
|
-
client: Client,
|
|
118
|
-
entity_type: str,
|
|
119
|
-
entity_name: str,
|
|
120
|
-
entity_dict: dict,
|
|
121
|
-
**kwargs,
|
|
122
|
-
) -> dict:
|
|
123
|
-
"""
|
|
124
|
-
Update object. Note that object spec are immutable.
|
|
125
|
-
|
|
126
|
-
Parameters
|
|
127
|
-
----------
|
|
128
|
-
client : Client
|
|
129
|
-
Client instance.
|
|
130
|
-
entity_type : str
|
|
131
|
-
Entity type.
|
|
132
|
-
entity_name : str
|
|
133
|
-
Entity name.
|
|
134
|
-
entity_dict : dict
|
|
135
|
-
Object instance.
|
|
136
|
-
**kwargs : dict
|
|
137
|
-
Parameters to pass to the API call.
|
|
138
|
-
|
|
139
|
-
Returns
|
|
140
|
-
-------
|
|
141
|
-
dict
|
|
142
|
-
Object instance.
|
|
143
|
-
"""
|
|
144
|
-
api = api_base_update(entity_type, entity_name)
|
|
145
|
-
return client.update_object(api, entity_dict, **kwargs)
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
def delete_entity_api_base(
|
|
149
|
-
client: Client,
|
|
150
|
-
entity_type: str,
|
|
151
|
-
entity_name: str,
|
|
152
|
-
**kwargs,
|
|
153
|
-
) -> dict:
|
|
154
|
-
"""
|
|
155
|
-
Delete object from backend.
|
|
156
|
-
|
|
157
|
-
Parameters
|
|
158
|
-
----------
|
|
159
|
-
client : Client
|
|
160
|
-
Client instance.
|
|
161
|
-
entity_type : str
|
|
162
|
-
Entity type.
|
|
163
|
-
entity_name : str
|
|
164
|
-
Entity name.
|
|
165
|
-
**kwargs : dict
|
|
166
|
-
Parameters to pass to the API call.
|
|
167
|
-
|
|
168
|
-
Returns
|
|
169
|
-
-------
|
|
170
|
-
dict
|
|
171
|
-
Object instance.
|
|
172
|
-
"""
|
|
173
|
-
if "params" not in kwargs:
|
|
174
|
-
kwargs["params"] = {}
|
|
175
|
-
if "cascade" in kwargs["params"]:
|
|
176
|
-
kwargs["params"]["cascade"] = str(kwargs["cascade"]).lower()
|
|
177
|
-
if "cascade" in kwargs:
|
|
178
|
-
kwargs["params"]["cascade"] = str(kwargs.pop("cascade")).lower()
|
|
179
|
-
api = api_base_delete(entity_type, entity_name)
|
|
180
|
-
return client.delete_object(api, **kwargs)
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
##############################
|
|
184
|
-
# CRUD context entity
|
|
185
|
-
##############################
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
def create_entity_api_ctx(
|
|
189
|
-
project: str,
|
|
190
|
-
entity_type: str,
|
|
191
|
-
entity_dict: dict,
|
|
192
|
-
**kwargs,
|
|
193
|
-
) -> dict:
|
|
194
|
-
"""
|
|
195
|
-
Create object in backend.
|
|
196
|
-
|
|
197
|
-
Parameters
|
|
198
|
-
----------
|
|
199
|
-
project : str
|
|
200
|
-
Project name.
|
|
201
|
-
entity_type : str
|
|
202
|
-
Entity type.
|
|
203
|
-
entity_dict : dict
|
|
204
|
-
Object instance.
|
|
205
|
-
**kwargs : dict
|
|
206
|
-
Parameters to pass to the API call.
|
|
207
|
-
|
|
208
|
-
Returns
|
|
209
|
-
-------
|
|
210
|
-
dict
|
|
211
|
-
Object instance.
|
|
212
|
-
"""
|
|
213
|
-
api = api_ctx_create(project, entity_type)
|
|
214
|
-
return get_context(project).create_object(api, entity_dict, **kwargs)
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
def read_entity_api_ctx(
|
|
218
|
-
identifier: str,
|
|
219
|
-
entity_type: str | None = None,
|
|
220
|
-
project: str | None = None,
|
|
221
|
-
entity_id: str | None = None,
|
|
222
|
-
**kwargs,
|
|
223
|
-
) -> dict:
|
|
224
|
-
"""
|
|
225
|
-
Get object from backend.
|
|
226
|
-
|
|
227
|
-
Parameters
|
|
228
|
-
----------
|
|
229
|
-
identifier : str
|
|
230
|
-
Entity key (store://...) or entity name.
|
|
231
|
-
entity_type : str
|
|
232
|
-
Entity type.
|
|
233
|
-
project : str
|
|
234
|
-
Project name.
|
|
235
|
-
entity_id : str
|
|
236
|
-
Entity ID.
|
|
237
|
-
**kwargs : dict
|
|
238
|
-
Parameters to pass to the API call.
|
|
239
|
-
|
|
240
|
-
Returns
|
|
241
|
-
-------
|
|
242
|
-
dict
|
|
243
|
-
Object instance.
|
|
244
|
-
"""
|
|
245
|
-
|
|
246
|
-
if identifier.startswith("store://"):
|
|
247
|
-
project, entity_type, _, _, entity_id = parse_entity_key(identifier)
|
|
248
|
-
api = api_ctx_read(project, entity_type, entity_id)
|
|
249
|
-
return get_context(project).read_object(api, **kwargs)
|
|
250
|
-
|
|
251
|
-
if project is None or entity_type is None:
|
|
252
|
-
raise ValueError("Project and entity type must be specified.")
|
|
253
|
-
|
|
254
|
-
if "params" not in kwargs:
|
|
255
|
-
kwargs["params"] = {}
|
|
256
|
-
|
|
257
|
-
if entity_id is None:
|
|
258
|
-
kwargs["params"]["name"] = identifier
|
|
259
|
-
api = api_ctx_list(project, entity_type)
|
|
260
|
-
return get_context(project).list_first_object(api, **kwargs)
|
|
261
|
-
|
|
262
|
-
api = api_ctx_read(project, entity_type, entity_id)
|
|
263
|
-
return get_context(project).read_object(api, **kwargs)
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
def read_entity_api_ctx_versions(
|
|
267
|
-
identifier: str,
|
|
268
|
-
entity_type: str | None = None,
|
|
269
|
-
project: str | None = None,
|
|
270
|
-
**kwargs,
|
|
271
|
-
) -> list[dict]:
|
|
272
|
-
"""
|
|
273
|
-
Get all versions object from backend.
|
|
274
|
-
|
|
275
|
-
Parameters
|
|
276
|
-
----------
|
|
277
|
-
identifier : str
|
|
278
|
-
Entity key (store://...) or entity name.
|
|
279
|
-
entity_type : str
|
|
280
|
-
Entity type.
|
|
281
|
-
project : str
|
|
282
|
-
Project name.
|
|
283
|
-
**kwargs : dict
|
|
284
|
-
Parameters to pass to the API call.
|
|
285
|
-
|
|
286
|
-
Returns
|
|
287
|
-
-------
|
|
288
|
-
list[dict]
|
|
289
|
-
Object instances.
|
|
290
|
-
"""
|
|
291
|
-
if not identifier.startswith("store://"):
|
|
292
|
-
if project is None or entity_type is None:
|
|
293
|
-
raise ValueError("Project and entity type must be specified.")
|
|
294
|
-
entity_name = identifier
|
|
295
|
-
else:
|
|
296
|
-
project, entity_type, _, entity_name, _ = parse_entity_key(identifier)
|
|
297
|
-
|
|
298
|
-
if "params" not in kwargs:
|
|
299
|
-
kwargs["params"] = {}
|
|
300
|
-
kwargs["params"]["name"] = entity_name
|
|
301
|
-
kwargs["params"]["versions"] = "all"
|
|
302
|
-
|
|
303
|
-
api = api_ctx_list(project, entity_type)
|
|
304
|
-
return get_context(project).list_objects(api, **kwargs)
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
def list_entity_api_ctx(
|
|
308
|
-
project: str,
|
|
309
|
-
entity_type: str,
|
|
310
|
-
**kwargs,
|
|
311
|
-
) -> list[dict]:
|
|
312
|
-
"""
|
|
313
|
-
List objects from backend.
|
|
314
|
-
|
|
315
|
-
Parameters
|
|
316
|
-
----------
|
|
317
|
-
project : str
|
|
318
|
-
Project name.
|
|
319
|
-
entity_type : str
|
|
320
|
-
Entity type.
|
|
321
|
-
**kwargs : dict
|
|
322
|
-
Parameters to pass to the API call.
|
|
323
|
-
|
|
324
|
-
Returns
|
|
325
|
-
-------
|
|
326
|
-
list[dict]
|
|
327
|
-
List of objects.
|
|
328
|
-
"""
|
|
329
|
-
api = api_ctx_list(project, entity_type)
|
|
330
|
-
return get_context(project).list_objects(api, **kwargs)
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
def update_entity_api_ctx(
|
|
334
|
-
project: str,
|
|
335
|
-
entity_type: str,
|
|
336
|
-
entity_id: str,
|
|
337
|
-
entity_dict: dict,
|
|
338
|
-
**kwargs,
|
|
339
|
-
) -> dict:
|
|
340
|
-
"""
|
|
341
|
-
Update object. Note that object spec are immutable.
|
|
342
|
-
|
|
343
|
-
Parameters
|
|
344
|
-
----------
|
|
345
|
-
project : str
|
|
346
|
-
Project name.
|
|
347
|
-
entity_type : str
|
|
348
|
-
Entity type.
|
|
349
|
-
entity_id : str
|
|
350
|
-
Entity ID.
|
|
351
|
-
entity_dict : dict
|
|
352
|
-
Entity dictionary.
|
|
353
|
-
**kwargs : dict
|
|
354
|
-
Parameters to pass to the API call.
|
|
355
|
-
|
|
356
|
-
Returns
|
|
357
|
-
-------
|
|
358
|
-
dict
|
|
359
|
-
Response from backend.
|
|
360
|
-
"""
|
|
361
|
-
api = api_ctx_update(project, entity_type, entity_id=entity_id)
|
|
362
|
-
return get_context(project).update_object(api, entity_dict, **kwargs)
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
def delete_entity_api_ctx(
|
|
366
|
-
identifier: str,
|
|
367
|
-
entity_type: str,
|
|
368
|
-
project: str | None = None,
|
|
369
|
-
entity_id: str | None = None,
|
|
370
|
-
**kwargs,
|
|
371
|
-
) -> dict:
|
|
372
|
-
"""
|
|
373
|
-
Delete object from backend.
|
|
374
|
-
|
|
375
|
-
Parameters
|
|
376
|
-
----------
|
|
377
|
-
identifier : str
|
|
378
|
-
Entity key (store://...) or entity name.
|
|
379
|
-
entity_type : str
|
|
380
|
-
Entity type.
|
|
381
|
-
project : str
|
|
382
|
-
Project name.
|
|
383
|
-
entity_id : str
|
|
384
|
-
Entity ID.
|
|
385
|
-
**kwargs : dict
|
|
386
|
-
Parameters to pass to the API call.
|
|
387
|
-
|
|
388
|
-
Returns
|
|
389
|
-
-------
|
|
390
|
-
dict
|
|
391
|
-
Response from backend.
|
|
392
|
-
"""
|
|
393
|
-
if "params" not in kwargs:
|
|
394
|
-
kwargs["params"] = {}
|
|
395
|
-
if "cascade" in kwargs["params"]:
|
|
396
|
-
kwargs["params"]["cascade"] = str(kwargs["cascade"]).lower()
|
|
397
|
-
if "cascade" in kwargs:
|
|
398
|
-
kwargs["params"]["cascade"] = str(kwargs.pop("cascade")).lower()
|
|
399
|
-
|
|
400
|
-
delete_all_versions: bool = kwargs.pop("delete_all_versions", False)
|
|
401
|
-
|
|
402
|
-
if identifier.startswith("store://"):
|
|
403
|
-
project, _, _, _, entity_id = parse_entity_key(identifier)
|
|
404
|
-
api = api_ctx_delete(project, entity_type, entity_id)
|
|
405
|
-
return get_context(project).delete_object(api, **kwargs)
|
|
406
|
-
|
|
407
|
-
if project is None:
|
|
408
|
-
raise ValueError("Project must be provided.")
|
|
409
|
-
|
|
410
|
-
if entity_id is not None:
|
|
411
|
-
api = api_ctx_delete(project, entity_type, entity_id)
|
|
412
|
-
else:
|
|
413
|
-
kwargs["params"]["name"] = identifier
|
|
414
|
-
api = api_ctx_list(project, entity_type)
|
|
415
|
-
if delete_all_versions:
|
|
416
|
-
return get_context(project).delete_object(api, **kwargs)
|
|
417
|
-
obj = get_context(project).list_first_object(api, **kwargs)
|
|
418
|
-
entity_id = obj["id"]
|
|
419
|
-
|
|
420
|
-
api = api_ctx_delete(project, entity_type, entity_id)
|
|
421
|
-
return get_context(project).delete_object(api, **kwargs)
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
def set_data_api(
|
|
425
|
-
project: str,
|
|
426
|
-
entity_type: str,
|
|
427
|
-
data: dict,
|
|
428
|
-
**kwargs,
|
|
429
|
-
) -> None:
|
|
430
|
-
"""
|
|
431
|
-
Set data in backend.
|
|
432
|
-
|
|
433
|
-
Parameters
|
|
434
|
-
----------
|
|
435
|
-
project : str
|
|
436
|
-
Project name.
|
|
437
|
-
entity_type : str
|
|
438
|
-
Entity type.
|
|
439
|
-
data : dict
|
|
440
|
-
Data dictionary.
|
|
441
|
-
**kwargs : dict
|
|
442
|
-
Parameters to pass to the API call.
|
|
443
|
-
|
|
444
|
-
Returns
|
|
445
|
-
-------
|
|
446
|
-
None
|
|
447
|
-
"""
|
|
448
|
-
api = api_ctx_data(project, entity_type)
|
|
449
|
-
get_context(project).update_object(api, data, **kwargs)
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
def get_data_api(
|
|
453
|
-
project: str,
|
|
454
|
-
entity_type: str,
|
|
455
|
-
**kwargs,
|
|
456
|
-
) -> dict:
|
|
457
|
-
"""
|
|
458
|
-
Read data from backend.
|
|
459
|
-
|
|
460
|
-
Parameters
|
|
461
|
-
----------
|
|
462
|
-
project : str
|
|
463
|
-
Project name.
|
|
464
|
-
entity_type : str
|
|
465
|
-
Entity type.
|
|
466
|
-
**kwargs : dict
|
|
467
|
-
Parameters to pass to the API call.
|
|
468
|
-
|
|
469
|
-
Returns
|
|
470
|
-
-------
|
|
471
|
-
dict
|
|
472
|
-
Response from backend.
|
|
473
|
-
"""
|
|
474
|
-
api = api_ctx_data(project, entity_type)
|
|
475
|
-
return get_context(project).read_object(api, **kwargs)
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
def logs_api(
|
|
479
|
-
project: str,
|
|
480
|
-
entity_type: str,
|
|
481
|
-
entity_id: str,
|
|
482
|
-
**kwargs,
|
|
483
|
-
) -> dict:
|
|
484
|
-
"""
|
|
485
|
-
Read logs from backend.
|
|
486
|
-
|
|
487
|
-
Parameters
|
|
488
|
-
----------
|
|
489
|
-
project : str
|
|
490
|
-
Project name.
|
|
491
|
-
entity_type : str
|
|
492
|
-
Entity type.
|
|
493
|
-
entity_id : str
|
|
494
|
-
Entity ID.
|
|
495
|
-
**kwargs : dict
|
|
496
|
-
Parameters to pass to the API call.
|
|
497
|
-
|
|
498
|
-
Returns
|
|
499
|
-
-------
|
|
500
|
-
dict
|
|
501
|
-
Response from backend.
|
|
502
|
-
"""
|
|
503
|
-
api = api_ctx_logs(project, entity_type, entity_id)
|
|
504
|
-
return get_context(project).read_object(api, **kwargs)
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
def stop_api(
|
|
508
|
-
project: str,
|
|
509
|
-
entity_type: str,
|
|
510
|
-
entity_id: str,
|
|
511
|
-
**kwargs,
|
|
512
|
-
) -> None:
|
|
513
|
-
"""
|
|
514
|
-
Stop object in backend.
|
|
515
|
-
|
|
516
|
-
Parameters
|
|
517
|
-
----------
|
|
518
|
-
project : str
|
|
519
|
-
Project name.
|
|
520
|
-
entity_type : str
|
|
521
|
-
Entity type.
|
|
522
|
-
entity_id : str
|
|
523
|
-
Entity ID.
|
|
524
|
-
**kwargs : dict
|
|
525
|
-
Parameters to pass to the API call.
|
|
526
|
-
|
|
527
|
-
Returns
|
|
528
|
-
-------
|
|
529
|
-
None
|
|
530
|
-
"""
|
|
531
|
-
api = api_ctx_stop(project, entity_type, entity_id)
|
|
532
|
-
get_context(project).create_object(api, obj={}, **kwargs)
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
def resume_api(
|
|
536
|
-
project: str,
|
|
537
|
-
entity_type: str,
|
|
538
|
-
entity_id: str,
|
|
539
|
-
**kwargs,
|
|
540
|
-
) -> None:
|
|
541
|
-
"""
|
|
542
|
-
Resume object in backend.
|
|
543
|
-
|
|
544
|
-
Parameters
|
|
545
|
-
----------
|
|
546
|
-
project : str
|
|
547
|
-
Project name.
|
|
548
|
-
entity_type : str
|
|
549
|
-
Entity type.
|
|
550
|
-
entity_id : str
|
|
551
|
-
Entity ID.
|
|
552
|
-
**kwargs : dict
|
|
553
|
-
Parameters to pass to the API call.
|
|
554
|
-
|
|
555
|
-
Returns
|
|
556
|
-
-------
|
|
557
|
-
None
|
|
558
|
-
"""
|
|
559
|
-
api = api_ctx_resume(project, entity_type, entity_id)
|
|
560
|
-
get_context(project).create_object(api, obj={}, **kwargs)
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
def files_info_get_api(
|
|
564
|
-
project: str,
|
|
565
|
-
entity_type: str,
|
|
566
|
-
entity_id: str,
|
|
567
|
-
**kwargs,
|
|
568
|
-
) -> list[dict]:
|
|
569
|
-
"""
|
|
570
|
-
Get files info from backend.
|
|
571
|
-
|
|
572
|
-
Parameters
|
|
573
|
-
----------
|
|
574
|
-
project : str
|
|
575
|
-
Project name.
|
|
576
|
-
entity_type : str
|
|
577
|
-
Entity type.
|
|
578
|
-
entity_id : str
|
|
579
|
-
Entity ID.
|
|
580
|
-
**kwargs : dict
|
|
581
|
-
Parameters to pass to the API call.
|
|
582
|
-
|
|
583
|
-
Returns
|
|
584
|
-
-------
|
|
585
|
-
list[dict]
|
|
586
|
-
Response from backend.
|
|
587
|
-
"""
|
|
588
|
-
api = api_ctx_files(project, entity_type, entity_id)
|
|
589
|
-
return get_context(project).read_object(api, **kwargs)
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
def files_info_put_api(
|
|
593
|
-
project: str,
|
|
594
|
-
entity_type: str,
|
|
595
|
-
entity_id: str,
|
|
596
|
-
entity_list: list[dict],
|
|
597
|
-
**kwargs,
|
|
598
|
-
) -> None:
|
|
599
|
-
"""
|
|
600
|
-
Get files info from backend.
|
|
601
|
-
|
|
602
|
-
Parameters
|
|
603
|
-
----------
|
|
604
|
-
project : str
|
|
605
|
-
Project name.
|
|
606
|
-
entity_type : str
|
|
607
|
-
Entity type.
|
|
608
|
-
entity_id : str
|
|
609
|
-
Entity ID.
|
|
610
|
-
entity_list : list[dict]
|
|
611
|
-
Entity list.
|
|
612
|
-
**kwargs : dict
|
|
613
|
-
Parameters to pass to the API call.
|
|
614
|
-
|
|
615
|
-
Returns
|
|
616
|
-
-------
|
|
617
|
-
None
|
|
618
|
-
"""
|
|
619
|
-
api = api_ctx_files(project, entity_type, entity_id)
|
|
620
|
-
get_context(project).update_object(api, entity_list, **kwargs)
|