digitalhub 0.9.2__py3-none-any.whl → 0.10.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 +2 -3
- digitalhub/client/_base/api_builder.py +1 -1
- digitalhub/client/_base/client.py +25 -2
- digitalhub/client/_base/params_builder.py +16 -0
- digitalhub/client/dhcore/api_builder.py +9 -3
- digitalhub/client/dhcore/client.py +30 -398
- digitalhub/client/dhcore/configurator.py +361 -0
- digitalhub/client/dhcore/error_parser.py +107 -0
- digitalhub/client/dhcore/models.py +13 -23
- digitalhub/client/dhcore/params_builder.py +178 -0
- digitalhub/client/dhcore/utils.py +4 -44
- digitalhub/client/local/api_builder.py +13 -18
- digitalhub/client/local/client.py +18 -2
- digitalhub/client/local/enums.py +11 -0
- digitalhub/client/local/params_builder.py +116 -0
- digitalhub/configurator/api.py +31 -0
- digitalhub/configurator/configurator.py +195 -0
- digitalhub/configurator/credentials_store.py +65 -0
- digitalhub/configurator/ini_module.py +74 -0
- digitalhub/entities/_base/_base/entity.py +2 -2
- digitalhub/entities/_base/context/entity.py +4 -4
- digitalhub/entities/_base/entity/builder.py +5 -5
- digitalhub/entities/_base/executable/entity.py +2 -2
- digitalhub/entities/_base/material/entity.py +12 -12
- digitalhub/entities/_base/material/status.py +1 -1
- digitalhub/entities/_base/material/utils.py +2 -2
- digitalhub/entities/_base/unversioned/entity.py +2 -2
- digitalhub/entities/_base/versioned/entity.py +2 -2
- digitalhub/entities/_commons/enums.py +2 -0
- digitalhub/entities/_commons/metrics.py +164 -0
- digitalhub/entities/_commons/types.py +5 -0
- digitalhub/entities/_commons/utils.py +2 -2
- digitalhub/entities/_processors/base.py +527 -0
- digitalhub/entities/{_operations/processor.py → _processors/context.py} +212 -837
- digitalhub/entities/_processors/utils.py +158 -0
- digitalhub/entities/artifact/artifact/spec.py +3 -1
- digitalhub/entities/artifact/crud.py +13 -12
- digitalhub/entities/artifact/utils.py +1 -1
- digitalhub/entities/builders.py +6 -18
- digitalhub/entities/dataitem/_base/entity.py +0 -41
- digitalhub/entities/dataitem/crud.py +27 -15
- digitalhub/entities/dataitem/table/entity.py +49 -35
- digitalhub/entities/dataitem/table/models.py +4 -3
- digitalhub/{utils/data_utils.py → entities/dataitem/table/utils.py} +46 -54
- digitalhub/entities/dataitem/utils.py +58 -10
- digitalhub/entities/function/crud.py +9 -9
- digitalhub/entities/model/_base/entity.py +120 -0
- digitalhub/entities/model/_base/spec.py +6 -17
- digitalhub/entities/model/_base/status.py +10 -0
- digitalhub/entities/model/crud.py +13 -12
- digitalhub/entities/model/huggingface/spec.py +9 -4
- digitalhub/entities/model/mlflow/models.py +2 -2
- digitalhub/entities/model/mlflow/spec.py +7 -7
- digitalhub/entities/model/mlflow/utils.py +44 -5
- digitalhub/entities/project/_base/entity.py +317 -9
- digitalhub/entities/project/_base/spec.py +8 -6
- digitalhub/entities/project/crud.py +12 -11
- digitalhub/entities/run/_base/entity.py +103 -6
- digitalhub/entities/run/_base/spec.py +4 -2
- digitalhub/entities/run/_base/status.py +12 -0
- digitalhub/entities/run/crud.py +8 -8
- digitalhub/entities/secret/_base/entity.py +3 -3
- digitalhub/entities/secret/_base/spec.py +4 -2
- digitalhub/entities/secret/crud.py +11 -9
- digitalhub/entities/task/_base/entity.py +4 -4
- digitalhub/entities/task/_base/models.py +51 -40
- digitalhub/entities/task/_base/spec.py +2 -0
- digitalhub/entities/task/_base/utils.py +2 -2
- digitalhub/entities/task/crud.py +12 -8
- digitalhub/entities/workflow/crud.py +9 -9
- digitalhub/factory/utils.py +9 -9
- digitalhub/readers/{_base → data/_base}/builder.py +1 -1
- digitalhub/readers/{_base → data/_base}/reader.py +16 -4
- digitalhub/readers/{api.py → data/api.py} +2 -2
- digitalhub/readers/{factory.py → data/factory.py} +3 -3
- digitalhub/readers/{pandas → data/pandas}/builder.py +2 -2
- digitalhub/readers/{pandas → data/pandas}/reader.py +110 -30
- digitalhub/readers/query/__init__.py +0 -0
- digitalhub/stores/_base/store.py +59 -69
- digitalhub/stores/api.py +8 -33
- digitalhub/stores/builder.py +44 -161
- digitalhub/stores/local/store.py +106 -89
- digitalhub/stores/remote/store.py +86 -11
- digitalhub/stores/s3/configurator.py +108 -0
- digitalhub/stores/s3/enums.py +17 -0
- digitalhub/stores/s3/models.py +21 -0
- digitalhub/stores/s3/store.py +154 -70
- digitalhub/{utils/s3_utils.py → stores/s3/utils.py} +7 -3
- digitalhub/stores/sql/configurator.py +88 -0
- digitalhub/stores/sql/enums.py +16 -0
- digitalhub/stores/sql/models.py +24 -0
- digitalhub/stores/sql/store.py +106 -85
- digitalhub/{readers/_commons → utils}/enums.py +5 -1
- digitalhub/utils/exceptions.py +6 -0
- digitalhub/utils/file_utils.py +8 -7
- digitalhub/utils/generic_utils.py +28 -15
- digitalhub/utils/git_utils.py +16 -9
- digitalhub/utils/types.py +5 -0
- digitalhub/utils/uri_utils.py +2 -2
- {digitalhub-0.9.2.dist-info → digitalhub-0.10.0.dist-info}/METADATA +25 -31
- {digitalhub-0.9.2.dist-info → digitalhub-0.10.0.dist-info}/RECORD +108 -99
- {digitalhub-0.9.2.dist-info → digitalhub-0.10.0.dist-info}/WHEEL +1 -2
- digitalhub/client/dhcore/env.py +0 -23
- digitalhub/entities/_base/project/entity.py +0 -341
- digitalhub-0.9.2.dist-info/top_level.txt +0 -2
- test/local/CRUD/test_artifacts.py +0 -96
- test/local/CRUD/test_dataitems.py +0 -96
- test/local/CRUD/test_models.py +0 -95
- test/local/imports/test_imports.py +0 -66
- test/local/instances/test_validate.py +0 -55
- test/test_crud_functions.py +0 -109
- test/test_crud_runs.py +0 -86
- test/test_crud_tasks.py +0 -81
- test/testkfp.py +0 -37
- test/testkfp_pipeline.py +0 -22
- /digitalhub/{entities/_base/project → configurator}/__init__.py +0 -0
- /digitalhub/entities/{_operations → _processors}/__init__.py +0 -0
- /digitalhub/readers/{_base → data}/__init__.py +0 -0
- /digitalhub/readers/{_commons → data/_base}/__init__.py +0 -0
- /digitalhub/readers/{pandas → data/pandas}/__init__.py +0 -0
- {digitalhub-0.9.2.dist-info → digitalhub-0.10.0.dist-info/licenses}/LICENSE.txt +0 -0
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import pytest
|
|
3
|
-
from glob import glob
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
import json
|
|
6
|
-
from jsonschema import validate
|
|
7
|
-
from digitalhub.factory.factory import factory
|
|
8
|
-
|
|
9
|
-
entities_path = "test/local/instances/entities"
|
|
10
|
-
schemas_path = "test/local/instances/schemas"
|
|
11
|
-
|
|
12
|
-
# Build dict: kind -> path to schema file
|
|
13
|
-
schemas = {}
|
|
14
|
-
for path_to_schema in glob(f"{schemas_path}/**/*.json", recursive=True):
|
|
15
|
-
kind = Path(path_to_schema).stem
|
|
16
|
-
schemas[kind] = path_to_schema
|
|
17
|
-
|
|
18
|
-
# Build dict: name of file to validate -> full path to file
|
|
19
|
-
entity_paths = {}
|
|
20
|
-
for path_to_file in glob(f"{entities_path}/**/*.json", recursive=True):
|
|
21
|
-
file_name = os.path.basename(path_to_file)
|
|
22
|
-
|
|
23
|
-
# If a file in a nested directory causes a name collision, use its full path as name
|
|
24
|
-
if file_name in entity_paths:
|
|
25
|
-
file_name = path_to_file
|
|
26
|
-
|
|
27
|
-
entity_paths[file_name] = path_to_file
|
|
28
|
-
|
|
29
|
-
# Build object from JSON file using factory
|
|
30
|
-
def build_obj(entity_file_path):
|
|
31
|
-
with open(entity_file_path) as f:
|
|
32
|
-
entity = json.load(f)
|
|
33
|
-
|
|
34
|
-
kind = entity["kind"]
|
|
35
|
-
spec = entity["spec"]
|
|
36
|
-
|
|
37
|
-
built = factory.build_spec(kind, **spec)
|
|
38
|
-
return built.to_dict(), kind
|
|
39
|
-
|
|
40
|
-
# Validate built object against its kind's schema
|
|
41
|
-
def is_valid(built, kind):
|
|
42
|
-
with open(schemas[kind]) as schema_file:
|
|
43
|
-
schema = json.load(schema_file)
|
|
44
|
-
|
|
45
|
-
validate(instance=built, schema=schema)
|
|
46
|
-
return True
|
|
47
|
-
|
|
48
|
-
# Tests that each JSON file contained in the specified path can successfully be
|
|
49
|
-
# used to generate an object through the factory, and that each generated object,
|
|
50
|
-
# when exported to dict, validates (through jsonschema) against its kind's schema.
|
|
51
|
-
class TestValidate:
|
|
52
|
-
@pytest.mark.parametrize('file_name', list(entity_paths.keys()))
|
|
53
|
-
def test_validate(self, file_name):
|
|
54
|
-
built, kind = build_obj(f"{entity_paths[file_name]}")
|
|
55
|
-
assert is_valid(built, kind)
|
test/test_crud_functions.py
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
from copy import deepcopy
|
|
2
|
-
|
|
3
|
-
import dotenv
|
|
4
|
-
|
|
5
|
-
import digitalhub
|
|
6
|
-
from digitalhub.entities.function._base.entity import Function
|
|
7
|
-
|
|
8
|
-
dotenv.load_dotenv()
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def add_param(kwargs) -> dict:
|
|
12
|
-
if kwargs["kind"] == "dbt":
|
|
13
|
-
kwargs["source"] = {"code": "test"}
|
|
14
|
-
|
|
15
|
-
if kwargs["kind"] == "mlrun":
|
|
16
|
-
kwargs["source"] = {"code": "test"}
|
|
17
|
-
|
|
18
|
-
if kwargs["kind"] == "container":
|
|
19
|
-
kwargs["image"] = "test"
|
|
20
|
-
|
|
21
|
-
if kwargs["kind"] == "nefertem":
|
|
22
|
-
pass
|
|
23
|
-
|
|
24
|
-
return kwargs
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
names = ["test1", "test2", "test3", "test4"]
|
|
28
|
-
uuids = [
|
|
29
|
-
"12a01efa-o44f-4991-b153-9a3c358b7bb0",
|
|
30
|
-
"8e367f52-25bb-4df1-b9c9-a58045b377a0",
|
|
31
|
-
"1678f9ab-a2e0-48ff-870a-2384o3fa1334",
|
|
32
|
-
"adb746dd-4e81-4ff8-82de-4916624o17dc",
|
|
33
|
-
]
|
|
34
|
-
kind = ["mlrun", "dbt", "container", "nefertem"]
|
|
35
|
-
|
|
36
|
-
dicts = []
|
|
37
|
-
for i in range(len(names)):
|
|
38
|
-
dicts.append({"name": names[i], "uuid": uuids[i], "kind": kind[i]})
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
digitalhub.delete_project("test")
|
|
42
|
-
|
|
43
|
-
p = digitalhub.get_or_create_project("test")
|
|
44
|
-
|
|
45
|
-
# Create and delete functions
|
|
46
|
-
for i in dicts:
|
|
47
|
-
i = add_param(i)
|
|
48
|
-
d = digitalhub.new_function(p.name, **i)
|
|
49
|
-
digitalhub.delete_function(p.name, entity_id=d.id)
|
|
50
|
-
d = digitalhub.new_function(p.name, **i)
|
|
51
|
-
digitalhub.delete_function(p.name, entity_name=d.name)
|
|
52
|
-
d = p.new_function(**i)
|
|
53
|
-
p.delete_function(entity_id=d.id)
|
|
54
|
-
|
|
55
|
-
# Create multiple functions
|
|
56
|
-
for i in dicts:
|
|
57
|
-
i = add_param(i)
|
|
58
|
-
digitalhub.new_function(p.name, **i)
|
|
59
|
-
|
|
60
|
-
c = deepcopy(i)
|
|
61
|
-
c.pop("uuid")
|
|
62
|
-
digitalhub.new_function(p.name, **c)
|
|
63
|
-
digitalhub.new_function(p.name, **c)
|
|
64
|
-
digitalhub.new_function(p.name, **c)
|
|
65
|
-
digitalhub.new_function(p.name, **c)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
# List functions
|
|
69
|
-
l_obj = digitalhub.list_functions(p.name)
|
|
70
|
-
assert isinstance(l_obj, list)
|
|
71
|
-
assert len(l_obj) == 4
|
|
72
|
-
for i in l_obj:
|
|
73
|
-
assert isinstance(i, dict)
|
|
74
|
-
|
|
75
|
-
for uuid in uuids:
|
|
76
|
-
digitalhub.delete_function(p.name, entity_id=uuid)
|
|
77
|
-
|
|
78
|
-
# Get functions test
|
|
79
|
-
for i in dicts:
|
|
80
|
-
i = add_param(i)
|
|
81
|
-
o1 = digitalhub.new_function(p.name, **i)
|
|
82
|
-
assert isinstance(o1, Function)
|
|
83
|
-
|
|
84
|
-
# Get by id
|
|
85
|
-
o2 = digitalhub.get_function(p.name, entity_id=o1.id)
|
|
86
|
-
assert isinstance(o2, Function)
|
|
87
|
-
assert o1.id == o2.id
|
|
88
|
-
|
|
89
|
-
# Get by name
|
|
90
|
-
o3 = digitalhub.get_function(p.name, entity_name=o1.name)
|
|
91
|
-
assert isinstance(o3, Function)
|
|
92
|
-
assert o1.id == o3.id
|
|
93
|
-
|
|
94
|
-
# Get by name as latest
|
|
95
|
-
c = deepcopy(i)
|
|
96
|
-
c.pop("uuid")
|
|
97
|
-
o4 = digitalhub.new_function(p.name, **c)
|
|
98
|
-
o5 = digitalhub.get_function(p.name, entity_name=o1.name)
|
|
99
|
-
assert isinstance(o5, Function)
|
|
100
|
-
assert (o5.id != o1.id) and (o5.name == o1.name) and (o5.id == o4.id)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
# Delete functions, all versions
|
|
104
|
-
for n in names:
|
|
105
|
-
digitalhub.delete_function(p.name, entity_name=n, delete_all_versions=True)
|
|
106
|
-
l_obj = digitalhub.list_functions(p.name)
|
|
107
|
-
assert not l_obj
|
|
108
|
-
|
|
109
|
-
digitalhub.delete_project("test")
|
test/test_crud_runs.py
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import dotenv
|
|
2
|
-
|
|
3
|
-
import digitalhub
|
|
4
|
-
from digitalhub.entities.run._base.entity import Run
|
|
5
|
-
|
|
6
|
-
dotenv.load_dotenv()
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def add_param(kwargs) -> dict:
|
|
10
|
-
if kwargs["kind"] == "mlrun+run":
|
|
11
|
-
kwargs["task"] = t1._get_task_string()
|
|
12
|
-
|
|
13
|
-
if kwargs["kind"] == "dbt+run":
|
|
14
|
-
kwargs["task"] = t2._get_task_string()
|
|
15
|
-
|
|
16
|
-
if kwargs["kind"] == "container+run":
|
|
17
|
-
kwargs["task"] = t3._get_task_string()
|
|
18
|
-
|
|
19
|
-
if kwargs["kind"] == "nefertem+run":
|
|
20
|
-
kwargs["task"] = t4._get_task_string()
|
|
21
|
-
|
|
22
|
-
kwargs["local_execution"] = True
|
|
23
|
-
|
|
24
|
-
return kwargs
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
names = ["test1", "test2", "test3", "test4"]
|
|
28
|
-
uuids = [
|
|
29
|
-
"12a01efa-o44f-4991-b153-9a3c358b7bb0",
|
|
30
|
-
"8e367f52-25bb-4df1-b9c9-a58045b377a0",
|
|
31
|
-
"1678f9ab-a2e0-48ff-870a-2384o3fa1334",
|
|
32
|
-
"adb746dd-4e81-4ff8-82de-4916624o17dc",
|
|
33
|
-
]
|
|
34
|
-
kind = ["mlrun+run", "dbt+run", "container+run", "nefertem+run"]
|
|
35
|
-
|
|
36
|
-
dicts = []
|
|
37
|
-
for i in range(len(names)):
|
|
38
|
-
dicts.append({"name": names[i], "uuid": uuids[i], "kind": kind[i]})
|
|
39
|
-
|
|
40
|
-
digitalhub.delete_project("test")
|
|
41
|
-
|
|
42
|
-
p = digitalhub.get_or_create_project("test")
|
|
43
|
-
|
|
44
|
-
f1 = p.new_function(name="t1", kind="mlrun", source={"code": "test"})
|
|
45
|
-
t1 = f1.new_task(kind="mlrun+job")
|
|
46
|
-
f2 = p.new_function(name="t2", kind="dbt", source={"code": "test"})
|
|
47
|
-
t2 = f2.new_task(kind="dbt+transform")
|
|
48
|
-
f3 = p.new_function(name="t3", kind="container", image="test")
|
|
49
|
-
t3 = f3.new_task(kind="container+job")
|
|
50
|
-
f4 = p.new_function(name="t4", kind="nefertem")
|
|
51
|
-
t4 = f4.new_task(kind="nefertem+infer", framework="test")
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
# Create and delete runs
|
|
55
|
-
for i in dicts:
|
|
56
|
-
i = add_param(i)
|
|
57
|
-
d = digitalhub.new_run(p.name, **i)
|
|
58
|
-
digitalhub.delete_run(p.name, entity_id=d.id)
|
|
59
|
-
|
|
60
|
-
# Create multiple runs
|
|
61
|
-
for i in dicts:
|
|
62
|
-
i = add_param(i)
|
|
63
|
-
digitalhub.new_run(p.name, **i)
|
|
64
|
-
|
|
65
|
-
# List runs
|
|
66
|
-
l_obj = digitalhub.list_runs(p.name)
|
|
67
|
-
assert isinstance(l_obj, list)
|
|
68
|
-
assert len(l_obj) == 4
|
|
69
|
-
for i in l_obj:
|
|
70
|
-
assert isinstance(i, dict)
|
|
71
|
-
|
|
72
|
-
for uuid in uuids:
|
|
73
|
-
digitalhub.delete_run(p.name, entity_id=uuid)
|
|
74
|
-
|
|
75
|
-
# Get runs test
|
|
76
|
-
for i in dicts:
|
|
77
|
-
i = add_param(i)
|
|
78
|
-
o1 = digitalhub.new_run(p.name, **i)
|
|
79
|
-
assert isinstance(o1, Run)
|
|
80
|
-
|
|
81
|
-
# Get by id
|
|
82
|
-
o2 = digitalhub.get_run(p.name, entity_id=o1.id)
|
|
83
|
-
assert isinstance(o2, Run)
|
|
84
|
-
assert o1.id == o2.id
|
|
85
|
-
|
|
86
|
-
digitalhub.delete_project("test")
|
test/test_crud_tasks.py
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import dotenv
|
|
2
|
-
|
|
3
|
-
import digitalhub
|
|
4
|
-
from digitalhub.entities.task._base.entity import Task
|
|
5
|
-
|
|
6
|
-
dotenv.load_dotenv()
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def add_param(kwargs) -> dict:
|
|
10
|
-
if kwargs["kind"] == "mlrun+job":
|
|
11
|
-
kwargs["function"] = f1._get_function_string()
|
|
12
|
-
|
|
13
|
-
if kwargs["kind"] == "dbt+transform":
|
|
14
|
-
kwargs["function"] = f2._get_function_string()
|
|
15
|
-
|
|
16
|
-
if kwargs["kind"] == "container+job":
|
|
17
|
-
kwargs["function"] = f3._get_function_string()
|
|
18
|
-
|
|
19
|
-
if kwargs["kind"] == "nefertem+infer":
|
|
20
|
-
kwargs["function"] = f4._get_function_string()
|
|
21
|
-
kwargs["framework"] = "test"
|
|
22
|
-
|
|
23
|
-
return kwargs
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
names = ["test1", "test2", "test3", "test4"]
|
|
27
|
-
uuids = [
|
|
28
|
-
"12a01efa-o44f-4991-b153-9a3c358b7bb0",
|
|
29
|
-
"8e367f52-25bb-4df1-b9c9-a58045b377a0",
|
|
30
|
-
"1678f9ab-a2e0-48ff-870a-2384o3fa1334",
|
|
31
|
-
"adb746dd-4e81-4ff8-82de-4916624o17dc",
|
|
32
|
-
]
|
|
33
|
-
kind = ["mlrun+job", "dbt+transform", "container+job", "nefertem+infer"]
|
|
34
|
-
|
|
35
|
-
dicts = []
|
|
36
|
-
for i in range(len(names)):
|
|
37
|
-
dicts.append({"name": names[i], "uuid": uuids[i], "kind": kind[i]})
|
|
38
|
-
|
|
39
|
-
digitalhub.delete_project("test")
|
|
40
|
-
|
|
41
|
-
p = digitalhub.get_or_create_project("test")
|
|
42
|
-
|
|
43
|
-
f1 = p.new_function(name="t1", kind="mlrun", source={"code": "test"})
|
|
44
|
-
f2 = p.new_function(name="t2", kind="dbt", source={"code": "test"})
|
|
45
|
-
f3 = p.new_function(name="t3", kind="container", image="test")
|
|
46
|
-
f4 = p.new_function(name="t4", kind="nefertem")
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
# Create and delete tasks
|
|
50
|
-
for i in dicts:
|
|
51
|
-
i = add_param(i)
|
|
52
|
-
d = digitalhub.new_task(p.name, **i)
|
|
53
|
-
digitalhub.delete_task(p.name, entity_id=d.id)
|
|
54
|
-
|
|
55
|
-
# Create multiple tasks
|
|
56
|
-
for i in dicts:
|
|
57
|
-
i = add_param(i)
|
|
58
|
-
digitalhub.new_task(p.name, **i)
|
|
59
|
-
|
|
60
|
-
# List tasks
|
|
61
|
-
l_obj = digitalhub.list_tasks(p.name)
|
|
62
|
-
assert isinstance(l_obj, list)
|
|
63
|
-
assert len(l_obj) == 4
|
|
64
|
-
for i in l_obj:
|
|
65
|
-
assert isinstance(i, dict)
|
|
66
|
-
|
|
67
|
-
for uuid in uuids:
|
|
68
|
-
digitalhub.delete_task(p.name, entity_id=uuid)
|
|
69
|
-
|
|
70
|
-
# Get tasks test
|
|
71
|
-
for i in dicts:
|
|
72
|
-
i = add_param(i)
|
|
73
|
-
o1 = digitalhub.new_task(p.name, **i)
|
|
74
|
-
assert isinstance(o1, Task)
|
|
75
|
-
|
|
76
|
-
# Get by id
|
|
77
|
-
o2 = digitalhub.get_task(p.name, entity_id=o1.id)
|
|
78
|
-
assert isinstance(o2, Task)
|
|
79
|
-
assert o1.id == o2.id
|
|
80
|
-
|
|
81
|
-
digitalhub.delete_project("test")
|
test/testkfp.py
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import time
|
|
3
|
-
|
|
4
|
-
import digitalhub as dh
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def _is_finished(state: str):
|
|
8
|
-
return state == "COMPLETED" or state == "ERROR" or state == "STOPPED"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
os.environ["DHCORE_ENDPOINT"] = "http://localhost:8080/"
|
|
12
|
-
os.environ["DHCORE_WORKFLOW_IMAGE"] = "localhost:5000/dhcoreworkflow9:latest"
|
|
13
|
-
os.environ["KFP_ENDPOINT"] = "http://localhost:8888/"
|
|
14
|
-
|
|
15
|
-
# Get or create project
|
|
16
|
-
project = dh.get_or_create_project("project-kfp2")
|
|
17
|
-
|
|
18
|
-
url = "https://gist.githubusercontent.com/kevin336/acbb2271e66c10a5b73aacf82ca82784/raw/e38afe62e088394d61ed30884dd50a6826eee0a8/employees.csv"
|
|
19
|
-
|
|
20
|
-
di = project.new_dataitem(name="employees", kind="table", path=url)
|
|
21
|
-
|
|
22
|
-
function = project.get_function(entity_name="test-kfp")
|
|
23
|
-
if function is None:
|
|
24
|
-
function = project.new_function(
|
|
25
|
-
name="test-kfp",
|
|
26
|
-
kind="kfp",
|
|
27
|
-
source={"source": "test/testkfp_pipeline.py"},
|
|
28
|
-
handler="myhandler",
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
run = function.run("pipeline", parameters={"ref": di.key}, local_execution=True)
|
|
33
|
-
while not _is_finished(run.status.state):
|
|
34
|
-
time.sleep(5)
|
|
35
|
-
run = run.refresh()
|
|
36
|
-
|
|
37
|
-
print(str(run.status.to_dict()))
|
test/testkfp_pipeline.py
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
from digitalhub_runtime_kfp.dsl import pipeline_context
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def myhandler(ref):
|
|
5
|
-
with pipeline_context() as pc:
|
|
6
|
-
s1 = pc.step(
|
|
7
|
-
name="step1",
|
|
8
|
-
function="function-dbt",
|
|
9
|
-
action="transform",
|
|
10
|
-
inputs=[{"employees": ref}],
|
|
11
|
-
outputs=[{"output_table": "e60"}],
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
s2 = pc.step(
|
|
15
|
-
name="step2",
|
|
16
|
-
function="function-dbt",
|
|
17
|
-
action="transform",
|
|
18
|
-
inputs=[{"employees": s1.outputs["e60"]}],
|
|
19
|
-
outputs=[{"output_table": "employees_pipeline"}],
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
return s2.outputs["employees_pipeline"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|