Skip to content

Commit

Permalink
[HWORKS-135] Models backend should store metadata in tables instead o…
Browse files Browse the repository at this point in the history
…f opensearch
  • Loading branch information
robzor92 committed Dec 5, 2023
1 parent 5e626b8 commit 727e1d8
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 12 deletions.
12 changes: 0 additions & 12 deletions python/hsml/engine/model_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,19 @@
import tempfile
import uuid
import time
import importlib
import os

from tqdm.auto import tqdm

from hsml.client.exceptions import RestAPIError, ModelRegistryException

from hsml import client, util, constants

from hsml.core import model_api, dataset_api

from hsml.engine import local_engine, hopsworks_engine


class ModelEngine:
def __init__(self):
self._model_api = model_api.ModelApi()
self._dataset_api = dataset_api.DatasetApi()

pydoop_spec = importlib.util.find_spec("pydoop")
if pydoop_spec is None:
self._engine = local_engine.LocalEngine()
else:
self._engine = hopsworks_engine.HopsworksEngine()

def _poll_model_available(self, model_instance, await_registration):
if await_registration > 0:
model_registry_id = model_instance.model_registry_id
Expand Down
13 changes: 13 additions & 0 deletions python/hsml/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(
name,
version=None,
created=None,
creator=None,
environment=None,
description=None,
experiment_id=None,
Expand All @@ -51,6 +52,8 @@ def __init__(
input_example=None,
framework=None,
model_registry_id=None,
tags=None,
href=None,
**kwargs,
):
self._id = id
Expand All @@ -63,6 +66,7 @@ def __init__(
self._description = description

self._created = created
self._creator = creator
self._environment = environment
self._experiment_id = experiment_id
self._project_name = project_name
Expand Down Expand Up @@ -267,6 +271,15 @@ def created(self):
def created(self, created):
self._created = created

@property
def creator(self):
"""Creator of the model."""
return self._creator

@creator.setter
def creator(self, creator):
self._creator = creator

@property
def environment(self):
"""Input example of the model."""
Expand Down
4 changes: 4 additions & 0 deletions python/hsml/python/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def __init__(
name,
version=None,
created=None,
creator=None,
environment=None,
description=None,
experiment_id=None,
Expand All @@ -40,13 +41,16 @@ def __init__(
training_dataset=None,
input_example=None,
model_registry_id=None,
tags=None,
href=None,
**kwargs,
):
super().__init__(
id,
name,
version=version,
created=created,
creator=creator,
environment=environment,
description=description,
experiment_id=experiment_id,
Expand Down
4 changes: 4 additions & 0 deletions python/hsml/sklearn/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def __init__(
name,
version=None,
created=None,
creator=None,
environment=None,
description=None,
experiment_id=None,
Expand All @@ -40,13 +41,16 @@ def __init__(
training_dataset=None,
input_example=None,
model_registry_id=None,
tags=None,
href=None,
**kwargs,
):
super().__init__(
id,
name,
version=version,
created=created,
creator=creator,
environment=environment,
description=description,
experiment_id=experiment_id,
Expand Down
4 changes: 4 additions & 0 deletions python/hsml/tensorflow/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def __init__(
name,
version=None,
created=None,
creator=None,
environment=None,
description=None,
experiment_id=None,
Expand All @@ -40,13 +41,16 @@ def __init__(
training_dataset=None,
input_example=None,
model_registry_id=None,
tags=None,
href=None,
**kwargs,
):
super().__init__(
id,
name,
version=version,
created=created,
creator=creator,
environment=environment,
description=description,
experiment_id=experiment_id,
Expand Down
4 changes: 4 additions & 0 deletions python/hsml/torch/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def __init__(
name,
version=None,
created=None,
creator=None,
environment=None,
description=None,
experiment_id=None,
Expand All @@ -40,13 +41,16 @@ def __init__(
training_dataset=None,
input_example=None,
model_registry_id=None,
tags=None,
href=None,
**kwargs,
):
super().__init__(
id,
name,
version=version,
created=created,
creator=creator,
environment=environment,
description=description,
experiment_id=experiment_id,
Expand Down

0 comments on commit 727e1d8

Please sign in to comment.