Skip to content

Commit

Permalink
moved some run logic into children
Browse files Browse the repository at this point in the history
  • Loading branch information
EvangMM committed Oct 17, 2024
1 parent 2d902bf commit 69d2a51
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 17 deletions.
18 changes: 13 additions & 5 deletions digitalhub/entities/run/_base/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,15 @@ def run(self) -> Run:
self._set_state(State.RUNNING.value)
self.save(update=True)

# Try to get inputs if they exist
try:
self.spec.inputs = self.inputs(as_dict=True)
except EntityError:
pass
self._setup_execution()

try:
status = self._get_runtime().run(self.to_dict())
except Exception as e:
self.refresh()
import pdb

pdb.set_trace()
if self.spec.local_execution:
self._set_state(State.ERROR.value)
self._set_message(str(e))
Expand Down Expand Up @@ -194,6 +193,15 @@ def resume(self) -> None:
# Helpers
##############################

def _setup_execution(self) -> None:
"""
Setup run execution. In base class, nothing to do.
Returns
-------
None
"""

def _is_ready_to_run(self) -> bool:
"""
Check if run is in a state ready for running (BUILT or STOPPED).
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "digitalhub"
version = "0.8.0b4"
version = "0.8.0b5"
description = "Python SDK for Digitalhub"
readme = "README.md"
authors = [
Expand Down Expand Up @@ -77,7 +77,7 @@ line-length = 120
convention = "numpy"

[tool.bumpver]
current_version = "0.8.0b4"
current_version = "0.8.0b5"
version_pattern = "MAJOR.MINOR.PATCH[PYTAGNUM]"
commit_message = "Bump version {old_version} -> {new_version}"
commit = false
Expand Down
4 changes: 2 additions & 2 deletions runtimes/container/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "digitalhub-runtime-container"
version = "0.8.0b4"
version = "0.8.0b5"
description = "Container runtime for DHCore"
readme = "README.md"
authors = [
Expand Down Expand Up @@ -40,7 +40,7 @@ line-length = 120
convention = "numpy"

[tool.bumpver]
current_version = "0.8.0b4"
current_version = "0.8.0b5"
version_pattern = "MAJOR.MINOR.PATCH[PYTAGNUM]"
commit_message = "Bump version {old_version} -> {new_version}"
commit = false
Expand Down
11 changes: 11 additions & 0 deletions runtimes/dbt/digitalhub_runtime_dbt/entities/run/dbt_run/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ def __init__(
self.spec: RunSpecDbtRun
self.status: RunStatusDbtRun

def _setup_execution(self) -> None:
"""
Setup run execution.
Returns
-------
None
"""
self.refresh()
self.spec.inputs = self.inputs(as_dict=True)

def inputs(self, as_dict: bool = False) -> list[dict]:
"""
Get inputs passed in spec as objects or as dictionaries.
Expand Down
4 changes: 2 additions & 2 deletions runtimes/dbt/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "digitalhub-runtime-dbt"
version = "0.8.0b4"
version = "0.8.0b5"
description = "Dbt runtime for DHCore"
readme = "README.md"
authors = [
Expand Down Expand Up @@ -45,7 +45,7 @@ line-length = 120
convention = "numpy"

[tool.bumpver]
current_version = "0.8.0b4"
current_version = "0.8.0b5"
version_pattern = "MAJOR.MINOR.PATCH[PYTAGNUM]"
commit_message = "Bump version {old_version} -> {new_version}"
commit = false
Expand Down
11 changes: 11 additions & 0 deletions runtimes/kfp/digitalhub_runtime_kfp/entities/run/kfp_run/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ def __init__(
self.spec: RunSpecKfpRun
self.status: RunStatusKfpRun

def _setup_execution(self) -> None:
"""
Setup run execution.
Returns
-------
None
"""
self.refresh()
self.spec.inputs = self.inputs(as_dict=True)

def inputs(self, as_dict: bool = False) -> list[dict]:
"""
Get inputs passed in spec as objects or as dictionaries.
Expand Down
4 changes: 2 additions & 2 deletions runtimes/kfp/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "digitalhub-runtime-kfp"
version = "0.8.0b4"
version = "0.8.0b5"
description = "KFP runtime for DHCore"
readme = "README.md"
authors = [
Expand Down Expand Up @@ -44,7 +44,7 @@ line-length = 120
convention = "numpy"

[tool.bumpver]
current_version = "0.8.0b4"
current_version = "0.8.0b5"
version_pattern = "MAJOR.MINOR.PATCH[PYTAGNUM]"
commit_message = "Bump version {old_version} -> {new_version}"
commit = false
Expand Down
4 changes: 2 additions & 2 deletions runtimes/modelserve/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "digitalhub-runtime-modelserve"
version = "0.8.0b4"
version = "0.8.0b5"
description = "ML Model serving runtime for DHCore"
readme = "README.md"
authors = [
Expand Down Expand Up @@ -51,7 +51,7 @@ line-length = 120
convention = "numpy"

[tool.bumpver]
current_version = "0.8.0b4"
current_version = "0.8.0b5"
version_pattern = "MAJOR.MINOR.PATCH[PYTAGNUM]"
commit_message = "Bump version {old_version} -> {new_version}"
commit = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ def __init__(
self.spec: RunSpecPythonRun
self.status: RunStatusPythonRun

def _setup_execution(self) -> None:
"""
Setup run execution.
Returns
-------
None
"""
self.refresh()
self.spec.inputs = self.inputs(as_dict=True)

def inputs(self, as_dict: bool = False) -> list[dict]:
"""
Get inputs passed in spec as objects or as dictionaries.
Expand Down
4 changes: 2 additions & 2 deletions runtimes/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "digitalhub-runtime-python"
version = "0.8.0b4"
version = "0.8.0b5"
description = "Python runtime for DHCore"
readme = "README.md"
authors = [
Expand Down Expand Up @@ -40,7 +40,7 @@ line-length = 120
convention = "numpy"

[tool.bumpver]
current_version = "0.8.0b4"
current_version = "0.8.0b5"
version_pattern = "MAJOR.MINOR.PATCH[PYTAGNUM]"
commit_message = "Bump version {old_version} -> {new_version}"
commit = false
Expand Down

0 comments on commit 69d2a51

Please sign in to comment.