Skip to content
This repository was archived by the owner on Apr 15, 2022. It is now read-only.

Commit ec2838e

Browse files
author
Ben Epstein
authored
Merge pull request #116 from splicemachine/DBAAS-5101
DBAAS-5101: Add route to list out training set details for deployments
2 parents 345a481 + 3cf63b0 commit ec2838e

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

splicemachine/features/feature_store.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ def get_training_set_from_view(self, training_view: str, features: Union[List[Fe
293293
r = make_request(self._FS_URL, Endpoints.TRAINING_SET_FROM_VIEW, RequestType.POST, self._basic_auth, { "view": training_view },
294294
{ "features": features, "start_time": start_time, "end_time": end_time })
295295
sql = r["sql"]
296-
tvw = r["training_view"]
296+
tvw = TrainingView(**r["training_view"])
297+
features = [Feature(**f) for f in r["features"]]
297298

298299
# Link this to mlflow for model deployment
299300
if self.mlflow_ctx and not return_sql:
@@ -530,14 +531,16 @@ def get_training_set_from_deployment(self, schema_name: str, table_name: str):
530531
{ "schema": schema_name, "table": table_name })
531532
metadata = r["metadata"]
532533

533-
sql = r["sql"]
534+
sql = r['sql']
534535
features = metadata['FEATURES'].split(',')
535536
tv_name = metadata['NAME']
536537
start_time = metadata['TRAINING_SET_START_TS']
537538
end_time = metadata['TRAINING_SET_END_TS']
539+
tv = TrainingView(**r['training_view']) if 'training_view' in r else None
540+
features = [Feature(**f) for f in r["features"]]
538541

539542
if self.mlflow_ctx:
540-
self.link_training_set_to_mlflow(features, start_time, end_time, tv_name)
543+
self.link_training_set_to_mlflow(features, start_time, end_time, tv)
541544
return self.splice_ctx.df(sql)
542545

543546
def remove_feature(self, name: str):
@@ -551,6 +554,17 @@ def remove_feature(self, name: str):
551554
"""
552555
make_request(self._FS_URL, Endpoints.FEATURES, RequestType.DELETE, self._basic_auth, { "name": name })
553556

557+
def get_deployments(self, schema_name: str = None, table_name: str = None, training_set: str = None):
558+
"""
559+
Returns a list of all (or specified) available deployments
560+
:param schema_name: model schema name
561+
:param table_name: model table name
562+
:param training_set: training set name
563+
:return: List[Deployment] the list of Deployments as dicts
564+
"""
565+
return make_request(self._FS_URL, Endpoints.DEPLOYMENTS, RequestType.GET, self._basic_auth,
566+
{ 'schema': schema_name, 'table': table_name, 'name': training_set })
567+
554568
def _retrieve_model_data_sets(self, schema_name: str, table_name: str):
555569
"""
556570
Returns the training set dataframe and model table dataframe for a given deployed model.

splicemachine/features/utils/http_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class Endpoints:
2828
"""
2929
Enum for Feature Store Endpoints
3030
"""
31+
DEPLOYMENTS: str = "deployments"
3132
FEATURES: str = "features"
3233
FEATURE_SETS: str = "feature-sets"
3334
FEATURE_SET_DESCRIPTIONS: str = "feature-set-descriptions"

0 commit comments

Comments
 (0)