digitalhub 0.9.0__py3-none-any.whl → 0.9.0b1__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/client/_base/client.py +20 -56
- digitalhub/client/dhcore/client.py +0 -4
- digitalhub/client/local/client.py +0 -2
- digitalhub/entities/_base/entity/entity.py +4 -6
- digitalhub/entities/_base/material/entity.py +1 -1
- digitalhub/entities/_base/project/entity.py +1 -1
- digitalhub/entities/_base/unversioned/entity.py +1 -2
- digitalhub/entities/_base/versioned/entity.py +1 -2
- digitalhub/entities/_operations/processor.py +1 -124
- digitalhub/entities/function/_base/entity.py +3 -3
- digitalhub/entities/task/_base/entity.py +9 -16
- digitalhub/entities/workflow/_base/entity.py +4 -12
- digitalhub/stores/_base/store.py +2 -6
- digitalhub/stores/local/store.py +2 -6
- digitalhub/stores/remote/store.py +2 -6
- digitalhub/stores/s3/store.py +46 -100
- digitalhub/stores/sql/store.py +2 -10
- digitalhub/utils/s3_utils.py +0 -17
- {digitalhub-0.9.0.dist-info → digitalhub-0.9.0b1.dist-info}/LICENSE.txt +1 -1
- {digitalhub-0.9.0.dist-info → digitalhub-0.9.0b1.dist-info}/METADATA +2 -2
- {digitalhub-0.9.0.dist-info → digitalhub-0.9.0b1.dist-info}/RECORD +23 -27
- digitalhub/client/_base/key_builder.py +0 -52
- digitalhub/client/dhcore/key_builder.py +0 -58
- digitalhub/client/local/key_builder.py +0 -58
- test/local/instances/test_validate.py +0 -55
- {digitalhub-0.9.0.dist-info → digitalhub-0.9.0b1.dist-info}/WHEEL +0 -0
- {digitalhub-0.9.0.dist-info → digitalhub-0.9.0b1.dist-info}/top_level.txt +0 -0
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import typing
|
|
4
3
|
from abc import abstractmethod
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
from digitalhub.client._base.api_builder import ClientApiBuilder
|
|
8
|
-
from digitalhub.client._base.key_builder import ClientKeyBuilder
|
|
5
|
+
from digitalhub.client._base.api_builder import ClientApiBuilder
|
|
9
6
|
|
|
10
7
|
|
|
11
8
|
class Client:
|
|
@@ -19,11 +16,26 @@ class Client:
|
|
|
19
16
|
|
|
20
17
|
def __init__(self) -> None:
|
|
21
18
|
self._api_builder: ClientApiBuilder = None
|
|
22
|
-
self._key_builder: ClientKeyBuilder = None
|
|
23
19
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
def build_api(self, category: str, operation: str, **kwargs) -> str:
|
|
21
|
+
"""
|
|
22
|
+
Build the API for the client.
|
|
23
|
+
|
|
24
|
+
Parameters
|
|
25
|
+
----------
|
|
26
|
+
category : str
|
|
27
|
+
API category.
|
|
28
|
+
operation : str
|
|
29
|
+
API operation.
|
|
30
|
+
**kwargs : dict
|
|
31
|
+
Additional parameters.
|
|
32
|
+
|
|
33
|
+
Returns
|
|
34
|
+
-------
|
|
35
|
+
str
|
|
36
|
+
API formatted.
|
|
37
|
+
"""
|
|
38
|
+
return self._api_builder.build_api(category, operation, **kwargs)
|
|
27
39
|
|
|
28
40
|
@abstractmethod
|
|
29
41
|
def create_object(self, api: str, obj: dict, **kwargs) -> dict:
|
|
@@ -67,54 +79,6 @@ class Client:
|
|
|
67
79
|
Search objects method.
|
|
68
80
|
"""
|
|
69
81
|
|
|
70
|
-
##############################
|
|
71
|
-
# Build methods
|
|
72
|
-
##############################
|
|
73
|
-
|
|
74
|
-
def build_api(self, category: str, operation: str, **kwargs) -> str:
|
|
75
|
-
"""
|
|
76
|
-
Build the API for the client.
|
|
77
|
-
|
|
78
|
-
Parameters
|
|
79
|
-
----------
|
|
80
|
-
category : str
|
|
81
|
-
API category.
|
|
82
|
-
operation : str
|
|
83
|
-
API operation.
|
|
84
|
-
**kwargs : dict
|
|
85
|
-
Additional parameters.
|
|
86
|
-
|
|
87
|
-
Returns
|
|
88
|
-
-------
|
|
89
|
-
str
|
|
90
|
-
API formatted.
|
|
91
|
-
"""
|
|
92
|
-
return self._api_builder.build_api(category, operation, **kwargs)
|
|
93
|
-
|
|
94
|
-
def build_key(self, category: str, *args, **kwargs) -> str:
|
|
95
|
-
"""
|
|
96
|
-
Build the key for the client.
|
|
97
|
-
|
|
98
|
-
Parameters
|
|
99
|
-
----------
|
|
100
|
-
category : str
|
|
101
|
-
Key category.
|
|
102
|
-
*args : tuple
|
|
103
|
-
Additional arguments.
|
|
104
|
-
**kwargs : dict
|
|
105
|
-
Additional parameters.
|
|
106
|
-
|
|
107
|
-
Returns
|
|
108
|
-
-------
|
|
109
|
-
str
|
|
110
|
-
Key formatted.
|
|
111
|
-
"""
|
|
112
|
-
return self._key_builder.build_key(category, *args, **kwargs)
|
|
113
|
-
|
|
114
|
-
##############################
|
|
115
|
-
# Interface methods
|
|
116
|
-
##############################
|
|
117
|
-
|
|
118
82
|
@staticmethod
|
|
119
83
|
@abstractmethod
|
|
120
84
|
def is_local() -> bool:
|
|
@@ -14,7 +14,6 @@ from digitalhub.client._base.client import Client
|
|
|
14
14
|
from digitalhub.client.dhcore.api_builder import ClientDHCoreApiBuilder
|
|
15
15
|
from digitalhub.client.dhcore.enums import AuthType, DhcoreEnvVar
|
|
16
16
|
from digitalhub.client.dhcore.env import ENV_FILE, FALLBACK_USER, LIB_VERSION, MAX_API_LEVEL, MIN_API_LEVEL
|
|
17
|
-
from digitalhub.client.dhcore.key_builder import ClientDHCoreKeyBuilder
|
|
18
17
|
from digitalhub.client.dhcore.models import BasicAuth, OAuth2TokenAuth
|
|
19
18
|
from digitalhub.utils.exceptions import (
|
|
20
19
|
BackendError,
|
|
@@ -53,9 +52,6 @@ class ClientDHCore(Client):
|
|
|
53
52
|
# API builder
|
|
54
53
|
self._api_builder = ClientDHCoreApiBuilder()
|
|
55
54
|
|
|
56
|
-
# Key builder
|
|
57
|
-
self._key_builder = ClientDHCoreKeyBuilder()
|
|
58
|
-
|
|
59
55
|
# Endpoints
|
|
60
56
|
self._endpoint_core: str | None = None
|
|
61
57
|
self._endpoint_issuer: str | None = None
|
|
@@ -5,7 +5,6 @@ from datetime import datetime, timezone
|
|
|
5
5
|
|
|
6
6
|
from digitalhub.client._base.client import Client
|
|
7
7
|
from digitalhub.client.local.api_builder import ClientLocalApiBuilder
|
|
8
|
-
from digitalhub.client.local.key_builder import ClientLocalKeyBuilder
|
|
9
8
|
from digitalhub.utils.exceptions import BackendError
|
|
10
9
|
|
|
11
10
|
|
|
@@ -25,7 +24,6 @@ class ClientLocal(Client):
|
|
|
25
24
|
def __init__(self) -> None:
|
|
26
25
|
super().__init__()
|
|
27
26
|
self._api_builder = ClientLocalApiBuilder()
|
|
28
|
-
self._key_builder = ClientLocalKeyBuilder()
|
|
29
27
|
self._db: dict[str, dict[str, dict]] = {}
|
|
30
28
|
|
|
31
29
|
##############################
|
|
@@ -79,7 +79,7 @@ class Entity(Base):
|
|
|
79
79
|
Abstract export method.
|
|
80
80
|
"""
|
|
81
81
|
|
|
82
|
-
def add_relationship(self, relation: str,
|
|
82
|
+
def add_relationship(self, relation: str, source: str, dest: str) -> None:
|
|
83
83
|
"""
|
|
84
84
|
Add relationship to entity metadata.
|
|
85
85
|
|
|
@@ -87,10 +87,10 @@ class Entity(Base):
|
|
|
87
87
|
----------
|
|
88
88
|
relation : str
|
|
89
89
|
The type of relationship.
|
|
90
|
-
dest : str
|
|
91
|
-
The target entity.
|
|
92
90
|
source : str
|
|
93
91
|
The source entity.
|
|
92
|
+
dest : str
|
|
93
|
+
The target entity..
|
|
94
94
|
|
|
95
95
|
Returns
|
|
96
96
|
-------
|
|
@@ -98,9 +98,7 @@ class Entity(Base):
|
|
|
98
98
|
"""
|
|
99
99
|
if self.metadata.relationships is None:
|
|
100
100
|
self.metadata.relationships = []
|
|
101
|
-
obj = {"type": relation, "dest": dest}
|
|
102
|
-
if source is not None:
|
|
103
|
-
obj["source"] = source
|
|
101
|
+
obj = {"type": relation, "source": source, "dest": dest}
|
|
104
102
|
self.metadata.relationships.append(obj)
|
|
105
103
|
|
|
106
104
|
def to_dict(self) -> dict:
|
|
@@ -168,7 +168,7 @@ class MaterialEntity(VersionedEntity):
|
|
|
168
168
|
paths = store.upload(source, self.spec.path)
|
|
169
169
|
|
|
170
170
|
# Update files info
|
|
171
|
-
files_info = store.get_file_info(
|
|
171
|
+
files_info = store.get_file_info(paths)
|
|
172
172
|
self._update_files_info(files_info)
|
|
173
173
|
|
|
174
174
|
##############################
|
|
@@ -40,7 +40,7 @@ class ProjectEntity(Entity):
|
|
|
40
40
|
super().__init__(kind, metadata, spec, status, user)
|
|
41
41
|
self.id = name
|
|
42
42
|
self.name = name
|
|
43
|
-
self.key =
|
|
43
|
+
self.key = f"store://{name}"
|
|
44
44
|
|
|
45
45
|
self._obj_attr.extend(["id", "name"])
|
|
46
46
|
|
|
@@ -3,7 +3,6 @@ from __future__ import annotations
|
|
|
3
3
|
import typing
|
|
4
4
|
|
|
5
5
|
from digitalhub.entities._base.context.entity import ContextEntity
|
|
6
|
-
from digitalhub.entities._operations.processor import processor
|
|
7
6
|
|
|
8
7
|
if typing.TYPE_CHECKING:
|
|
9
8
|
from digitalhub.entities._base.entity.metadata import Metadata
|
|
@@ -25,4 +24,4 @@ class UnversionedEntity(ContextEntity):
|
|
|
25
24
|
super().__init__(project, kind, metadata, spec, status, user)
|
|
26
25
|
self.id = uuid
|
|
27
26
|
self.name = uuid
|
|
28
|
-
self.key =
|
|
27
|
+
self.key = f"store://{project}/{self.ENTITY_TYPE}/{kind}/{uuid}"
|
|
@@ -3,7 +3,6 @@ from __future__ import annotations
|
|
|
3
3
|
import typing
|
|
4
4
|
|
|
5
5
|
from digitalhub.entities._base.context.entity import ContextEntity
|
|
6
|
-
from digitalhub.entities._operations.processor import processor
|
|
7
6
|
|
|
8
7
|
if typing.TYPE_CHECKING:
|
|
9
8
|
from digitalhub.entities._base.entity.metadata import Metadata
|
|
@@ -26,4 +25,4 @@ class VersionedEntity(ContextEntity):
|
|
|
26
25
|
super().__init__(project, kind, metadata, spec, status, user)
|
|
27
26
|
self.name = name
|
|
28
27
|
self.id = uuid
|
|
29
|
-
self.key =
|
|
28
|
+
self.key = f"store://{project}/{self.ENTITY_TYPE}/{kind}/{name}:{uuid}"
|
|
@@ -427,55 +427,6 @@ class OperationsProcessor:
|
|
|
427
427
|
**kwargs,
|
|
428
428
|
)
|
|
429
429
|
|
|
430
|
-
##############################
|
|
431
|
-
# Base entity operations
|
|
432
|
-
##############################
|
|
433
|
-
|
|
434
|
-
def _build_base_entity_key(
|
|
435
|
-
self,
|
|
436
|
-
client: Client,
|
|
437
|
-
entity_id: str,
|
|
438
|
-
) -> str:
|
|
439
|
-
"""
|
|
440
|
-
Build object key.
|
|
441
|
-
|
|
442
|
-
Parameters
|
|
443
|
-
----------
|
|
444
|
-
client : Client
|
|
445
|
-
Client instance.
|
|
446
|
-
entity_id : str
|
|
447
|
-
Entity ID.
|
|
448
|
-
|
|
449
|
-
Returns
|
|
450
|
-
-------
|
|
451
|
-
str
|
|
452
|
-
Object key.
|
|
453
|
-
"""
|
|
454
|
-
return client.build_key(ApiCategories.BASE.value, entity_id)
|
|
455
|
-
|
|
456
|
-
def build_project_key(
|
|
457
|
-
self,
|
|
458
|
-
entity_id: str,
|
|
459
|
-
**kwargs,
|
|
460
|
-
) -> str:
|
|
461
|
-
"""
|
|
462
|
-
Build object key.
|
|
463
|
-
|
|
464
|
-
Parameters
|
|
465
|
-
----------
|
|
466
|
-
entity_id : str
|
|
467
|
-
Entity ID.
|
|
468
|
-
**kwargs : dict
|
|
469
|
-
Parameters to pass to entity builder.
|
|
470
|
-
|
|
471
|
-
Returns
|
|
472
|
-
-------
|
|
473
|
-
str
|
|
474
|
-
Object key.
|
|
475
|
-
"""
|
|
476
|
-
client = get_client(kwargs.pop("local", False))
|
|
477
|
-
return self._build_base_entity_key(client, entity_id)
|
|
478
|
-
|
|
479
430
|
def share_project_entity(
|
|
480
431
|
self,
|
|
481
432
|
entity_type: str,
|
|
@@ -608,7 +559,7 @@ class OperationsProcessor:
|
|
|
608
559
|
context = self._get_context(kwargs["project"])
|
|
609
560
|
obj = build_entity_from_params(**kwargs)
|
|
610
561
|
if context.is_running:
|
|
611
|
-
obj.add_relationship(Relationship.PRODUCEDBY.value, context.get_run_ctx())
|
|
562
|
+
obj.add_relationship(Relationship.PRODUCEDBY.value, obj.key, context.get_run_ctx())
|
|
612
563
|
|
|
613
564
|
new_obj: MaterialEntity = self._create_context_entity(context, obj.ENTITY_TYPE, obj.to_dict())
|
|
614
565
|
new_obj = build_entity_from_dict(new_obj)
|
|
@@ -785,10 +736,6 @@ class OperationsProcessor:
|
|
|
785
736
|
"""
|
|
786
737
|
if not identifier.startswith("store://"):
|
|
787
738
|
entity_id = identifier
|
|
788
|
-
else:
|
|
789
|
-
splt = identifier.split(":")
|
|
790
|
-
if len(splt) == 3:
|
|
791
|
-
identifier = f"{splt[0]}:{splt[1]}"
|
|
792
739
|
return self.read_context_entity(
|
|
793
740
|
identifier,
|
|
794
741
|
entity_type=entity_type,
|
|
@@ -1328,76 +1275,6 @@ class OperationsProcessor:
|
|
|
1328
1275
|
# Context entity operations
|
|
1329
1276
|
##############################
|
|
1330
1277
|
|
|
1331
|
-
def _build_context_entity_key(
|
|
1332
|
-
self,
|
|
1333
|
-
context: Context,
|
|
1334
|
-
entity_type: str,
|
|
1335
|
-
entity_kind: str,
|
|
1336
|
-
entity_name: str,
|
|
1337
|
-
entity_id: str | None = None,
|
|
1338
|
-
) -> str:
|
|
1339
|
-
"""
|
|
1340
|
-
Build object key.
|
|
1341
|
-
|
|
1342
|
-
Parameters
|
|
1343
|
-
----------
|
|
1344
|
-
context : Context
|
|
1345
|
-
Context instance.
|
|
1346
|
-
entity_type : str
|
|
1347
|
-
Entity type.
|
|
1348
|
-
entity_kind : str
|
|
1349
|
-
Entity kind.
|
|
1350
|
-
entity_name : str
|
|
1351
|
-
Entity name.
|
|
1352
|
-
entity_id : str
|
|
1353
|
-
Entity ID.
|
|
1354
|
-
|
|
1355
|
-
Returns
|
|
1356
|
-
-------
|
|
1357
|
-
str
|
|
1358
|
-
Object key.
|
|
1359
|
-
"""
|
|
1360
|
-
return context.client.build_key(
|
|
1361
|
-
ApiCategories.CONTEXT.value,
|
|
1362
|
-
project=context.name,
|
|
1363
|
-
entity_type=entity_type,
|
|
1364
|
-
entity_kind=entity_kind,
|
|
1365
|
-
entity_name=entity_name,
|
|
1366
|
-
entity_id=entity_id,
|
|
1367
|
-
)
|
|
1368
|
-
|
|
1369
|
-
def build_context_entity_key(
|
|
1370
|
-
self,
|
|
1371
|
-
project: str,
|
|
1372
|
-
entity_type: str,
|
|
1373
|
-
entity_kind: str,
|
|
1374
|
-
entity_name: str,
|
|
1375
|
-
entity_id: str | None = None,
|
|
1376
|
-
) -> str:
|
|
1377
|
-
"""
|
|
1378
|
-
Build object key.
|
|
1379
|
-
|
|
1380
|
-
Parameters
|
|
1381
|
-
----------
|
|
1382
|
-
project : str
|
|
1383
|
-
Project name.
|
|
1384
|
-
entity_type : str
|
|
1385
|
-
Entity type.
|
|
1386
|
-
entity_kind : str
|
|
1387
|
-
Entity kind.
|
|
1388
|
-
entity_name : str
|
|
1389
|
-
Entity name.
|
|
1390
|
-
entity_id : str
|
|
1391
|
-
Entity ID.
|
|
1392
|
-
|
|
1393
|
-
Returns
|
|
1394
|
-
-------
|
|
1395
|
-
str
|
|
1396
|
-
Object key.
|
|
1397
|
-
"""
|
|
1398
|
-
context = self._get_context(project)
|
|
1399
|
-
return self._build_context_entity_key(context, entity_type, entity_kind, entity_name, entity_id)
|
|
1400
|
-
|
|
1401
1278
|
def read_secret_data(
|
|
1402
1279
|
self,
|
|
1403
1280
|
project: str,
|
|
@@ -79,11 +79,11 @@ class Function(ExecutableEntity):
|
|
|
79
79
|
task = self._get_or_create_task(task_kind)
|
|
80
80
|
|
|
81
81
|
# Run function from task
|
|
82
|
-
run = task.run(run_kind,
|
|
82
|
+
run = task.run(run_kind, local_execution, **kwargs)
|
|
83
83
|
|
|
84
84
|
# Set as run's parent
|
|
85
|
-
run.add_relationship(Relationship.RUN_OF.value, self.key)
|
|
86
|
-
run.save()
|
|
85
|
+
run.add_relationship(Relationship.RUN_OF.value, run.key + ":" + run.id, self.key)
|
|
86
|
+
run.save(update=True)
|
|
87
87
|
|
|
88
88
|
# If execution is done by DHCore backend, return the object
|
|
89
89
|
if not local_execution:
|
|
@@ -4,8 +4,8 @@ import typing
|
|
|
4
4
|
|
|
5
5
|
from digitalhub.entities._base.unversioned.entity import UnversionedEntity
|
|
6
6
|
from digitalhub.entities._commons.enums import EntityTypes
|
|
7
|
-
from digitalhub.entities.
|
|
8
|
-
from digitalhub.factory.api import
|
|
7
|
+
from digitalhub.entities.run.crud import delete_run, get_run, new_run
|
|
8
|
+
from digitalhub.factory.api import get_entity_type_from_kind, get_executable_kind
|
|
9
9
|
|
|
10
10
|
if typing.TYPE_CHECKING:
|
|
11
11
|
from digitalhub.entities._base.entity.metadata import Metadata
|
|
@@ -42,7 +42,6 @@ class Task(UnversionedEntity):
|
|
|
42
42
|
def run(
|
|
43
43
|
self,
|
|
44
44
|
run_kind: str,
|
|
45
|
-
save: bool = True,
|
|
46
45
|
local_execution: bool = False,
|
|
47
46
|
**kwargs,
|
|
48
47
|
) -> Run:
|
|
@@ -67,7 +66,6 @@ class Task(UnversionedEntity):
|
|
|
67
66
|
exec_type = get_entity_type_from_kind(exec_kind)
|
|
68
67
|
kwargs[exec_type] = getattr(self.spec, exec_type)
|
|
69
68
|
return self.new_run(
|
|
70
|
-
save=save,
|
|
71
69
|
project=self.project,
|
|
72
70
|
task=self._get_task_string(),
|
|
73
71
|
kind=run_kind,
|
|
@@ -90,25 +88,21 @@ class Task(UnversionedEntity):
|
|
|
90
88
|
# CRUD Methods for Run
|
|
91
89
|
##############################
|
|
92
90
|
|
|
93
|
-
def new_run(self,
|
|
91
|
+
def new_run(self, **kwargs) -> Run:
|
|
94
92
|
"""
|
|
95
93
|
Create a new run.
|
|
96
94
|
|
|
97
95
|
Parameters
|
|
98
96
|
----------
|
|
99
|
-
save : bool
|
|
100
|
-
Flag to indicate save.
|
|
101
97
|
**kwargs : dict
|
|
102
|
-
Keyword arguments
|
|
98
|
+
Keyword arguments.
|
|
103
99
|
|
|
104
100
|
Returns
|
|
105
101
|
-------
|
|
106
102
|
Run
|
|
107
103
|
Run object.
|
|
108
104
|
"""
|
|
109
|
-
|
|
110
|
-
return processor.create_context_entity(**kwargs)
|
|
111
|
-
return build_entity_from_params(**kwargs)
|
|
105
|
+
return new_run(**kwargs)
|
|
112
106
|
|
|
113
107
|
def get_run(self, entity_key: str) -> Run:
|
|
114
108
|
"""
|
|
@@ -124,9 +118,9 @@ class Task(UnversionedEntity):
|
|
|
124
118
|
Run
|
|
125
119
|
Run object.
|
|
126
120
|
"""
|
|
127
|
-
return
|
|
121
|
+
return get_run(entity_key)
|
|
128
122
|
|
|
129
|
-
def delete_run(self, entity_key: str) ->
|
|
123
|
+
def delete_run(self, entity_key: str) -> None:
|
|
130
124
|
"""
|
|
131
125
|
Delete run.
|
|
132
126
|
|
|
@@ -137,7 +131,6 @@ class Task(UnversionedEntity):
|
|
|
137
131
|
|
|
138
132
|
Returns
|
|
139
133
|
-------
|
|
140
|
-
|
|
141
|
-
Response from backend.
|
|
134
|
+
None
|
|
142
135
|
"""
|
|
143
|
-
|
|
136
|
+
delete_run(entity_key)
|
|
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
import typing
|
|
4
4
|
|
|
5
5
|
from digitalhub.entities._base.executable.entity import ExecutableEntity
|
|
6
|
-
from digitalhub.entities._commons.enums import EntityTypes
|
|
6
|
+
from digitalhub.entities._commons.enums import EntityTypes
|
|
7
7
|
from digitalhub.factory.api import get_run_kind, get_task_kind_from_action
|
|
8
8
|
from digitalhub.utils.exceptions import BackendError
|
|
9
9
|
|
|
@@ -44,7 +44,7 @@ class Workflow(ExecutableEntity):
|
|
|
44
44
|
def run(
|
|
45
45
|
self,
|
|
46
46
|
action: str,
|
|
47
|
-
wait: bool =
|
|
47
|
+
wait: bool = True,
|
|
48
48
|
log_info: bool = True,
|
|
49
49
|
**kwargs,
|
|
50
50
|
) -> Run:
|
|
@@ -55,10 +55,7 @@ class Workflow(ExecutableEntity):
|
|
|
55
55
|
----------
|
|
56
56
|
action : str
|
|
57
57
|
Action to execute.
|
|
58
|
-
|
|
59
|
-
Flag to wait for execution to finish.
|
|
60
|
-
log_info : bool
|
|
61
|
-
Flag to log information while waiting.
|
|
58
|
+
|
|
62
59
|
**kwargs : dict
|
|
63
60
|
Keyword arguments passed to Run builder.
|
|
64
61
|
|
|
@@ -79,12 +76,7 @@ class Workflow(ExecutableEntity):
|
|
|
79
76
|
raise BackendError("Cannot run workflow with local backend.")
|
|
80
77
|
|
|
81
78
|
# Run task
|
|
82
|
-
run = task.run(run_kind,
|
|
83
|
-
|
|
84
|
-
# Set as run's parent
|
|
85
|
-
run.add_relationship(Relationship.RUN_OF.value, self.key)
|
|
86
|
-
run.save()
|
|
87
|
-
|
|
79
|
+
run = task.run(run_kind, local_execution=False, **kwargs)
|
|
88
80
|
if wait:
|
|
89
81
|
return run.wait(log_info=log_info)
|
|
90
82
|
return run
|
digitalhub/stores/_base/store.py
CHANGED
|
@@ -52,17 +52,13 @@ class Store:
|
|
|
52
52
|
"""
|
|
53
53
|
|
|
54
54
|
@abstractmethod
|
|
55
|
-
def upload(self, src: str | list[str], dst: str) -> list[tuple[str, str]]:
|
|
55
|
+
def upload(self, src: str | list[str], dst: str | None = None) -> list[tuple[str, str]]:
|
|
56
56
|
"""
|
|
57
57
|
Method to upload artifact to storage.
|
|
58
58
|
"""
|
|
59
59
|
|
|
60
60
|
@abstractmethod
|
|
61
|
-
def get_file_info(
|
|
62
|
-
self,
|
|
63
|
-
root: str,
|
|
64
|
-
paths: list[tuple[str, str]],
|
|
65
|
-
) -> list[dict]:
|
|
61
|
+
def get_file_info(self, paths: list[str]) -> list[dict]:
|
|
66
62
|
"""
|
|
67
63
|
Method to get file metadata.
|
|
68
64
|
"""
|
digitalhub/stores/local/store.py
CHANGED
|
@@ -61,7 +61,7 @@ class LocalStore(Store):
|
|
|
61
61
|
"""
|
|
62
62
|
raise StoreError("Local store does not support download.")
|
|
63
63
|
|
|
64
|
-
def upload(self, src: str | list[str], dst: str) -> list[tuple[str, str]]:
|
|
64
|
+
def upload(self, src: str | list[str], dst: str | None = None) -> list[tuple[str, str]]:
|
|
65
65
|
"""
|
|
66
66
|
Upload an artifact to storage.
|
|
67
67
|
|
|
@@ -72,11 +72,7 @@ class LocalStore(Store):
|
|
|
72
72
|
"""
|
|
73
73
|
raise StoreError("Local store does not support upload.")
|
|
74
74
|
|
|
75
|
-
def get_file_info(
|
|
76
|
-
self,
|
|
77
|
-
root: str,
|
|
78
|
-
paths: list[tuple[str, str]],
|
|
79
|
-
) -> list[dict]:
|
|
75
|
+
def get_file_info(self, paths: list[str]) -> list[dict]:
|
|
80
76
|
"""
|
|
81
77
|
Method to get file metadata.
|
|
82
78
|
|
|
@@ -69,7 +69,7 @@ class RemoteStore(Store):
|
|
|
69
69
|
|
|
70
70
|
return self._download_file(root, dst, overwrite)
|
|
71
71
|
|
|
72
|
-
def upload(self, src: str | list[str], dst: str) -> list[tuple[str, str]]:
|
|
72
|
+
def upload(self, src: str | list[str], dst: str | None = None) -> list[tuple[str, str]]:
|
|
73
73
|
"""
|
|
74
74
|
Upload an artifact to storage.
|
|
75
75
|
|
|
@@ -80,11 +80,7 @@ class RemoteStore(Store):
|
|
|
80
80
|
"""
|
|
81
81
|
raise StoreError("Remote HTTP store does not support upload.")
|
|
82
82
|
|
|
83
|
-
def get_file_info(
|
|
84
|
-
self,
|
|
85
|
-
root: str,
|
|
86
|
-
paths: list[tuple[str, str]],
|
|
87
|
-
) -> list[dict]:
|
|
83
|
+
def get_file_info(self, paths: list[str]) -> list[dict]:
|
|
88
84
|
"""
|
|
89
85
|
Get file information from HTTP(s) storage.
|
|
90
86
|
|