digitalhub-runtime-python 0.16.0b3__py3-none-any.whl → 0.16.0b5__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.
@@ -96,7 +96,7 @@ class FunctionBaseFunction(Function):
96
96
  wait: bool = False,
97
97
  log_info: bool = True,
98
98
  extensions: list[dict] | None = None,
99
- auto_build: bool = True,
99
+ auto_build: bool = False,
100
100
  **kwargs,
101
101
  ):
102
102
  """
@@ -193,7 +193,7 @@ def _check_config_params(
193
193
  if path is not None:
194
194
  config["path"] = path
195
195
 
196
- if config_src is None and config_content is None and config_base64 is None:
196
+ if config_src is None and config_content is None and config_base64 is None and path is None:
197
197
  raise EntityError("Config must be provided.")
198
198
 
199
199
  if config_src is not None:
@@ -18,6 +18,7 @@ class PythonVersion(Enum):
18
18
  PYTHON3_11 = "PYTHON3_11"
19
19
  PYTHON3_12 = "PYTHON3_12"
20
20
  PYTHON3_13 = "PYTHON3_13"
21
+ PYTHON3_14 = "PYTHON3_14"
21
22
 
22
23
 
23
24
  class Lang(Enum):
@@ -19,6 +19,8 @@ from digitalhub_runtime_python.utils.configuration import (
19
19
  has_git_scheme,
20
20
  has_remote_scheme,
21
21
  has_s3_scheme,
22
+ import_function_from_source,
23
+ save_function_source,
22
24
  )
23
25
  from digitalhub_runtime_python.utils.outputs import build_new_status, collect_outputs
24
26
 
@@ -70,6 +72,9 @@ class RuntimeHydraJob(RuntimePythonJob):
70
72
  def _configure_execution(self, spec: dict, run: dict) -> tuple[Callable, bool]:
71
73
  args = ["main", "-m"]
72
74
 
75
+ # prepare source code
76
+ source_path = save_function_source(self.runtime_dir, spec.get("source", {}))
77
+
73
78
  # write runtime config for dh launcher
74
79
  dh_launcher_config = {
75
80
  "defaults": ["dh"],
@@ -111,6 +116,8 @@ class RuntimeHydraJob(RuntimePythonJob):
111
116
  # Unsupported scheme
112
117
  else:
113
118
  raise RuntimeError(f"Unable to collect source from: {source}")
119
+ if "path" in config:
120
+ path = path / config["path"]
114
121
  sys.argv = args + [f"--config-path={path.absolute()}"]
115
122
  elif "path" in config:
116
123
  path = self.runtime_dir / config["path"]
@@ -122,7 +129,16 @@ class RuntimeHydraJob(RuntimePythonJob):
122
129
  f"hydra.launcher.job_ref={run['id']}",
123
130
  ]
124
131
 
125
- fnc, _ = super()._configure_execution(spec)
132
+ if "parameters" in spec:
133
+ sys.argv += [f"{key}={value}" for key, value in spec["parameters"].items()]
134
+
135
+
136
+ # import from source
137
+ fnc = import_function_from_source(
138
+ source_path,
139
+ spec.get("source", {}),
140
+ skip_save=True,
141
+ )
126
142
  # treat as not wrapped, as the wrapping is done by hydra.main and we do not need to pass the extra attributes
127
143
  return fnc, {"cfg_passthrough": None}
128
144
 
@@ -210,7 +210,7 @@ def _import_function_from_path(function_path: Path, function_name: str) -> Calla
210
210
  return import_function(function_path, function_name)
211
211
 
212
212
 
213
- def import_function_from_source(path: Path, source_spec: dict) -> Callable:
213
+ def import_function_from_source(path: Path, source_spec: dict, skip_save: bool = False) -> Callable:
214
214
  """
215
215
  Get function from source.
216
216
 
@@ -227,7 +227,7 @@ def import_function_from_source(path: Path, source_spec: dict) -> Callable:
227
227
  Function.
228
228
  """
229
229
  try:
230
- source_path = save_function_source(path, source_spec)
230
+ source_path = save_function_source(path, source_spec) if not skip_save else path
231
231
  function_path, function_name = _get_function_path(source_path, source_spec["handler"])
232
232
  return _import_function_from_path(function_path, function_name)
233
233
  except Exception as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: digitalhub-runtime-python
3
- Version: 0.16.0b3
3
+ Version: 0.16.0b5
4
4
  Summary: Python runtime for DHCore
5
5
  Project-URL: Homepage, https://github.com/scc-digitalhub/digitalhub-sdk-runtime-python
6
6
  Author-email: Fondazione Bruno Kessler <digitalhub@fbk.eu>, Matteo Martini <mmartini@fbk.eu>
@@ -18,7 +18,7 @@ digitalhub_runtime_python/entities/_commons/requirement_parser/modules/_pyprojec
18
18
  digitalhub_runtime_python/entities/function/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
19
19
  digitalhub_runtime_python/entities/function/_base/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
20
20
  digitalhub_runtime_python/entities/function/_base/builder.py,sha256=JRwF-Q7SqQDCPKIhhg9Clz6efUvJY31MWV3kk1J0EAc,1280
21
- digitalhub_runtime_python/entities/function/_base/entity.py,sha256=TMSCo8n1xBhGZ3iC3ggs2siBwEkl4FkTu5ETa6A_33g,3981
21
+ digitalhub_runtime_python/entities/function/_base/entity.py,sha256=WuwVDxaM-P_OnaH6140HXX9c0IP2BDItp5cCwr0bpqA,3982
22
22
  digitalhub_runtime_python/entities/function/guardrail/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
23
23
  digitalhub_runtime_python/entities/function/guardrail/builder.py,sha256=qCymqxCGWC5T0jcR6kZIcOpeRV58TvAKRrdwLT4B5Lw,1113
24
24
  digitalhub_runtime_python/entities/function/guardrail/entity.py,sha256=WY3yE2cs4XP1riAj4P3O1krmEhgI-cGWQ3yWVGdwPgs,746
@@ -31,7 +31,7 @@ digitalhub_runtime_python/entities/function/hydra/entity.py,sha256=U1h2H8UVDPskp
31
31
  digitalhub_runtime_python/entities/function/hydra/models.py,sha256=DXQa9DTnHw_YAos2lfcNPFL2LpeWy0VAqa5s7joWflI,1155
32
32
  digitalhub_runtime_python/entities/function/hydra/spec.py,sha256=n0meR5mUz6dIzpoa76Zfm6ezKxUHeOKezOXjpd0qlLU,1630
33
33
  digitalhub_runtime_python/entities/function/hydra/status.py,sha256=O26R7uqJLRZ_UHrnTgiS7hsmdfHOho1szNrK9lITSEI,306
34
- digitalhub_runtime_python/entities/function/hydra/utils.py,sha256=wd8Hx_rQzoYjMXuSyJKbX3D5JqXci1OUcTafu030g7I,5570
34
+ digitalhub_runtime_python/entities/function/hydra/utils.py,sha256=-cLXGoqJ2G4T1awSLjBpZ-k21dto8spFOZdWJhNZ2WA,5587
35
35
  digitalhub_runtime_python/entities/function/openinference/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
36
36
  digitalhub_runtime_python/entities/function/openinference/builder.py,sha256=jYGi-Qol5Vreyubd_MGB3hG83Hfv75sVJt2evHTtKeo,1177
37
37
  digitalhub_runtime_python/entities/function/openinference/entity.py,sha256=43KLWGd-x9Vq7oTeiqXISmelWcBXoLGA_a8TYgwUu7Q,778
@@ -41,7 +41,7 @@ digitalhub_runtime_python/entities/function/openinference/status.py,sha256=mfvAd
41
41
  digitalhub_runtime_python/entities/function/python/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
42
42
  digitalhub_runtime_python/entities/function/python/builder.py,sha256=4ezReSC-91QD8UGPwL96NR39JuqucPPjrUaiZ7Ix-4g,1052
43
43
  digitalhub_runtime_python/entities/function/python/entity.py,sha256=P62w_UKVfFzCGlKD4d-yneWiTN_P9CQTj8PQ3kjb7Ks,722
44
- digitalhub_runtime_python/entities/function/python/models.py,sha256=pCqGJ1TSZ8-C4jhzzLL4DzZwi7jynxNUvsdX3mYV09M,1001
44
+ digitalhub_runtime_python/entities/function/python/models.py,sha256=sJ0Gd_EV66zRmKbYPjrHgLt3cgAmz5JhkFOJkSeG0yo,1031
45
45
  digitalhub_runtime_python/entities/function/python/spec.py,sha256=6TkwV0kGVryvZmvMY12RzfsTzw4D2Pm43dRNi3IvGy0,1428
46
46
  digitalhub_runtime_python/entities/function/python/status.py,sha256=XK3KPKovCRiMfEFzFeCzaVkoQyuwfci9nI2JzYxCIec,308
47
47
  digitalhub_runtime_python/entities/run/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
@@ -153,14 +153,14 @@ digitalhub_runtime_python/entities/task/python_serve/spec.py,sha256=VDkEvgoxYv5O
153
153
  digitalhub_runtime_python/entities/task/python_serve/status.py,sha256=OqKVBAhiQDXJb_qogxV8qqh6eyPjudT4puXx8bg_6XU,298
154
154
  digitalhub_runtime_python/runtimes/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
155
155
  digitalhub_runtime_python/runtimes/builder.py,sha256=vfSyxh5iEkSmTngTWM2BMpcnyvtAagBJpbN0M7ICjKw,1370
156
- digitalhub_runtime_python/runtimes/hydra_runtime.py,sha256=9qnXdmUzX_uP-_qfZzZJilYChPlUivzO6LLQoGVR65c,5831
156
+ digitalhub_runtime_python/runtimes/hydra_runtime.py,sha256=lE2n19FoYwK4hg4DOmJ3AGm4WMDL3TvR-f-gC6UaH9Y,6334
157
157
  digitalhub_runtime_python/runtimes/runtime.py,sha256=kJgDfXk_UbXXryRw7LNAIETJJH5nB7IwjnJgYVBrBRI,3965
158
- digitalhub_runtime_python/utils/configuration.py,sha256=BhrHFsvlCcAHA1hfmx7b5lURKeMV9TuC1dtMKXpcHOM,9125
158
+ digitalhub_runtime_python/utils/configuration.py,sha256=1GyCOtl-mQ4lgv6UplpaB-wj1E-VoWChAC_G6HbYXzE,9177
159
159
  digitalhub_runtime_python/utils/inputs.py,sha256=c-dU61jHXrTd-5XJt4LacjfDzi_vWZFKwuJCbqAGdJQ,5806
160
160
  digitalhub_runtime_python/utils/outputs.py,sha256=irGUqy43F26NC1_ruH831NDyDTIVQHwIf15oXpR-q2M,9571
161
161
  digitalhub_runtime_python/utils/utils.py,sha256=qO-wh-9qJFvoJnWIWNeajtFQuBSYw3xhCI3JqV9gVHE,1936
162
- digitalhub_runtime_python-0.16.0b3.dist-info/METADATA,sha256=pCj_2StpGdYhl_MaU50S2a3AksLkzpHKTt9CTddiCfQ,17080
163
- digitalhub_runtime_python-0.16.0b3.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
164
- digitalhub_runtime_python-0.16.0b3.dist-info/licenses/AUTHORS,sha256=iDleK_2EAMmh0o8Te_E9mdXQCP4rBfFr9dW9d0-pCno,301
165
- digitalhub_runtime_python-0.16.0b3.dist-info/licenses/LICENSE,sha256=z3xQCHfGmTnigfoUe3uidW_GUSVeFBdos30w9VNTRec,11361
166
- digitalhub_runtime_python-0.16.0b3.dist-info/RECORD,,
162
+ digitalhub_runtime_python-0.16.0b5.dist-info/METADATA,sha256=O1Qyswy5ugEHNL0LjxZG_DmDjkXocynFS0wOyU0NQNQ,17080
163
+ digitalhub_runtime_python-0.16.0b5.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
164
+ digitalhub_runtime_python-0.16.0b5.dist-info/licenses/AUTHORS,sha256=iDleK_2EAMmh0o8Te_E9mdXQCP4rBfFr9dW9d0-pCno,301
165
+ digitalhub_runtime_python-0.16.0b5.dist-info/licenses/LICENSE,sha256=z3xQCHfGmTnigfoUe3uidW_GUSVeFBdos30w9VNTRec,11361
166
+ digitalhub_runtime_python-0.16.0b5.dist-info/RECORD,,