digitalhub-runtime-python 0.6.0b3__tar.gz → 0.6.0b4__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.
Files changed (30) hide show
  1. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/PKG-INFO +1 -1
  2. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python/entities/functions/spec.py +0 -6
  3. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python/entities/runs/spec.py +0 -3
  4. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python/entities/tasks/spec.py +0 -12
  5. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python/runtimes/runtime.py +0 -6
  6. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python/utils/configuration.py +29 -0
  7. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python.egg-info/PKG-INFO +1 -1
  8. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/pyproject.toml +2 -2
  9. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/LICENSE.txt +0 -0
  10. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/README.md +0 -0
  11. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python/__init__.py +0 -0
  12. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python/entities/__init__.py +0 -0
  13. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python/entities/functions/__init__.py +0 -0
  14. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python/entities/functions/status.py +0 -0
  15. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python/entities/runs/__init__.py +0 -0
  16. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python/entities/runs/status.py +0 -0
  17. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python/entities/tasks/__init__.py +0 -0
  18. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python/entities/tasks/models.py +0 -0
  19. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python/entities/tasks/status.py +0 -0
  20. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python/runtimes/__init__.py +0 -0
  21. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python/runtimes/kind_registry.py +0 -0
  22. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python/utils/env.py +0 -0
  23. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python/utils/inputs.py +0 -0
  24. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python/utils/outputs.py +0 -0
  25. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python/utils/utils.py +0 -0
  26. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python.egg-info/SOURCES.txt +0 -0
  27. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python.egg-info/dependency_links.txt +0 -0
  28. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python.egg-info/requires.txt +0 -0
  29. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/digitalhub_runtime_python.egg-info/top_level.txt +0 -0
  30. {digitalhub_runtime_python-0.6.0b3 → digitalhub_runtime_python-0.6.0b4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: digitalhub-runtime-python
3
- Version: 0.6.0b3
3
+ Version: 0.6.0b4
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
@@ -1,6 +1,3 @@
1
- """
2
- Function Conatiner specification module.
3
- """
4
1
  from __future__ import annotations
5
2
 
6
3
  from pathlib import Path
@@ -25,9 +22,6 @@ class FunctionSpecPython(FunctionSpec):
25
22
  python_version: str | None = None,
26
23
  requirements: list | None = None,
27
24
  ) -> None:
28
- """
29
- Constructor.
30
- """
31
25
  super().__init__()
32
26
 
33
27
  self.image = image
@@ -12,9 +12,6 @@ class RunSpecPython(RunSpecMl):
12
12
  local_execution: bool = False,
13
13
  **kwargs,
14
14
  ) -> None:
15
- """
16
- Constructor.
17
- """
18
15
  super().__init__(task, local_execution)
19
16
 
20
17
  self.source = kwargs.get("source")
@@ -1,6 +1,3 @@
1
- """
2
- Task Python specification module.
3
- """
4
1
  from __future__ import annotations
5
2
 
6
3
  from typing import Literal
@@ -16,9 +13,6 @@ class TaskSpecJob(TaskSpecK8s):
16
13
  function: str,
17
14
  **kwargs,
18
15
  ) -> None:
19
- """
20
- Constructor.
21
- """
22
16
  super().__init__(function, **kwargs)
23
17
 
24
18
  self.backoff_limit = kwargs.get("backoff_limit")
@@ -42,9 +36,6 @@ class TaskSpecBuild(TaskSpecK8s):
42
36
  instructions: list | None = None,
43
37
  **kwargs,
44
38
  ) -> None:
45
- """
46
- Constructor.
47
- """
48
39
  super().__init__(function, **kwargs)
49
40
 
50
41
  self.instructions = instructions
@@ -69,9 +60,6 @@ class TaskSpecServe(TaskSpecK8s):
69
60
  service_type: str | None = None,
70
61
  **kwargs,
71
62
  ) -> None:
72
- """
73
- Constructor.
74
- """
75
63
  super().__init__(function, **kwargs)
76
64
 
77
65
  self.replicas = replicas
@@ -1,6 +1,3 @@
1
- """
2
- Runtime class for running Python functions.
3
- """
4
1
  from __future__ import annotations
5
2
 
6
3
  import typing
@@ -23,9 +20,6 @@ class RuntimePython(Runtime):
23
20
  """
24
21
 
25
22
  def __init__(self, kind_registry: KindRegistry, project: str) -> None:
26
- """
27
- Constructor.
28
- """
29
23
  super().__init__(kind_registry, project)
30
24
  ctx = get_context(self.project)
31
25
  self.root = ctx.runtime_dir
@@ -43,6 +43,35 @@ def get_function_from_source(path: Path, source_spec: dict) -> Callable:
43
43
  raise RuntimeError(msg) from e
44
44
 
45
45
 
46
+ def get_init_function(path: Path, source_spec: dict) -> Callable:
47
+ """
48
+ Get function from source.
49
+
50
+ Parameters
51
+ ----------
52
+ path : Path
53
+ Path where to save the function source.
54
+ source_spec : dict
55
+ Funcrion source spec.
56
+
57
+ Returns
58
+ -------
59
+ Callable
60
+ Function.
61
+ """
62
+ try:
63
+ if "init_function" not in source_spec:
64
+ return
65
+ function_code = save_function_source(path, source_spec)
66
+ handler_path, _ = parse_handler(source_spec["handler"])
67
+ function_path = (function_code / handler_path).with_suffix(".py")
68
+ return import_function(function_path, source_spec["init_function"])
69
+ except Exception as e:
70
+ msg = f"Some error occurred while getting init function. Exception: {e.__class__}. Error: {e.args}"
71
+ LOGGER.exception(msg)
72
+ raise RuntimeError(msg) from e
73
+
74
+
46
75
  def parse_handler(handler: str) -> tuple:
47
76
  """
48
77
  Parse handler.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: digitalhub-runtime-python
3
- Version: 0.6.0b3
3
+ Version: 0.6.0b4
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "digitalhub-runtime-python"
7
- version = "0.6.0b3"
7
+ version = "0.6.0b4"
8
8
  description = "Python runtime for DHCore"
9
9
  readme = "README.md"
10
10
  authors = [
@@ -39,7 +39,7 @@ line-length = 120
39
39
  convention = "numpy"
40
40
 
41
41
  [tool.bumpver]
42
- current_version = "0.6.0b3"
42
+ current_version = "0.6.0b4"
43
43
  version_pattern = "MAJOR.MINOR.PATCH[PYTAGNUM]"
44
44
  commit_message = "Bump version {old_version} -> {new_version}"
45
45
  commit = false