digitalhub-runtime-python 0.9.1__tar.gz → 0.10.0b0__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.9.1 → digitalhub_runtime_python-0.10.0b0}/PKG-INFO +2 -2
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/function/python/utils.py +3 -3
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/run/python_run/status.py +2 -1
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/utils/configuration.py +4 -2
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/utils/inputs.py +43 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python.egg-info/PKG-INFO +2 -2
- digitalhub_runtime_python-0.10.0b0/digitalhub_runtime_python.egg-info/requires.txt +1 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/pyproject.toml +3 -3
- digitalhub_runtime_python-0.9.1/digitalhub_runtime_python.egg-info/requires.txt +0 -1
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/LICENSE.txt +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/README.md +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/__init__.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/__init__.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/_base/__init__.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/_base/runtime_entity/__init__.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/_base/runtime_entity/builder.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/_commons/__init__.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/_commons/enums.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/function/__init__.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/function/python/__init__.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/function/python/builder.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/function/python/entity.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/function/python/models.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/function/python/spec.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/function/python/status.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/run/__init__.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/run/python_run/__init__.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/run/python_run/builder.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/run/python_run/entity.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/run/python_run/spec.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/run/python_run/utils.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/task/__init__.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/task/python_build/__init__.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/task/python_build/builder.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/task/python_build/entity.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/task/python_build/spec.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/task/python_build/status.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/task/python_job/__init__.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/task/python_job/builder.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/task/python_job/entity.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/task/python_job/models.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/task/python_job/spec.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/task/python_job/status.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/task/python_serve/__init__.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/task/python_serve/builder.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/task/python_serve/entity.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/task/python_serve/spec.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/entities/task/python_serve/status.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/runtimes/__init__.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/runtimes/builder.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/runtimes/runtime.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/utils/env.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/utils/outputs.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python/utils/utils.py +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python.egg-info/SOURCES.txt +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python.egg-info/dependency_links.txt +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/digitalhub_runtime_python.egg-info/top_level.txt +0 -0
- {digitalhub_runtime_python-0.9.1 → digitalhub_runtime_python-0.10.0b0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: digitalhub-runtime-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10.0b0
|
|
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
|
|
@@ -229,6 +229,6 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
229
229
|
Requires-Python: >=3.9
|
|
230
230
|
Description-Content-Type: text/markdown
|
|
231
231
|
License-File: LICENSE.txt
|
|
232
|
-
Requires-Dist: digitalhub[full]<0.
|
|
232
|
+
Requires-Dist: digitalhub[full]<0.11,>=0.10.0b
|
|
233
233
|
|
|
234
234
|
# SDK for DHCore
|
|
@@ -4,10 +4,10 @@ import typing
|
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
|
|
6
6
|
from digitalhub.stores.api import get_store
|
|
7
|
+
from digitalhub.stores.s3.utils import get_s3_bucket_from_env
|
|
7
8
|
from digitalhub.utils.exceptions import EntityError
|
|
8
9
|
from digitalhub.utils.file_utils import eval_py_type, eval_zip_type
|
|
9
10
|
from digitalhub.utils.generic_utils import encode_source, encode_string
|
|
10
|
-
from digitalhub.utils.s3_utils import get_s3_bucket
|
|
11
11
|
from digitalhub.utils.uri_utils import has_local_scheme
|
|
12
12
|
|
|
13
13
|
from digitalhub_runtime_python.entities.function.python.models import Lang
|
|
@@ -143,8 +143,8 @@ def source_post_check(exec: FunctionPython) -> FunctionPython:
|
|
|
143
143
|
# Check zip
|
|
144
144
|
elif eval_zip_type(code_src):
|
|
145
145
|
filename = Path(code_src).name
|
|
146
|
-
dst = f"zip+s3://{
|
|
147
|
-
get_store(dst).upload(code_src, dst)
|
|
146
|
+
dst = f"zip+s3://{get_s3_bucket_from_env()}/{exec.project}/{exec.ENTITY_TYPE}/{exec.name}/{exec.id}/{filename}"
|
|
147
|
+
get_store(exec.project, dst).upload(code_src, dst)
|
|
148
148
|
exec.spec.source["source"] = dst
|
|
149
149
|
if ":" not in exec.spec.source["handler"]:
|
|
150
150
|
exec.spec.source["handler"] = f"{Path(code_src).stem}:{exec.spec.source['handler']}"
|
|
@@ -14,12 +14,13 @@ class RunStatusPythonRun(RunStatus):
|
|
|
14
14
|
message: str | None = None,
|
|
15
15
|
transitions: list[dict] | None = None,
|
|
16
16
|
k8s: dict | None = None,
|
|
17
|
+
metrics: dict[str, list] | None = None,
|
|
17
18
|
outputs: dict | None = None,
|
|
18
19
|
results: dict | None = None,
|
|
19
20
|
service: dict | None = None,
|
|
20
21
|
**kwargs,
|
|
21
22
|
) -> None:
|
|
22
|
-
super().__init__(state, message, transitions, k8s, **kwargs)
|
|
23
|
+
super().__init__(state, message, transitions, k8s, metrics, **kwargs)
|
|
23
24
|
self.outputs = outputs
|
|
24
25
|
self.results = results
|
|
25
26
|
self.service = service
|
|
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
from typing import Callable, Union
|
|
5
5
|
|
|
6
|
+
from digitalhub.stores.s3.utils import get_bucket_and_key, get_s3_source
|
|
6
7
|
from digitalhub.utils.generic_utils import (
|
|
7
8
|
decode_base64_string,
|
|
8
9
|
extract_archive,
|
|
@@ -11,7 +12,6 @@ from digitalhub.utils.generic_utils import (
|
|
|
11
12
|
)
|
|
12
13
|
from digitalhub.utils.git_utils import clone_repository
|
|
13
14
|
from digitalhub.utils.logger import LOGGER
|
|
14
|
-
from digitalhub.utils.s3_utils import get_bucket_and_key, get_s3_source
|
|
15
15
|
from digitalhub.utils.uri_utils import (
|
|
16
16
|
get_filename_from_uri,
|
|
17
17
|
has_git_scheme,
|
|
@@ -113,7 +113,9 @@ def save_function_source(path: Path, source_spec: dict) -> Path:
|
|
|
113
113
|
|
|
114
114
|
|
|
115
115
|
def import_function_and_init_from_source(
|
|
116
|
-
path: Path,
|
|
116
|
+
path: Path,
|
|
117
|
+
source_spec: dict,
|
|
118
|
+
default_py: str,
|
|
117
119
|
) -> tuple[Callable, Union[Callable, None]]:
|
|
118
120
|
"""
|
|
119
121
|
Import function and init from source.
|
|
@@ -13,6 +13,8 @@ if typing.TYPE_CHECKING:
|
|
|
13
13
|
from digitalhub.entities._base.entity.entity import Entity
|
|
14
14
|
from digitalhub.entities.project._base.entity import Project
|
|
15
15
|
|
|
16
|
+
from digitalhub_runtime_python.entities.run.python_run.entity import RunPythonRun
|
|
17
|
+
|
|
16
18
|
|
|
17
19
|
def get_project_(project_name: str) -> Project:
|
|
18
20
|
"""
|
|
@@ -37,6 +39,33 @@ def get_project_(project_name: str) -> Project:
|
|
|
37
39
|
raise RuntimeError(msg)
|
|
38
40
|
|
|
39
41
|
|
|
42
|
+
def get_run_(project_name: str) -> RunPythonRun:
|
|
43
|
+
"""
|
|
44
|
+
Get run.
|
|
45
|
+
|
|
46
|
+
Parameters
|
|
47
|
+
----------
|
|
48
|
+
project_name : str
|
|
49
|
+
Project name.
|
|
50
|
+
run_id : str
|
|
51
|
+
Run id.
|
|
52
|
+
|
|
53
|
+
Returns
|
|
54
|
+
-------
|
|
55
|
+
Run
|
|
56
|
+
Run.
|
|
57
|
+
"""
|
|
58
|
+
try:
|
|
59
|
+
ctx = get_context(project_name)
|
|
60
|
+
proj = get_project(project_name, local=ctx.local)
|
|
61
|
+
run_key = ctx.get_run_ctx()
|
|
62
|
+
return proj.get_run(run_key)
|
|
63
|
+
except Exception as e:
|
|
64
|
+
msg = f"Error during run collection. Exception: {e.__class__}. Error: {e.args}"
|
|
65
|
+
LOGGER.exception(msg)
|
|
66
|
+
raise RuntimeError(msg)
|
|
67
|
+
|
|
68
|
+
|
|
40
69
|
def get_entity_inputs(inputs: dict) -> dict[str, Entity]:
|
|
41
70
|
"""
|
|
42
71
|
Set inputs.
|
|
@@ -104,6 +133,7 @@ def compose_inputs(
|
|
|
104
133
|
fnc_parameters = inspect.signature(func).parameters
|
|
105
134
|
|
|
106
135
|
_has_project = "project" in fnc_parameters
|
|
136
|
+
_has_run = "run" in fnc_parameters
|
|
107
137
|
_has_context = "context" in fnc_parameters
|
|
108
138
|
_has_event = "event" in fnc_parameters
|
|
109
139
|
|
|
@@ -117,6 +147,19 @@ def compose_inputs(
|
|
|
117
147
|
else:
|
|
118
148
|
fnc_args["project"] = project
|
|
119
149
|
|
|
150
|
+
if _has_context and not local_execution:
|
|
151
|
+
project_name: str = context.project.name
|
|
152
|
+
elif isinstance(project, str):
|
|
153
|
+
project_name = project
|
|
154
|
+
else:
|
|
155
|
+
project_name = project.name
|
|
156
|
+
|
|
157
|
+
if _has_run:
|
|
158
|
+
if _has_context and not local_execution:
|
|
159
|
+
fnc_args["run"] = context.run
|
|
160
|
+
else:
|
|
161
|
+
fnc_args["run"] = get_run_(project_name)
|
|
162
|
+
|
|
120
163
|
# Context and event are reserved keyword arguments
|
|
121
164
|
# only in remote executions
|
|
122
165
|
if not local_execution:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: digitalhub-runtime-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10.0b0
|
|
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
|
|
@@ -229,6 +229,6 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
229
229
|
Requires-Python: >=3.9
|
|
230
230
|
Description-Content-Type: text/markdown
|
|
231
231
|
License-File: LICENSE.txt
|
|
232
|
-
Requires-Dist: digitalhub[full]<0.
|
|
232
|
+
Requires-Dist: digitalhub[full]<0.11,>=0.10.0b
|
|
233
233
|
|
|
234
234
|
# SDK for DHCore
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
digitalhub[full]<0.11,>=0.10.0b
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "digitalhub-runtime-python"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.10.0b0"
|
|
8
8
|
description = "Python runtime for DHCore"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [
|
|
@@ -21,7 +21,7 @@ classifiers = [
|
|
|
21
21
|
keywords = ["data", "dataops", "kubernetes"]
|
|
22
22
|
requires-python = ">=3.9"
|
|
23
23
|
dependencies = [
|
|
24
|
-
"digitalhub[full]>=0.
|
|
24
|
+
"digitalhub[full]>=0.10.0b, <0.11",
|
|
25
25
|
]
|
|
26
26
|
|
|
27
27
|
[project.urls]
|
|
@@ -40,7 +40,7 @@ line-length = 120
|
|
|
40
40
|
convention = "numpy"
|
|
41
41
|
|
|
42
42
|
[tool.bumpver]
|
|
43
|
-
current_version = "0.
|
|
43
|
+
current_version = "0.10.0b0"
|
|
44
44
|
version_pattern = "MAJOR.MINOR.PATCH[PYTAGNUM]"
|
|
45
45
|
commit_message = "Bump version {old_version} -> {new_version}"
|
|
46
46
|
commit = false
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
digitalhub[full]<0.10,>=0.9.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
|
|
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
|
|
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
|