digitalhub 0.14.0b2__py3-none-any.whl → 0.14.0b3__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/context/builder.py +0 -4
- digitalhub/context/context.py +12 -8
- digitalhub/entities/_base/_base/entity.py +0 -4
- digitalhub/entities/_base/context/entity.py +1 -1
- digitalhub/entities/_base/entity/entity.py +0 -8
- digitalhub/entities/_base/executable/entity.py +5 -25
- digitalhub/entities/_base/material/entity.py +3 -23
- digitalhub/entities/_base/unversioned/entity.py +1 -1
- digitalhub/entities/_base/versioned/entity.py +1 -1
- digitalhub/entities/_processors/base/__init__.py +3 -0
- digitalhub/entities/_processors/{base.py → base/crud.py} +6 -226
- digitalhub/entities/_processors/base/import_export.py +122 -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 +654 -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/artifact/crud.py +8 -24
- digitalhub/entities/dataitem/crud.py +8 -24
- digitalhub/entities/dataitem/table/entity.py +2 -6
- digitalhub/entities/function/crud.py +8 -24
- digitalhub/entities/model/_base/entity.py +3 -23
- digitalhub/entities/model/crud.py +8 -22
- digitalhub/entities/project/_base/entity.py +40 -129
- digitalhub/entities/project/crud.py +7 -22
- digitalhub/entities/run/_base/builder.py +0 -4
- digitalhub/entities/run/_base/entity.py +3 -59
- digitalhub/entities/run/crud.py +7 -19
- digitalhub/entities/secret/_base/entity.py +1 -5
- digitalhub/entities/secret/crud.py +8 -22
- digitalhub/entities/task/_base/builder.py +0 -4
- digitalhub/entities/task/_base/entity.py +1 -1
- digitalhub/entities/task/crud.py +7 -19
- digitalhub/entities/trigger/_base/entity.py +1 -5
- digitalhub/entities/trigger/crud.py +8 -24
- digitalhub/entities/workflow/crud.py +8 -24
- digitalhub/factory/registry.py +0 -24
- digitalhub/stores/client/dhcore/client.py +0 -18
- digitalhub/stores/client/dhcore/configurator.py +5 -28
- digitalhub/stores/client/dhcore/error_parser.py +0 -4
- digitalhub/stores/credentials/configurator.py +0 -24
- digitalhub/stores/credentials/handler.py +0 -12
- digitalhub/stores/credentials/store.py +0 -4
- digitalhub/stores/data/_base/store.py +0 -16
- digitalhub/stores/data/builder.py +0 -4
- digitalhub/stores/data/remote/store.py +0 -4
- digitalhub/stores/data/s3/configurator.py +0 -8
- digitalhub/stores/data/s3/store.py +0 -12
- digitalhub/stores/data/sql/configurator.py +0 -8
- digitalhub/stores/data/sql/store.py +0 -4
- digitalhub/stores/readers/data/factory.py +0 -8
- digitalhub/stores/readers/data/pandas/reader.py +0 -16
- digitalhub/utils/io_utils.py +0 -4
- {digitalhub-0.14.0b2.dist-info → digitalhub-0.14.0b3.dist-info}/METADATA +1 -1
- {digitalhub-0.14.0b2.dist-info → digitalhub-0.14.0b3.dist-info}/RECORD +62 -52
- digitalhub/entities/_processors/context.py +0 -1499
- {digitalhub-0.14.0b2.dist-info → digitalhub-0.14.0b3.dist-info}/WHEEL +0 -0
- {digitalhub-0.14.0b2.dist-info → digitalhub-0.14.0b3.dist-info}/licenses/AUTHORS +0 -0
- {digitalhub-0.14.0b2.dist-info → digitalhub-0.14.0b3.dist-info}/licenses/LICENSE +0 -0
|
@@ -7,8 +7,7 @@ from __future__ import annotations
|
|
|
7
7
|
import typing
|
|
8
8
|
|
|
9
9
|
from digitalhub.entities._commons.enums import EntityTypes
|
|
10
|
-
from digitalhub.entities._processors.
|
|
11
|
-
from digitalhub.entities._processors.context import context_processor
|
|
10
|
+
from digitalhub.entities._processors.processors import base_processor, context_processor
|
|
12
11
|
from digitalhub.entities.project.utils import setup_project
|
|
13
12
|
from digitalhub.utils.exceptions import BackendError
|
|
14
13
|
|
|
@@ -59,9 +58,7 @@ def new_project(
|
|
|
59
58
|
|
|
60
59
|
Examples
|
|
61
60
|
--------
|
|
62
|
-
>>> obj = new_project(
|
|
63
|
-
... "my-project"
|
|
64
|
-
... )
|
|
61
|
+
>>> obj = new_project("my-project")
|
|
65
62
|
"""
|
|
66
63
|
if context is None:
|
|
67
64
|
context = "./"
|
|
@@ -105,9 +102,7 @@ def get_project(
|
|
|
105
102
|
|
|
106
103
|
Examples
|
|
107
104
|
--------
|
|
108
|
-
>>> obj = get_project(
|
|
109
|
-
... "my-project"
|
|
110
|
-
... )
|
|
105
|
+
>>> obj = get_project("my-project")
|
|
111
106
|
"""
|
|
112
107
|
obj = base_processor.read_project_entity(
|
|
113
108
|
entity_type=ENTITY_TYPE,
|
|
@@ -145,9 +140,7 @@ def import_project(
|
|
|
145
140
|
|
|
146
141
|
Examples
|
|
147
142
|
--------
|
|
148
|
-
>>> obj = import_project(
|
|
149
|
-
... "my-project.yaml"
|
|
150
|
-
... )
|
|
143
|
+
>>> obj = import_project("my-project.yaml")
|
|
151
144
|
"""
|
|
152
145
|
obj = base_processor.import_project_entity(
|
|
153
146
|
file=file,
|
|
@@ -181,9 +174,7 @@ def load_project(
|
|
|
181
174
|
|
|
182
175
|
Examples
|
|
183
176
|
--------
|
|
184
|
-
>>> obj = load_project(
|
|
185
|
-
... "my-project.yaml"
|
|
186
|
-
... )
|
|
177
|
+
>>> obj = load_project("my-project.yaml")
|
|
187
178
|
"""
|
|
188
179
|
obj = base_processor.load_project_entity(file=file, local=local)
|
|
189
180
|
return setup_project(obj, setup_kwargs)
|
|
@@ -275,11 +266,7 @@ def update_project(entity: Project, **kwargs) -> Project:
|
|
|
275
266
|
|
|
276
267
|
Examples
|
|
277
268
|
--------
|
|
278
|
-
>>> obj = (
|
|
279
|
-
... update_project(
|
|
280
|
-
... obj
|
|
281
|
-
... )
|
|
282
|
-
... )
|
|
269
|
+
>>> obj = update_project(obj)
|
|
283
270
|
"""
|
|
284
271
|
return base_processor.update_project_entity(
|
|
285
272
|
entity_type=entity.ENTITY_TYPE,
|
|
@@ -320,9 +307,7 @@ def delete_project(
|
|
|
320
307
|
|
|
321
308
|
Examples
|
|
322
309
|
--------
|
|
323
|
-
>>> delete_project(
|
|
324
|
-
... "my-project"
|
|
325
|
-
... )
|
|
310
|
+
>>> delete_project("my-project")
|
|
326
311
|
"""
|
|
327
312
|
return base_processor.delete_project_entity(
|
|
328
313
|
entity_type=ENTITY_TYPE,
|
|
@@ -10,7 +10,7 @@ import typing
|
|
|
10
10
|
from digitalhub.entities._base.unversioned.entity import UnversionedEntity
|
|
11
11
|
from digitalhub.entities._commons.enums import EntityTypes, State
|
|
12
12
|
from digitalhub.entities._commons.metrics import MetricType, set_metrics, validate_metric_value
|
|
13
|
-
from digitalhub.entities._processors.
|
|
13
|
+
from digitalhub.entities._processors.processors import context_processor
|
|
14
14
|
from digitalhub.factory.entity import entity_factory
|
|
15
15
|
from digitalhub.factory.runtime import runtime_factory
|
|
16
16
|
from digitalhub.utils.exceptions import EntityError
|
|
@@ -52,10 +52,6 @@ class Run(UnversionedEntity):
|
|
|
52
52
|
def build(self) -> None:
|
|
53
53
|
"""
|
|
54
54
|
Build run.
|
|
55
|
-
|
|
56
|
-
Returns
|
|
57
|
-
-------
|
|
58
|
-
None
|
|
59
55
|
"""
|
|
60
56
|
executable = self._get_executable()
|
|
61
57
|
task = self._get_task()
|
|
@@ -142,10 +138,6 @@ class Run(UnversionedEntity):
|
|
|
142
138
|
def stop(self) -> None:
|
|
143
139
|
"""
|
|
144
140
|
Stop run.
|
|
145
|
-
|
|
146
|
-
Returns
|
|
147
|
-
-------
|
|
148
|
-
None
|
|
149
141
|
"""
|
|
150
142
|
if not self.spec.local_execution:
|
|
151
143
|
return context_processor.stop_entity(self.project, self.ENTITY_TYPE, self.id)
|
|
@@ -153,10 +145,6 @@ class Run(UnversionedEntity):
|
|
|
153
145
|
def resume(self) -> None:
|
|
154
146
|
"""
|
|
155
147
|
Resume run.
|
|
156
|
-
|
|
157
|
-
Returns
|
|
158
|
-
-------
|
|
159
|
-
None
|
|
160
148
|
"""
|
|
161
149
|
if not self.spec.local_execution:
|
|
162
150
|
return context_processor.resume_entity(self.project, self.ENTITY_TYPE, self.id)
|
|
@@ -185,21 +173,13 @@ class Run(UnversionedEntity):
|
|
|
185
173
|
single_value : bool
|
|
186
174
|
If True, value is a single value.
|
|
187
175
|
|
|
188
|
-
Returns
|
|
189
|
-
-------
|
|
190
|
-
None
|
|
191
|
-
|
|
192
176
|
Examples
|
|
193
177
|
--------
|
|
194
178
|
Log a new value in a list
|
|
195
|
-
>>> entity.log_metric(
|
|
196
|
-
... "loss", 0.002
|
|
197
|
-
... )
|
|
179
|
+
>>> entity.log_metric("loss", 0.002)
|
|
198
180
|
|
|
199
181
|
Append a new value in a list
|
|
200
|
-
>>> entity.log_metric(
|
|
201
|
-
... "loss", 0.0019
|
|
202
|
-
... )
|
|
182
|
+
>>> entity.log_metric("loss", 0.0019)
|
|
203
183
|
|
|
204
184
|
Log a list of values and append them to existing metric:
|
|
205
185
|
>>> entity.log_metric(
|
|
@@ -243,10 +223,6 @@ class Run(UnversionedEntity):
|
|
|
243
223
|
overwrite : bool
|
|
244
224
|
If True, overwrite existing metrics.
|
|
245
225
|
|
|
246
|
-
Returns
|
|
247
|
-
-------
|
|
248
|
-
None
|
|
249
|
-
|
|
250
226
|
Examples
|
|
251
227
|
--------
|
|
252
228
|
Log multiple metrics at once
|
|
@@ -308,19 +284,11 @@ class Run(UnversionedEntity):
|
|
|
308
284
|
def _setup_execution(self) -> None:
|
|
309
285
|
"""
|
|
310
286
|
Setup run execution.
|
|
311
|
-
|
|
312
|
-
Returns
|
|
313
|
-
-------
|
|
314
|
-
None
|
|
315
287
|
"""
|
|
316
288
|
|
|
317
289
|
def _start_execution(self) -> None:
|
|
318
290
|
"""
|
|
319
291
|
Start run execution.
|
|
320
|
-
|
|
321
|
-
Returns
|
|
322
|
-
-------
|
|
323
|
-
None
|
|
324
292
|
"""
|
|
325
293
|
self._context().set_run(f"{self.key}:{self.id}")
|
|
326
294
|
if self.spec.local_execution:
|
|
@@ -332,10 +300,6 @@ class Run(UnversionedEntity):
|
|
|
332
300
|
def _finish_execution(self) -> None:
|
|
333
301
|
"""
|
|
334
302
|
Finish run execution.
|
|
335
|
-
|
|
336
|
-
Returns
|
|
337
|
-
-------
|
|
338
|
-
None
|
|
339
303
|
"""
|
|
340
304
|
self._context().unset_run()
|
|
341
305
|
|
|
@@ -358,10 +322,6 @@ class Run(UnversionedEntity):
|
|
|
358
322
|
----------
|
|
359
323
|
status : dict
|
|
360
324
|
Status to set.
|
|
361
|
-
|
|
362
|
-
Returns
|
|
363
|
-
-------
|
|
364
|
-
None
|
|
365
325
|
"""
|
|
366
326
|
self.status: RunStatus = entity_factory.build_status(self.kind, **status)
|
|
367
327
|
|
|
@@ -373,10 +333,6 @@ class Run(UnversionedEntity):
|
|
|
373
333
|
----------
|
|
374
334
|
state : str
|
|
375
335
|
State to set.
|
|
376
|
-
|
|
377
|
-
Returns
|
|
378
|
-
-------
|
|
379
|
-
None
|
|
380
336
|
"""
|
|
381
337
|
self.status.state = state
|
|
382
338
|
|
|
@@ -388,10 +344,6 @@ class Run(UnversionedEntity):
|
|
|
388
344
|
----------
|
|
389
345
|
message : str
|
|
390
346
|
Message to set.
|
|
391
|
-
|
|
392
|
-
Returns
|
|
393
|
-
-------
|
|
394
|
-
None
|
|
395
347
|
"""
|
|
396
348
|
self.status.message = message
|
|
397
349
|
|
|
@@ -447,10 +399,6 @@ class Run(UnversionedEntity):
|
|
|
447
399
|
def _get_metrics(self) -> None:
|
|
448
400
|
"""
|
|
449
401
|
Get model metrics from backend.
|
|
450
|
-
|
|
451
|
-
Returns
|
|
452
|
-
-------
|
|
453
|
-
None
|
|
454
402
|
"""
|
|
455
403
|
self.status.metrics = context_processor.read_metrics(
|
|
456
404
|
project=self.project,
|
|
@@ -478,10 +426,6 @@ class Run(UnversionedEntity):
|
|
|
478
426
|
If True, overwrite existing metric.
|
|
479
427
|
single_value : bool
|
|
480
428
|
If True, value is a single value.
|
|
481
|
-
|
|
482
|
-
Returns
|
|
483
|
-
-------
|
|
484
|
-
None
|
|
485
429
|
"""
|
|
486
430
|
value = validate_metric_value(value)
|
|
487
431
|
self.status.metrics = set_metrics(
|
digitalhub/entities/run/crud.py
CHANGED
|
@@ -8,7 +8,7 @@ import typing
|
|
|
8
8
|
|
|
9
9
|
from digitalhub.entities._commons.enums import EntityTypes
|
|
10
10
|
from digitalhub.entities._commons.utils import is_valid_key
|
|
11
|
-
from digitalhub.entities._processors.
|
|
11
|
+
from digitalhub.entities._processors.processors import context_processor
|
|
12
12
|
from digitalhub.utils.exceptions import EntityError
|
|
13
13
|
|
|
14
14
|
if typing.TYPE_CHECKING:
|
|
@@ -94,9 +94,7 @@ def get_run(
|
|
|
94
94
|
Examples
|
|
95
95
|
--------
|
|
96
96
|
Using entity key:
|
|
97
|
-
>>> obj = get_run(
|
|
98
|
-
... "store://my-run-key"
|
|
99
|
-
... )
|
|
97
|
+
>>> obj = get_run("store://my-run-key")
|
|
100
98
|
|
|
101
99
|
Using entity ID:
|
|
102
100
|
>>> obj = get_run("my-run-id"
|
|
@@ -128,9 +126,7 @@ def list_runs(project: str, **kwargs) -> list[Run]:
|
|
|
128
126
|
|
|
129
127
|
Examples
|
|
130
128
|
--------
|
|
131
|
-
>>> objs = list_runs(
|
|
132
|
-
... project="my-project"
|
|
133
|
-
... )
|
|
129
|
+
>>> objs = list_runs(project="my-project")
|
|
134
130
|
"""
|
|
135
131
|
# TODO more examples: search by function, latest for task and function
|
|
136
132
|
return context_processor.list_context_entities(
|
|
@@ -167,9 +163,7 @@ def import_run(
|
|
|
167
163
|
|
|
168
164
|
Example
|
|
169
165
|
-------
|
|
170
|
-
>>> obj = import_run(
|
|
171
|
-
... "my-run.yaml"
|
|
172
|
-
... )
|
|
166
|
+
>>> obj = import_run("my-run.yaml")
|
|
173
167
|
"""
|
|
174
168
|
return context_processor.import_context_entity(
|
|
175
169
|
file,
|
|
@@ -195,9 +189,7 @@ def load_run(file: str) -> Run:
|
|
|
195
189
|
|
|
196
190
|
Examples
|
|
197
191
|
--------
|
|
198
|
-
>>> obj = load_run(
|
|
199
|
-
... "my-run.yaml"
|
|
200
|
-
... )
|
|
192
|
+
>>> obj = load_run("my-run.yaml")
|
|
201
193
|
"""
|
|
202
194
|
return context_processor.load_context_entity(file)
|
|
203
195
|
|
|
@@ -218,9 +210,7 @@ def update_run(entity: Run) -> Run:
|
|
|
218
210
|
|
|
219
211
|
Examples
|
|
220
212
|
--------
|
|
221
|
-
>>> obj = update_run(
|
|
222
|
-
... obj
|
|
223
|
-
... )
|
|
213
|
+
>>> obj = update_run(obj)
|
|
224
214
|
"""
|
|
225
215
|
return context_processor.update_context_entity(
|
|
226
216
|
project=entity.project,
|
|
@@ -254,9 +244,7 @@ def delete_run(
|
|
|
254
244
|
|
|
255
245
|
Examples
|
|
256
246
|
--------
|
|
257
|
-
>>> obj = delete_run(
|
|
258
|
-
... "store://my-run-key"
|
|
259
|
-
... )
|
|
247
|
+
>>> obj = delete_run("store://my-run-key")
|
|
260
248
|
>>> obj = delete_run(
|
|
261
249
|
... "my-run-id",
|
|
262
250
|
... project="my-project",
|
|
@@ -8,7 +8,7 @@ import typing
|
|
|
8
8
|
|
|
9
9
|
from digitalhub.entities._base.versioned.entity import VersionedEntity
|
|
10
10
|
from digitalhub.entities._commons.enums import EntityTypes
|
|
11
|
-
from digitalhub.entities._processors.
|
|
11
|
+
from digitalhub.entities._processors.processors import context_processor
|
|
12
12
|
|
|
13
13
|
if typing.TYPE_CHECKING:
|
|
14
14
|
from digitalhub.entities._base.entity.metadata import Metadata
|
|
@@ -50,10 +50,6 @@ class Secret(VersionedEntity):
|
|
|
50
50
|
----------
|
|
51
51
|
value : str
|
|
52
52
|
Value of the secret.
|
|
53
|
-
|
|
54
|
-
Returns
|
|
55
|
-
-------
|
|
56
|
-
None
|
|
57
53
|
"""
|
|
58
54
|
obj = {self.name: value}
|
|
59
55
|
context_processor.update_secret_data(self.project, self.ENTITY_TYPE, obj)
|
|
@@ -8,7 +8,7 @@ import typing
|
|
|
8
8
|
|
|
9
9
|
from digitalhub.entities._commons.enums import EntityTypes
|
|
10
10
|
from digitalhub.entities._commons.utils import is_valid_key
|
|
11
|
-
from digitalhub.entities._processors.
|
|
11
|
+
from digitalhub.entities._processors.processors import context_processor
|
|
12
12
|
from digitalhub.utils.exceptions import EntityNotExistsError
|
|
13
13
|
|
|
14
14
|
if typing.TYPE_CHECKING:
|
|
@@ -105,9 +105,7 @@ def get_secret(
|
|
|
105
105
|
Examples
|
|
106
106
|
--------
|
|
107
107
|
Using entity key:
|
|
108
|
-
>>> obj = get_secret(
|
|
109
|
-
... "store://my-secret-key"
|
|
110
|
-
... )
|
|
108
|
+
>>> obj = get_secret("store://my-secret-key")
|
|
111
109
|
|
|
112
110
|
Using entity name:
|
|
113
111
|
>>> obj = get_secret("my-secret-name"
|
|
@@ -157,9 +155,7 @@ def get_secret_versions(
|
|
|
157
155
|
Examples
|
|
158
156
|
--------
|
|
159
157
|
Using entity key:
|
|
160
|
-
>>> objs = get_secret_versions(
|
|
161
|
-
... "store://my-secret-key"
|
|
162
|
-
... )
|
|
158
|
+
>>> objs = get_secret_versions("store://my-secret-key")
|
|
163
159
|
|
|
164
160
|
Using entity name:
|
|
165
161
|
>>> objs = get_secret_versions("my-secret-name",
|
|
@@ -191,9 +187,7 @@ def list_secrets(project: str, **kwargs) -> list[Secret]:
|
|
|
191
187
|
|
|
192
188
|
Examples
|
|
193
189
|
--------
|
|
194
|
-
>>> objs = list_secrets(
|
|
195
|
-
... project="my-project"
|
|
196
|
-
... )
|
|
190
|
+
>>> objs = list_secrets(project="my-project")
|
|
197
191
|
"""
|
|
198
192
|
return context_processor.list_context_entities(
|
|
199
193
|
project=project,
|
|
@@ -229,9 +223,7 @@ def import_secret(
|
|
|
229
223
|
|
|
230
224
|
Examples
|
|
231
225
|
--------
|
|
232
|
-
>>> obj = import_secret(
|
|
233
|
-
... "my-secret.yaml"
|
|
234
|
-
... )
|
|
226
|
+
>>> obj = import_secret("my-secret.yaml")
|
|
235
227
|
"""
|
|
236
228
|
return context_processor.import_context_entity(
|
|
237
229
|
file,
|
|
@@ -257,9 +249,7 @@ def load_secret(file: str) -> Secret:
|
|
|
257
249
|
|
|
258
250
|
Examples
|
|
259
251
|
--------
|
|
260
|
-
>>> obj = load_secret(
|
|
261
|
-
... "my-secret.yaml"
|
|
262
|
-
... )
|
|
252
|
+
>>> obj = load_secret("my-secret.yaml")
|
|
263
253
|
"""
|
|
264
254
|
return context_processor.load_context_entity(file)
|
|
265
255
|
|
|
@@ -280,9 +270,7 @@ def update_secret(entity: Secret) -> Secret:
|
|
|
280
270
|
|
|
281
271
|
Examples
|
|
282
272
|
--------
|
|
283
|
-
>>> obj = update_secret(
|
|
284
|
-
... obj
|
|
285
|
-
... )
|
|
273
|
+
>>> obj = update_secret(obj)
|
|
286
274
|
"""
|
|
287
275
|
return context_processor.update_context_entity(
|
|
288
276
|
project=entity.project,
|
|
@@ -323,9 +311,7 @@ def delete_secret(
|
|
|
323
311
|
Examples
|
|
324
312
|
--------
|
|
325
313
|
If delete_all_versions is False:
|
|
326
|
-
>>> obj = delete_secret(
|
|
327
|
-
... "store://my-secret-key"
|
|
328
|
-
... )
|
|
314
|
+
>>> obj = delete_secret("store://my-secret-key")
|
|
329
315
|
|
|
330
316
|
Otherwise:
|
|
331
317
|
>>> obj = delete_secret("my-secret-name"
|
|
@@ -8,7 +8,7 @@ import typing
|
|
|
8
8
|
|
|
9
9
|
from digitalhub.entities._base.unversioned.entity import UnversionedEntity
|
|
10
10
|
from digitalhub.entities._commons.enums import EntityTypes
|
|
11
|
-
from digitalhub.entities._processors.
|
|
11
|
+
from digitalhub.entities._processors.processors import context_processor
|
|
12
12
|
from digitalhub.factory.entity import entity_factory
|
|
13
13
|
|
|
14
14
|
if typing.TYPE_CHECKING:
|
digitalhub/entities/task/crud.py
CHANGED
|
@@ -8,7 +8,7 @@ import typing
|
|
|
8
8
|
|
|
9
9
|
from digitalhub.entities._commons.enums import EntityTypes
|
|
10
10
|
from digitalhub.entities._commons.utils import is_valid_key
|
|
11
|
-
from digitalhub.entities._processors.
|
|
11
|
+
from digitalhub.entities._processors.processors import context_processor
|
|
12
12
|
from digitalhub.utils.exceptions import EntityError
|
|
13
13
|
|
|
14
14
|
if typing.TYPE_CHECKING:
|
|
@@ -94,9 +94,7 @@ def get_task(
|
|
|
94
94
|
Examples
|
|
95
95
|
--------
|
|
96
96
|
Using entity key:
|
|
97
|
-
>>> obj = get_task(
|
|
98
|
-
... "store://my-task-key"
|
|
99
|
-
... )
|
|
97
|
+
>>> obj = get_task("store://my-task-key")
|
|
100
98
|
|
|
101
99
|
Using entity ID:
|
|
102
100
|
>>> obj = get_task("my-task-id"
|
|
@@ -128,9 +126,7 @@ def list_tasks(project: str, **kwargs) -> list[Task]:
|
|
|
128
126
|
|
|
129
127
|
Examples
|
|
130
128
|
--------
|
|
131
|
-
>>> objs = list_tasks(
|
|
132
|
-
... project="my-project"
|
|
133
|
-
... )
|
|
129
|
+
>>> objs = list_tasks(project="my-project")
|
|
134
130
|
"""
|
|
135
131
|
return context_processor.list_context_entities(
|
|
136
132
|
project=project,
|
|
@@ -166,9 +162,7 @@ def import_task(
|
|
|
166
162
|
|
|
167
163
|
Example
|
|
168
164
|
-------
|
|
169
|
-
>>> obj = import_task(
|
|
170
|
-
... "my-task.yaml"
|
|
171
|
-
... )
|
|
165
|
+
>>> obj = import_task("my-task.yaml")
|
|
172
166
|
"""
|
|
173
167
|
return context_processor.import_context_entity(
|
|
174
168
|
file,
|
|
@@ -194,9 +188,7 @@ def load_task(file: str) -> Task:
|
|
|
194
188
|
|
|
195
189
|
Examples
|
|
196
190
|
--------
|
|
197
|
-
>>> obj = load_task(
|
|
198
|
-
... "my-task.yaml"
|
|
199
|
-
... )
|
|
191
|
+
>>> obj = load_task("my-task.yaml")
|
|
200
192
|
"""
|
|
201
193
|
return context_processor.load_context_entity(file)
|
|
202
194
|
|
|
@@ -217,9 +209,7 @@ def update_task(entity: Task) -> Task:
|
|
|
217
209
|
|
|
218
210
|
Examples
|
|
219
211
|
--------
|
|
220
|
-
>>> obj = update_task(
|
|
221
|
-
... obj
|
|
222
|
-
... )
|
|
212
|
+
>>> obj = update_task(obj)
|
|
223
213
|
"""
|
|
224
214
|
return context_processor.update_context_entity(
|
|
225
215
|
project=entity.project,
|
|
@@ -263,9 +253,7 @@ def delete_task(
|
|
|
263
253
|
Examples
|
|
264
254
|
--------
|
|
265
255
|
If delete_all_versions is False:
|
|
266
|
-
>>> obj = delete_task(
|
|
267
|
-
... "store://my-task-key"
|
|
268
|
-
... )
|
|
256
|
+
>>> obj = delete_task("store://my-task-key")
|
|
269
257
|
|
|
270
258
|
Otherwise:
|
|
271
259
|
>>> obj = delete_task("task-name",
|
|
@@ -8,7 +8,7 @@ import typing
|
|
|
8
8
|
|
|
9
9
|
from digitalhub.entities._base.versioned.entity import VersionedEntity
|
|
10
10
|
from digitalhub.entities._commons.enums import EntityTypes
|
|
11
|
-
from digitalhub.entities._processors.
|
|
11
|
+
from digitalhub.entities._processors.processors import context_processor
|
|
12
12
|
|
|
13
13
|
if typing.TYPE_CHECKING:
|
|
14
14
|
from digitalhub.entities._base.entity.metadata import Metadata
|
|
@@ -41,9 +41,5 @@ class Trigger(VersionedEntity):
|
|
|
41
41
|
def stop(self) -> None:
|
|
42
42
|
"""
|
|
43
43
|
Stop trigger.
|
|
44
|
-
|
|
45
|
-
Returns
|
|
46
|
-
-------
|
|
47
|
-
None
|
|
48
44
|
"""
|
|
49
45
|
return context_processor.stop_entity(self.project, self.ENTITY_TYPE, self.id)
|
|
@@ -7,7 +7,7 @@ from __future__ import annotations
|
|
|
7
7
|
import typing
|
|
8
8
|
|
|
9
9
|
from digitalhub.entities._commons.enums import EntityTypes
|
|
10
|
-
from digitalhub.entities._processors.
|
|
10
|
+
from digitalhub.entities._processors.processors import context_processor
|
|
11
11
|
|
|
12
12
|
if typing.TYPE_CHECKING:
|
|
13
13
|
from digitalhub.entities.trigger._base.entity import Trigger
|
|
@@ -115,9 +115,7 @@ def get_trigger(
|
|
|
115
115
|
Examples
|
|
116
116
|
--------
|
|
117
117
|
Using entity key:
|
|
118
|
-
>>> obj = get_trigger(
|
|
119
|
-
... "store://my-trigger-key"
|
|
120
|
-
... )
|
|
118
|
+
>>> obj = get_trigger("store://my-trigger-key")
|
|
121
119
|
|
|
122
120
|
Using entity name:
|
|
123
121
|
>>> obj = get_trigger("my-trigger-name"
|
|
@@ -158,9 +156,7 @@ def get_trigger_versions(
|
|
|
158
156
|
Examples
|
|
159
157
|
--------
|
|
160
158
|
Using entity key:
|
|
161
|
-
>>> objs = get_trigger_versions(
|
|
162
|
-
... "store://my-trigger-key"
|
|
163
|
-
... )
|
|
159
|
+
>>> objs = get_trigger_versions("store://my-trigger-key")
|
|
164
160
|
|
|
165
161
|
Using entity name:
|
|
166
162
|
>>> objs = get_trigger_versions("my-trigger-name",
|
|
@@ -192,9 +188,7 @@ def list_triggers(project: str, **kwargs) -> list[Trigger]:
|
|
|
192
188
|
|
|
193
189
|
Examples
|
|
194
190
|
--------
|
|
195
|
-
>>> objs = list_triggers(
|
|
196
|
-
... project="my-project"
|
|
197
|
-
... )
|
|
191
|
+
>>> objs = list_triggers(project="my-project")
|
|
198
192
|
"""
|
|
199
193
|
return context_processor.list_context_entities(
|
|
200
194
|
project=project,
|
|
@@ -230,9 +224,7 @@ def import_trigger(
|
|
|
230
224
|
|
|
231
225
|
Examples
|
|
232
226
|
--------
|
|
233
|
-
>>> obj = import_trigger(
|
|
234
|
-
... "my-trigger.yaml"
|
|
235
|
-
... )
|
|
227
|
+
>>> obj = import_trigger("my-trigger.yaml")
|
|
236
228
|
"""
|
|
237
229
|
return context_processor.import_context_entity(
|
|
238
230
|
file,
|
|
@@ -258,9 +250,7 @@ def load_trigger(file: str) -> Trigger:
|
|
|
258
250
|
|
|
259
251
|
Examples
|
|
260
252
|
--------
|
|
261
|
-
>>> obj = load_trigger(
|
|
262
|
-
... "my-trigger.yaml"
|
|
263
|
-
... )
|
|
253
|
+
>>> obj = load_trigger("my-trigger.yaml")
|
|
264
254
|
"""
|
|
265
255
|
return context_processor.load_context_entity(file)
|
|
266
256
|
|
|
@@ -281,11 +271,7 @@ def update_trigger(entity: Trigger) -> Trigger:
|
|
|
281
271
|
|
|
282
272
|
Examples
|
|
283
273
|
--------
|
|
284
|
-
>>> obj = (
|
|
285
|
-
... update_trigger(
|
|
286
|
-
... obj
|
|
287
|
-
... )
|
|
288
|
-
... )
|
|
274
|
+
>>> obj = update_trigger(obj)
|
|
289
275
|
"""
|
|
290
276
|
return context_processor.update_context_entity(
|
|
291
277
|
project=entity.project,
|
|
@@ -326,9 +312,7 @@ def delete_trigger(
|
|
|
326
312
|
Examples
|
|
327
313
|
--------
|
|
328
314
|
If delete_all_versions is False:
|
|
329
|
-
>>> obj = delete_trigger(
|
|
330
|
-
... "store://my-trigger-key"
|
|
331
|
-
... )
|
|
315
|
+
>>> obj = delete_trigger("store://my-trigger-key")
|
|
332
316
|
|
|
333
317
|
Otherwise:
|
|
334
318
|
>>> obj = delete_trigger("my-trigger-name"
|