digitalhub 0.14.0b1__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 +9 -21
- digitalhub/entities/_base/material/entity.py +5 -21
- 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} +12 -232
- 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/_processors/utils.py +2 -2
- digitalhub/entities/artifact/crud.py +1 -1
- digitalhub/entities/dataitem/crud.py +6 -3
- digitalhub/entities/dataitem/table/entity.py +24 -1
- digitalhub/entities/dataitem/utils.py +4 -0
- digitalhub/entities/function/_base/entity.py +3 -3
- digitalhub/entities/function/crud.py +1 -1
- digitalhub/entities/model/_base/entity.py +46 -24
- digitalhub/entities/model/crud.py +1 -1
- digitalhub/entities/project/_base/entity.py +3 -12
- digitalhub/entities/project/crud.py +1 -2
- digitalhub/entities/run/_base/builder.py +0 -4
- digitalhub/entities/run/_base/entity.py +53 -66
- digitalhub/entities/run/crud.py +5 -2
- digitalhub/entities/secret/_base/entity.py +1 -5
- digitalhub/entities/secret/crud.py +1 -1
- digitalhub/entities/task/_base/builder.py +0 -4
- digitalhub/entities/task/_base/entity.py +5 -5
- digitalhub/entities/task/crud.py +1 -1
- digitalhub/entities/trigger/_base/entity.py +1 -5
- digitalhub/entities/trigger/crud.py +1 -1
- digitalhub/entities/workflow/_base/entity.py +3 -3
- digitalhub/entities/workflow/crud.py +1 -1
- digitalhub/factory/entity.py +283 -0
- digitalhub/factory/registry.py +197 -0
- digitalhub/factory/runtime.py +44 -0
- digitalhub/runtimes/_base.py +2 -2
- digitalhub/stores/client/dhcore/client.py +0 -14
- digitalhub/stores/client/dhcore/configurator.py +5 -28
- digitalhub/stores/client/dhcore/error_parser.py +0 -4
- digitalhub/stores/credentials/configurator.py +4 -29
- 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 +2 -10
- 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 +9 -19
- digitalhub/utils/io_utils.py +0 -4
- {digitalhub-0.14.0b1.dist-info → digitalhub-0.14.0b3.dist-info}/METADATA +1 -1
- {digitalhub-0.14.0b1.dist-info → digitalhub-0.14.0b3.dist-info}/RECORD +69 -57
- digitalhub/entities/_processors/context.py +0 -1499
- digitalhub/factory/factory.py +0 -460
- {digitalhub-0.14.0b1.dist-info → digitalhub-0.14.0b3.dist-info}/WHEEL +0 -0
- {digitalhub-0.14.0b1.dist-info → digitalhub-0.14.0b3.dist-info}/licenses/AUTHORS +0 -0
- {digitalhub-0.14.0b1.dist-info → digitalhub-0.14.0b3.dist-info}/licenses/LICENSE +0 -0
|
@@ -9,7 +9,7 @@ import typing
|
|
|
9
9
|
from digitalhub.entities._base.material.entity import MaterialEntity
|
|
10
10
|
from digitalhub.entities._commons.enums import EntityTypes
|
|
11
11
|
from digitalhub.entities._commons.metrics import MetricType, set_metrics, validate_metric_value
|
|
12
|
-
from digitalhub.entities._processors.
|
|
12
|
+
from digitalhub.entities._processors.processors import context_processor
|
|
13
13
|
|
|
14
14
|
if typing.TYPE_CHECKING:
|
|
15
15
|
from digitalhub.entities._base.entity.metadata import Metadata
|
|
@@ -81,10 +81,6 @@ class Model(MaterialEntity):
|
|
|
81
81
|
single_value : bool
|
|
82
82
|
If True, value is a single value.
|
|
83
83
|
|
|
84
|
-
Returns
|
|
85
|
-
-------
|
|
86
|
-
None
|
|
87
|
-
|
|
88
84
|
Examples
|
|
89
85
|
--------
|
|
90
86
|
Log a new value in a list
|
|
@@ -94,13 +90,27 @@ class Model(MaterialEntity):
|
|
|
94
90
|
>>> entity.log_metric("loss", 0.0019)
|
|
95
91
|
|
|
96
92
|
Log a list of values and append them to existing metric:
|
|
97
|
-
>>> entity.log_metric(
|
|
93
|
+
>>> entity.log_metric(
|
|
94
|
+
... "loss",
|
|
95
|
+
... [
|
|
96
|
+
... 0.0018,
|
|
97
|
+
... 0.0015,
|
|
98
|
+
... ],
|
|
99
|
+
... )
|
|
98
100
|
|
|
99
101
|
Log a single value (not represented as list):
|
|
100
|
-
>>> entity.log_metric(
|
|
102
|
+
>>> entity.log_metric(
|
|
103
|
+
... "accuracy",
|
|
104
|
+
... 0.9,
|
|
105
|
+
... single_value=True,
|
|
106
|
+
... )
|
|
101
107
|
|
|
102
108
|
Log a list of values and overwrite existing metric:
|
|
103
|
-
>>> entity.log_metric(
|
|
109
|
+
>>> entity.log_metric(
|
|
110
|
+
... "accuracy",
|
|
111
|
+
... [0.8, 0.9],
|
|
112
|
+
... overwrite=True,
|
|
113
|
+
... )
|
|
104
114
|
"""
|
|
105
115
|
self._set_metrics(key, value, overwrite, single_value)
|
|
106
116
|
context_processor.update_metric(self.project, self.ENTITY_TYPE, self.id, key, self.status.metrics[key])
|
|
@@ -121,23 +131,43 @@ class Model(MaterialEntity):
|
|
|
121
131
|
overwrite : bool
|
|
122
132
|
If True, overwrite existing metrics.
|
|
123
133
|
|
|
124
|
-
Returns
|
|
125
|
-
-------
|
|
126
|
-
None
|
|
127
|
-
|
|
128
134
|
Examples
|
|
129
135
|
--------
|
|
130
136
|
Log multiple metrics at once
|
|
131
|
-
>>> entity.log_metrics(
|
|
137
|
+
>>> entity.log_metrics(
|
|
138
|
+
... {
|
|
139
|
+
... "loss": 0.002,
|
|
140
|
+
... "accuracy": 0.95,
|
|
141
|
+
... }
|
|
142
|
+
... )
|
|
132
143
|
|
|
133
144
|
Log metrics with lists and single values
|
|
134
|
-
>>> entity.log_metrics(
|
|
145
|
+
>>> entity.log_metrics(
|
|
146
|
+
... {
|
|
147
|
+
... "loss": [
|
|
148
|
+
... 0.1,
|
|
149
|
+
... 0.05,
|
|
150
|
+
... ],
|
|
151
|
+
... "epoch": 10,
|
|
152
|
+
... }
|
|
153
|
+
... )
|
|
135
154
|
|
|
136
155
|
Append to existing metrics (default behavior)
|
|
137
|
-
>>> entity.log_metrics(
|
|
156
|
+
>>> entity.log_metrics(
|
|
157
|
+
... {
|
|
158
|
+
... "loss": 0.001,
|
|
159
|
+
... "accuracy": 0.96,
|
|
160
|
+
... }
|
|
161
|
+
... ) # Appends to existing
|
|
138
162
|
|
|
139
163
|
Overwrite existing metrics
|
|
140
|
-
>>> entity.log_metrics(
|
|
164
|
+
>>> entity.log_metrics(
|
|
165
|
+
... {
|
|
166
|
+
... "loss": 0.0005,
|
|
167
|
+
... "accuracy": 0.98,
|
|
168
|
+
... },
|
|
169
|
+
... overwrite=True,
|
|
170
|
+
... )
|
|
141
171
|
|
|
142
172
|
See also
|
|
143
173
|
--------
|
|
@@ -162,10 +192,6 @@ class Model(MaterialEntity):
|
|
|
162
192
|
def _get_metrics(self) -> None:
|
|
163
193
|
"""
|
|
164
194
|
Get model metrics from backend.
|
|
165
|
-
|
|
166
|
-
Returns
|
|
167
|
-
-------
|
|
168
|
-
None
|
|
169
195
|
"""
|
|
170
196
|
self.status.metrics = context_processor.read_metrics(
|
|
171
197
|
project=self.project,
|
|
@@ -193,10 +219,6 @@ class Model(MaterialEntity):
|
|
|
193
219
|
If True, overwrite existing metric.
|
|
194
220
|
single_value : bool
|
|
195
221
|
If True, value is a single value.
|
|
196
|
-
|
|
197
|
-
Returns
|
|
198
|
-
-------
|
|
199
|
-
None
|
|
200
222
|
"""
|
|
201
223
|
value = validate_metric_value(value)
|
|
202
224
|
self.status.metrics = set_metrics(
|
|
@@ -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
|
from digitalhub.entities.model.utils import eval_source, process_kwargs
|
|
12
12
|
from digitalhub.utils.types import SourcesOrListOfSources
|
|
13
13
|
|
|
@@ -12,8 +12,7 @@ from digitalhub.context.api import build_context
|
|
|
12
12
|
from digitalhub.entities._base.entity.entity import Entity
|
|
13
13
|
from digitalhub.entities._commons.enums import EntityTypes
|
|
14
14
|
from digitalhub.entities._constructors.uuid import build_uuid
|
|
15
|
-
from digitalhub.entities._processors.
|
|
16
|
-
from digitalhub.entities._processors.context import context_processor
|
|
15
|
+
from digitalhub.entities._processors.processors import base_processor, context_processor
|
|
17
16
|
from digitalhub.entities.artifact.crud import (
|
|
18
17
|
delete_artifact,
|
|
19
18
|
get_artifact,
|
|
@@ -72,7 +71,7 @@ from digitalhub.entities.workflow.crud import (
|
|
|
72
71
|
new_workflow,
|
|
73
72
|
update_workflow,
|
|
74
73
|
)
|
|
75
|
-
from digitalhub.factory.
|
|
74
|
+
from digitalhub.factory.entity import entity_factory
|
|
76
75
|
from digitalhub.stores.client.api import get_client
|
|
77
76
|
from digitalhub.utils.exceptions import BackendError, EntityAlreadyExistsError, EntityError
|
|
78
77
|
from digitalhub.utils.generic_utils import get_timestamp
|
|
@@ -299,10 +298,6 @@ class Project(Entity):
|
|
|
299
298
|
----------
|
|
300
299
|
obj : dict
|
|
301
300
|
Project object in dictionary format.
|
|
302
|
-
|
|
303
|
-
Returns
|
|
304
|
-
-------
|
|
305
|
-
None
|
|
306
301
|
"""
|
|
307
302
|
entity_types = self._get_entity_types()
|
|
308
303
|
|
|
@@ -350,7 +345,7 @@ class Project(Entity):
|
|
|
350
345
|
entity["metadata"]["version"] = new_id
|
|
351
346
|
|
|
352
347
|
try:
|
|
353
|
-
|
|
348
|
+
entity_factory.build_entity_from_dict(entity).save()
|
|
354
349
|
except EntityAlreadyExistsError:
|
|
355
350
|
pass
|
|
356
351
|
|
|
@@ -362,10 +357,6 @@ class Project(Entity):
|
|
|
362
357
|
----------
|
|
363
358
|
obj : dict
|
|
364
359
|
Project object in dictionary format.
|
|
365
|
-
|
|
366
|
-
Returns
|
|
367
|
-
-------
|
|
368
|
-
None
|
|
369
360
|
"""
|
|
370
361
|
entity_types = self._get_entity_types()
|
|
371
362
|
|
|
@@ -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
|
|
|
@@ -10,8 +10,9 @@ 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.
|
|
14
|
-
from digitalhub.factory.
|
|
13
|
+
from digitalhub.entities._processors.processors import context_processor
|
|
14
|
+
from digitalhub.factory.entity import entity_factory
|
|
15
|
+
from digitalhub.factory.runtime import runtime_factory
|
|
15
16
|
from digitalhub.utils.exceptions import EntityError
|
|
16
17
|
from digitalhub.utils.logger import LOGGER
|
|
17
18
|
|
|
@@ -51,15 +52,11 @@ class Run(UnversionedEntity):
|
|
|
51
52
|
def build(self) -> None:
|
|
52
53
|
"""
|
|
53
54
|
Build run.
|
|
54
|
-
|
|
55
|
-
Returns
|
|
56
|
-
-------
|
|
57
|
-
None
|
|
58
55
|
"""
|
|
59
56
|
executable = self._get_executable()
|
|
60
57
|
task = self._get_task()
|
|
61
58
|
new_spec = self._get_runtime().build(executable, task, self.to_dict())
|
|
62
|
-
self.spec =
|
|
59
|
+
self.spec = entity_factory.build_spec(self.kind, **new_spec)
|
|
63
60
|
self._set_state(State.BUILT.value)
|
|
64
61
|
self.save(update=True)
|
|
65
62
|
|
|
@@ -141,10 +138,6 @@ class Run(UnversionedEntity):
|
|
|
141
138
|
def stop(self) -> None:
|
|
142
139
|
"""
|
|
143
140
|
Stop run.
|
|
144
|
-
|
|
145
|
-
Returns
|
|
146
|
-
-------
|
|
147
|
-
None
|
|
148
141
|
"""
|
|
149
142
|
if not self.spec.local_execution:
|
|
150
143
|
return context_processor.stop_entity(self.project, self.ENTITY_TYPE, self.id)
|
|
@@ -152,10 +145,6 @@ class Run(UnversionedEntity):
|
|
|
152
145
|
def resume(self) -> None:
|
|
153
146
|
"""
|
|
154
147
|
Resume run.
|
|
155
|
-
|
|
156
|
-
Returns
|
|
157
|
-
-------
|
|
158
|
-
None
|
|
159
148
|
"""
|
|
160
149
|
if not self.spec.local_execution:
|
|
161
150
|
return context_processor.resume_entity(self.project, self.ENTITY_TYPE, self.id)
|
|
@@ -184,10 +173,6 @@ class Run(UnversionedEntity):
|
|
|
184
173
|
single_value : bool
|
|
185
174
|
If True, value is a single value.
|
|
186
175
|
|
|
187
|
-
Returns
|
|
188
|
-
-------
|
|
189
|
-
None
|
|
190
|
-
|
|
191
176
|
Examples
|
|
192
177
|
--------
|
|
193
178
|
Log a new value in a list
|
|
@@ -197,13 +182,27 @@ class Run(UnversionedEntity):
|
|
|
197
182
|
>>> entity.log_metric("loss", 0.0019)
|
|
198
183
|
|
|
199
184
|
Log a list of values and append them to existing metric:
|
|
200
|
-
>>> entity.log_metric(
|
|
185
|
+
>>> entity.log_metric(
|
|
186
|
+
... "loss",
|
|
187
|
+
... [
|
|
188
|
+
... 0.0018,
|
|
189
|
+
... 0.0015,
|
|
190
|
+
... ],
|
|
191
|
+
... )
|
|
201
192
|
|
|
202
193
|
Log a single value (not represented as list):
|
|
203
|
-
>>> entity.log_metric(
|
|
194
|
+
>>> entity.log_metric(
|
|
195
|
+
... "accuracy",
|
|
196
|
+
... 0.9,
|
|
197
|
+
... single_value=True,
|
|
198
|
+
... )
|
|
204
199
|
|
|
205
200
|
Log a list of values and overwrite existing metric:
|
|
206
|
-
>>> entity.log_metric(
|
|
201
|
+
>>> entity.log_metric(
|
|
202
|
+
... "accuracy",
|
|
203
|
+
... [0.8, 0.9],
|
|
204
|
+
... overwrite=True,
|
|
205
|
+
... )
|
|
207
206
|
"""
|
|
208
207
|
self._set_metrics(key, value, overwrite, single_value)
|
|
209
208
|
context_processor.update_metric(self.project, self.ENTITY_TYPE, self.id, key, self.status.metrics[key])
|
|
@@ -224,23 +223,43 @@ class Run(UnversionedEntity):
|
|
|
224
223
|
overwrite : bool
|
|
225
224
|
If True, overwrite existing metrics.
|
|
226
225
|
|
|
227
|
-
Returns
|
|
228
|
-
-------
|
|
229
|
-
None
|
|
230
|
-
|
|
231
226
|
Examples
|
|
232
227
|
--------
|
|
233
228
|
Log multiple metrics at once
|
|
234
|
-
>>> entity.log_metrics(
|
|
229
|
+
>>> entity.log_metrics(
|
|
230
|
+
... {
|
|
231
|
+
... "loss": 0.002,
|
|
232
|
+
... "accuracy": 0.95,
|
|
233
|
+
... }
|
|
234
|
+
... )
|
|
235
235
|
|
|
236
236
|
Log metrics with lists and single values
|
|
237
|
-
>>> entity.log_metrics(
|
|
237
|
+
>>> entity.log_metrics(
|
|
238
|
+
... {
|
|
239
|
+
... "loss": [
|
|
240
|
+
... 0.1,
|
|
241
|
+
... 0.05,
|
|
242
|
+
... ],
|
|
243
|
+
... "epoch": 10,
|
|
244
|
+
... }
|
|
245
|
+
... )
|
|
238
246
|
|
|
239
247
|
Append to existing metrics (default behavior)
|
|
240
|
-
>>> entity.log_metrics(
|
|
248
|
+
>>> entity.log_metrics(
|
|
249
|
+
... {
|
|
250
|
+
... "loss": 0.001,
|
|
251
|
+
... "accuracy": 0.96,
|
|
252
|
+
... }
|
|
253
|
+
... ) # Appends to existing
|
|
241
254
|
|
|
242
255
|
Overwrite existing metrics
|
|
243
|
-
>>> entity.log_metrics(
|
|
256
|
+
>>> entity.log_metrics(
|
|
257
|
+
... {
|
|
258
|
+
... "loss": 0.0005,
|
|
259
|
+
... "accuracy": 0.98,
|
|
260
|
+
... },
|
|
261
|
+
... overwrite=True,
|
|
262
|
+
... )
|
|
244
263
|
|
|
245
264
|
See also
|
|
246
265
|
--------
|
|
@@ -265,19 +284,11 @@ class Run(UnversionedEntity):
|
|
|
265
284
|
def _setup_execution(self) -> None:
|
|
266
285
|
"""
|
|
267
286
|
Setup run execution.
|
|
268
|
-
|
|
269
|
-
Returns
|
|
270
|
-
-------
|
|
271
|
-
None
|
|
272
287
|
"""
|
|
273
288
|
|
|
274
289
|
def _start_execution(self) -> None:
|
|
275
290
|
"""
|
|
276
291
|
Start run execution.
|
|
277
|
-
|
|
278
|
-
Returns
|
|
279
|
-
-------
|
|
280
|
-
None
|
|
281
292
|
"""
|
|
282
293
|
self._context().set_run(f"{self.key}:{self.id}")
|
|
283
294
|
if self.spec.local_execution:
|
|
@@ -289,10 +300,6 @@ class Run(UnversionedEntity):
|
|
|
289
300
|
def _finish_execution(self) -> None:
|
|
290
301
|
"""
|
|
291
302
|
Finish run execution.
|
|
292
|
-
|
|
293
|
-
Returns
|
|
294
|
-
-------
|
|
295
|
-
None
|
|
296
303
|
"""
|
|
297
304
|
self._context().unset_run()
|
|
298
305
|
|
|
@@ -315,12 +322,8 @@ class Run(UnversionedEntity):
|
|
|
315
322
|
----------
|
|
316
323
|
status : dict
|
|
317
324
|
Status to set.
|
|
318
|
-
|
|
319
|
-
Returns
|
|
320
|
-
-------
|
|
321
|
-
None
|
|
322
325
|
"""
|
|
323
|
-
self.status: RunStatus =
|
|
326
|
+
self.status: RunStatus = entity_factory.build_status(self.kind, **status)
|
|
324
327
|
|
|
325
328
|
def _set_state(self, state: str) -> None:
|
|
326
329
|
"""
|
|
@@ -330,10 +333,6 @@ class Run(UnversionedEntity):
|
|
|
330
333
|
----------
|
|
331
334
|
state : str
|
|
332
335
|
State to set.
|
|
333
|
-
|
|
334
|
-
Returns
|
|
335
|
-
-------
|
|
336
|
-
None
|
|
337
336
|
"""
|
|
338
337
|
self.status.state = state
|
|
339
338
|
|
|
@@ -345,10 +344,6 @@ class Run(UnversionedEntity):
|
|
|
345
344
|
----------
|
|
346
345
|
message : str
|
|
347
346
|
Message to set.
|
|
348
|
-
|
|
349
|
-
Returns
|
|
350
|
-
-------
|
|
351
|
-
None
|
|
352
347
|
"""
|
|
353
348
|
self.status.message = message
|
|
354
349
|
|
|
@@ -361,7 +356,7 @@ class Run(UnversionedEntity):
|
|
|
361
356
|
Runtime
|
|
362
357
|
Runtime object.
|
|
363
358
|
"""
|
|
364
|
-
return
|
|
359
|
+
return runtime_factory.build_runtime(self.kind, self.project)
|
|
365
360
|
|
|
366
361
|
def _get_executable(self) -> dict:
|
|
367
362
|
"""
|
|
@@ -373,8 +368,8 @@ class Run(UnversionedEntity):
|
|
|
373
368
|
dict
|
|
374
369
|
Executable (function or workflow) from backend.
|
|
375
370
|
"""
|
|
376
|
-
exec_kind =
|
|
377
|
-
exec_type =
|
|
371
|
+
exec_kind = entity_factory.get_executable_kind(self.kind)
|
|
372
|
+
exec_type = entity_factory.get_entity_type_from_kind(exec_kind)
|
|
378
373
|
string_to_split = getattr(self.spec, exec_type)
|
|
379
374
|
exec_name, exec_id = string_to_split.split("://")[-1].split("/")[-1].split(":")
|
|
380
375
|
return context_processor.read_context_entity(
|
|
@@ -404,10 +399,6 @@ class Run(UnversionedEntity):
|
|
|
404
399
|
def _get_metrics(self) -> None:
|
|
405
400
|
"""
|
|
406
401
|
Get model metrics from backend.
|
|
407
|
-
|
|
408
|
-
Returns
|
|
409
|
-
-------
|
|
410
|
-
None
|
|
411
402
|
"""
|
|
412
403
|
self.status.metrics = context_processor.read_metrics(
|
|
413
404
|
project=self.project,
|
|
@@ -435,10 +426,6 @@ class Run(UnversionedEntity):
|
|
|
435
426
|
If True, overwrite existing metric.
|
|
436
427
|
single_value : bool
|
|
437
428
|
If True, value is a single value.
|
|
438
|
-
|
|
439
|
-
Returns
|
|
440
|
-
-------
|
|
441
|
-
None
|
|
442
429
|
"""
|
|
443
430
|
value = validate_metric_value(value)
|
|
444
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:
|
|
@@ -245,7 +245,10 @@ def delete_run(
|
|
|
245
245
|
Examples
|
|
246
246
|
--------
|
|
247
247
|
>>> obj = delete_run("store://my-run-key")
|
|
248
|
-
>>> obj = delete_run(
|
|
248
|
+
>>> obj = delete_run(
|
|
249
|
+
... "my-run-id",
|
|
250
|
+
... project="my-project",
|
|
251
|
+
... )
|
|
249
252
|
"""
|
|
250
253
|
if not is_valid_key(identifier) and project is None:
|
|
251
254
|
raise EntityError("Specify entity key or entity ID combined with 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:
|
|
@@ -8,8 +8,8 @@ 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.
|
|
12
|
-
from digitalhub.factory.
|
|
11
|
+
from digitalhub.entities._processors.processors import context_processor
|
|
12
|
+
from digitalhub.factory.entity import entity_factory
|
|
13
13
|
|
|
14
14
|
if typing.TYPE_CHECKING:
|
|
15
15
|
from digitalhub.entities._base.entity.metadata import Metadata
|
|
@@ -67,8 +67,8 @@ class Task(UnversionedEntity):
|
|
|
67
67
|
Run
|
|
68
68
|
Run object.
|
|
69
69
|
"""
|
|
70
|
-
exec_kind =
|
|
71
|
-
exec_type =
|
|
70
|
+
exec_kind = entity_factory.get_executable_kind(self.kind)
|
|
71
|
+
exec_type = entity_factory.get_entity_type_from_kind(exec_kind)
|
|
72
72
|
kwargs[exec_type] = getattr(self.spec, exec_type)
|
|
73
73
|
return self.new_run(
|
|
74
74
|
save=save,
|
|
@@ -112,7 +112,7 @@ class Task(UnversionedEntity):
|
|
|
112
112
|
"""
|
|
113
113
|
if save:
|
|
114
114
|
return context_processor.create_context_entity(**kwargs)
|
|
115
|
-
return
|
|
115
|
+
return entity_factory.build_entity_from_params(**kwargs)
|
|
116
116
|
|
|
117
117
|
def get_run(self, entity_key: str) -> Run:
|
|
118
118
|
"""
|
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:
|
|
@@ -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
|
|
@@ -8,7 +8,7 @@ import typing
|
|
|
8
8
|
|
|
9
9
|
from digitalhub.entities._base.executable.entity import ExecutableEntity
|
|
10
10
|
from digitalhub.entities._commons.enums import EntityTypes, Relationship
|
|
11
|
-
from digitalhub.factory.
|
|
11
|
+
from digitalhub.factory.entity import entity_factory
|
|
12
12
|
from digitalhub.utils.exceptions import BackendError
|
|
13
13
|
|
|
14
14
|
if typing.TYPE_CHECKING:
|
|
@@ -72,8 +72,8 @@ class Workflow(ExecutableEntity):
|
|
|
72
72
|
Run instance.
|
|
73
73
|
"""
|
|
74
74
|
# Get task and run kind
|
|
75
|
-
task_kind =
|
|
76
|
-
run_kind =
|
|
75
|
+
task_kind = entity_factory.get_task_kind_from_action(self.kind, action)
|
|
76
|
+
run_kind = entity_factory.get_run_kind_from_action(self.kind, action)
|
|
77
77
|
|
|
78
78
|
# Create or update new task
|
|
79
79
|
task = self._get_or_create_task(task_kind)
|
|
@@ -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.workflow._base.entity import Workflow
|