digitalhub-runtime-python 0.6.0b0__tar.gz → 0.6.0b2__tar.gz
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.
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/PKG-INFO +2 -2
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python/__init__.py +1 -1
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python/entities/functions/spec.py +2 -1
- digitalhub_runtime_python-0.6.0b2/digitalhub_runtime_python/entities/tasks/models.py +12 -0
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python/entities/tasks/status.py +6 -0
- digitalhub_runtime_python-0.6.0b2/digitalhub_runtime_python/utils/env.py +3 -0
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python/utils/inputs.py +8 -10
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python/utils/outputs.py +32 -7
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python.egg-info/PKG-INFO +2 -2
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python.egg-info/SOURCES.txt +1 -0
- digitalhub_runtime_python-0.6.0b2/digitalhub_runtime_python.egg-info/requires.txt +1 -0
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/pyproject.toml +3 -3
- digitalhub_runtime_python-0.6.0b0/digitalhub_runtime_python/entities/tasks/models.py +0 -31
- digitalhub_runtime_python-0.6.0b0/digitalhub_runtime_python.egg-info/requires.txt +0 -1
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/LICENSE.txt +0 -0
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/README.md +0 -0
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python/entities/__init__.py +0 -0
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python/entities/functions/__init__.py +0 -0
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python/entities/functions/status.py +0 -0
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python/entities/runs/__init__.py +0 -0
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python/entities/runs/spec.py +0 -0
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python/entities/runs/status.py +0 -0
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python/entities/tasks/__init__.py +0 -0
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python/entities/tasks/spec.py +0 -0
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python/runtimes/__init__.py +0 -0
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python/runtimes/kind_registry.py +0 -0
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python/runtimes/runtime.py +0 -0
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python/utils/configuration.py +0 -0
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python/utils/utils.py +0 -0
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python.egg-info/dependency_links.txt +0 -0
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/digitalhub_runtime_python.egg-info/top_level.txt +0 -0
- {digitalhub_runtime_python-0.6.0b0 → digitalhub_runtime_python-0.6.0b2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: digitalhub-runtime-python
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.0b2
|
|
4
4
|
Summary: Python runtime for DHCore
|
|
5
5
|
Author-email: Fondazione Bruno Kessler <dslab@fbk.eu>, Matteo Martini <mmartini@fbk.eu>
|
|
6
6
|
License: Apache License
|
|
@@ -228,6 +228,6 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
228
228
|
Requires-Python: >=3.9
|
|
229
229
|
Description-Content-Type: text/markdown
|
|
230
230
|
License-File: LICENSE.txt
|
|
231
|
-
Requires-Dist: digitalhub[ml]
|
|
231
|
+
Requires-Dist: digitalhub[ml]>=0.6.0b
|
|
232
232
|
|
|
233
233
|
# SDK for DHCore
|
|
@@ -27,7 +27,7 @@ registry.register(func_kind, func_info)
|
|
|
27
27
|
|
|
28
28
|
# Tasks
|
|
29
29
|
entity_type = EntityTypes.TASKS.value
|
|
30
|
-
for i in ["job", "build"]:
|
|
30
|
+
for i in ["job", "build", "serve"]:
|
|
31
31
|
task_kind = f"{func_kind}+{i}"
|
|
32
32
|
prefix = entity_type.removesuffix("s").capitalize()
|
|
33
33
|
suffix = i.capitalize()
|
|
@@ -4,6 +4,7 @@ Function Conatiner specification module.
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
6
6
|
from pathlib import Path
|
|
7
|
+
from typing import Literal
|
|
7
8
|
|
|
8
9
|
from digitalhub_core.entities.functions.spec import FunctionParams, FunctionSpec, SourceCodeStruct
|
|
9
10
|
from digitalhub_core.utils.exceptions import EntityError
|
|
@@ -137,7 +138,7 @@ class FunctionParamsPython(FunctionParams):
|
|
|
137
138
|
base_image: str = None
|
|
138
139
|
"Base image"
|
|
139
140
|
|
|
140
|
-
python_version:
|
|
141
|
+
python_version: Literal["PYTHON3_9", "PYTHON3_10"] = None
|
|
141
142
|
"Python version"
|
|
142
143
|
|
|
143
144
|
requirements: list = None
|
|
@@ -121,25 +121,23 @@ def compose_inputs(
|
|
|
121
121
|
_has_context = "context" in fnc_parameters
|
|
122
122
|
_has_event = "event" in fnc_parameters
|
|
123
123
|
|
|
124
|
+
# Project is reserved keyword argument
|
|
125
|
+
# both in local and remote executions
|
|
124
126
|
if _has_project:
|
|
125
|
-
if _has_context:
|
|
127
|
+
if _has_context and not local_execution:
|
|
126
128
|
fnc_args["project"] = context.project
|
|
127
129
|
elif isinstance(project, str):
|
|
128
130
|
fnc_args["project"] = get_project_(project)
|
|
129
131
|
else:
|
|
130
132
|
fnc_args["project"] = project
|
|
131
133
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
# Context and event are reserved keyword arguments
|
|
135
|
+
# only in remote executions
|
|
136
|
+
if not local_execution:
|
|
137
|
+
if _has_context:
|
|
134
138
|
fnc_args["context"] = context
|
|
135
|
-
|
|
136
|
-
raise RuntimeError("Context is not available on local execution.")
|
|
137
|
-
|
|
138
|
-
if _has_event:
|
|
139
|
-
if event is not None and not local_execution:
|
|
139
|
+
if _has_event:
|
|
140
140
|
fnc_args["event"] = event
|
|
141
|
-
else:
|
|
142
|
-
raise RuntimeError("Event is not available on local execution.")
|
|
143
141
|
|
|
144
142
|
return fnc_args
|
|
145
143
|
|
|
@@ -6,10 +6,14 @@ from typing import Any
|
|
|
6
6
|
from digitalhub_core.entities._base.status import State
|
|
7
7
|
from digitalhub_core.entities.artifacts.crud import new_artifact
|
|
8
8
|
from digitalhub_core.entities.artifacts.entity import Artifact
|
|
9
|
+
from digitalhub_core.utils.generic_utils import build_uuid
|
|
9
10
|
from digitalhub_core.utils.logger import LOGGER
|
|
10
|
-
from digitalhub_data.entities.dataitems.crud import
|
|
11
|
+
from digitalhub_data.entities.dataitems.crud import create_dataitem
|
|
11
12
|
from digitalhub_data.entities.dataitems.entity.table import DataitemTable
|
|
13
|
+
from digitalhub_data.readers.builder import get_reader_by_object
|
|
12
14
|
from digitalhub_data.readers.registry import DATAFRAME_TYPES
|
|
15
|
+
from digitalhub_ml.entities.entity_types import EntityTypes
|
|
16
|
+
from digitalhub_runtime_python.utils.env import S3_BUCKET
|
|
13
17
|
|
|
14
18
|
|
|
15
19
|
def collect_outputs(results: Any, outputs: list[str], project_name: str) -> dict:
|
|
@@ -117,8 +121,22 @@ def build_and_load_dataitem(name: str, project_name: str, data: Any) -> Dataitem
|
|
|
117
121
|
Dataitem key.
|
|
118
122
|
"""
|
|
119
123
|
try:
|
|
120
|
-
|
|
121
|
-
|
|
124
|
+
kwargs = {}
|
|
125
|
+
kwargs["project"] = project_name
|
|
126
|
+
kwargs["name"] = name
|
|
127
|
+
kwargs["kind"] = "table"
|
|
128
|
+
new_id = build_uuid()
|
|
129
|
+
kwargs["uuid"] = new_id
|
|
130
|
+
kwargs["path"] = f"s3://{S3_BUCKET}/{project_name}/{EntityTypes.DATAITEMS.value}/{new_id}/data.parquet"
|
|
131
|
+
|
|
132
|
+
di: DataitemTable = create_dataitem(**kwargs)
|
|
133
|
+
|
|
134
|
+
reader = get_reader_by_object(data)
|
|
135
|
+
di.spec.schema = reader.get_schema(data)
|
|
136
|
+
di.status.preview = reader.get_preview(data)
|
|
137
|
+
|
|
138
|
+
di.save()
|
|
139
|
+
|
|
122
140
|
di.write_df(df=data)
|
|
123
141
|
return di
|
|
124
142
|
except Exception as e:
|
|
@@ -146,14 +164,21 @@ def build_and_load_artifact(name: str, project_name: str, data: Any) -> Artifact
|
|
|
146
164
|
Artifact key.
|
|
147
165
|
"""
|
|
148
166
|
try:
|
|
149
|
-
|
|
167
|
+
kwargs = {}
|
|
168
|
+
kwargs["project"] = project_name
|
|
169
|
+
kwargs["name"] = name
|
|
170
|
+
kwargs["kind"] = "artifact"
|
|
171
|
+
new_id = build_uuid()
|
|
172
|
+
kwargs["uuid"] = new_id
|
|
173
|
+
pickle_file = f"{name}.pickle"
|
|
174
|
+
kwargs["path"] = f"s3://{S3_BUCKET}/{project_name}/{EntityTypes.ARTIFACTS.value}/{new_id}/{pickle_file}"
|
|
150
175
|
|
|
151
176
|
# Dump item to pickle
|
|
152
|
-
with open(
|
|
177
|
+
with open(pickle_file, "wb") as f:
|
|
153
178
|
f.write(pickle.dumps(data))
|
|
154
179
|
|
|
155
|
-
art = new_artifact(
|
|
156
|
-
art.upload(source=
|
|
180
|
+
art = new_artifact(**kwargs)
|
|
181
|
+
art.upload(source=pickle_file)
|
|
157
182
|
return art
|
|
158
183
|
|
|
159
184
|
except Exception as e:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: digitalhub-runtime-python
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.0b2
|
|
4
4
|
Summary: Python runtime for DHCore
|
|
5
5
|
Author-email: Fondazione Bruno Kessler <dslab@fbk.eu>, Matteo Martini <mmartini@fbk.eu>
|
|
6
6
|
License: Apache License
|
|
@@ -228,6 +228,6 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
228
228
|
Requires-Python: >=3.9
|
|
229
229
|
Description-Content-Type: text/markdown
|
|
230
230
|
License-File: LICENSE.txt
|
|
231
|
-
Requires-Dist: digitalhub[ml]
|
|
231
|
+
Requires-Dist: digitalhub[ml]>=0.6.0b
|
|
232
232
|
|
|
233
233
|
# SDK for DHCore
|
|
@@ -22,6 +22,7 @@ digitalhub_runtime_python/runtimes/__init__.py
|
|
|
22
22
|
digitalhub_runtime_python/runtimes/kind_registry.py
|
|
23
23
|
digitalhub_runtime_python/runtimes/runtime.py
|
|
24
24
|
digitalhub_runtime_python/utils/configuration.py
|
|
25
|
+
digitalhub_runtime_python/utils/env.py
|
|
25
26
|
digitalhub_runtime_python/utils/inputs.py
|
|
26
27
|
digitalhub_runtime_python/utils/outputs.py
|
|
27
28
|
digitalhub_runtime_python/utils/utils.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
digitalhub[ml]>=0.6.0b
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "digitalhub-runtime-python"
|
|
7
|
-
version = "0.6.
|
|
7
|
+
version = "0.6.0b2"
|
|
8
8
|
description = "Python runtime for DHCore"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [
|
|
@@ -20,7 +20,7 @@ classifiers = [
|
|
|
20
20
|
keywords = ["data", "dataops", "kubernetes"]
|
|
21
21
|
requires-python = ">=3.9"
|
|
22
22
|
dependencies = [
|
|
23
|
-
"digitalhub[ml]
|
|
23
|
+
"digitalhub[ml]>=0.6.0b",
|
|
24
24
|
]
|
|
25
25
|
|
|
26
26
|
[project.urls]
|
|
@@ -39,7 +39,7 @@ line-length = 120
|
|
|
39
39
|
convention = "numpy"
|
|
40
40
|
|
|
41
41
|
[tool.bumpver]
|
|
42
|
-
current_version = "0.6.
|
|
42
|
+
current_version = "0.6.0b2"
|
|
43
43
|
version_pattern = "MAJOR.MINOR.PATCH[PYTAGNUM]"
|
|
44
44
|
commit_message = "Bump version {old_version} -> {new_version}"
|
|
45
45
|
commit = false
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class CorePort(BaseModel):
|
|
7
|
-
"""
|
|
8
|
-
Port mapper model.
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
port: int
|
|
12
|
-
target_port: int
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class ContextRef(BaseModel):
|
|
16
|
-
"""
|
|
17
|
-
ContextRef model.
|
|
18
|
-
"""
|
|
19
|
-
|
|
20
|
-
destination: str = None
|
|
21
|
-
protocol: str = None
|
|
22
|
-
source: str = None
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class ContextSource(BaseModel):
|
|
26
|
-
"""
|
|
27
|
-
ContextSource model.
|
|
28
|
-
"""
|
|
29
|
-
|
|
30
|
-
base64: str = None
|
|
31
|
-
name: str = None
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
digitalhub[ml]<0.7,~=0.6.0b
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|