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

Commit f243e0f

Browse files
committed
docs
1 parent f0b54fe commit f243e0f

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

splicemachine/features/feature_store.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
class FeatureStore:
2626
def __init__(self, splice_ctx: PySpliceContext) -> None:
2727
self.splice_ctx = splice_ctx
28+
self.mlflow_ctx = None
2829
self.feature_sets = [] # Cache of newly created feature sets
2930

3031
def register_splice_context(self, splice_ctx: PySpliceContext) -> None:
@@ -166,7 +167,7 @@ def get_feature_vector(self, features: List[Union[str, Feature]],
166167
Gets a feature vector given a list of Features and primary key values for their corresponding Feature Sets
167168
168169
:param features: List of str Feature names or Features
169-
:param join_key_values: (dict) join key vals to get the proper Feature values formatted as {join_key_column_name: join_key_value}
170+
:param join_key_values: (dict) join key values to get the proper Feature values formatted as {join_key_column_name: join_key_value}
170171
:param return_sql: Whether to return the SQL needed to get the vector or the values themselves. Default False
171172
:return: Pandas Dataframe or str (SQL statement)
172173
"""
@@ -735,12 +736,16 @@ def __log_mlflow_results(self, name, rounds, mlflow_results):
735736
:param name: MLflow run name
736737
:param rounds: Number of rounds of feature elimination that were run
737738
:param mlflow_results: The params / metrics to log
738-
:return:
739739
"""
740-
with self.mlflow_ctx.start_run(run_name=name):
740+
try:
741+
if self.mlflow_ctx.active_run():
742+
self.mlflow_ctx.start_run(run_name=name)
741743
for r in range(rounds):
742744
with self.mlflow_ctx.start_run(run_name=f'Round {r}', nested=True):
743745
self.mlflow_ctx.log_metrics(mlflow_results[r])
746+
finally:
747+
self.mlflow_ctx.end_run()
748+
744749

745750
def __prune_features_for_elimination(self, features) -> List[Feature]:
746751
"""

splicemachine/spark/context.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,17 @@ def replaceDataframeSchema(self, dataframe, schema_table_name):
124124

125125
def fileToTable(self, file_path, schema_table_name, primary_keys=None, drop_table=False, **pandas_args):
126126
"""
127-
Load a file from the local filesystem and create a new table (or recreate an existing table), and load the data
128-
from the file into the new table
127+
Load a file from the local filesystem or from a remote location and create a new table
128+
(or recreate an existing table), and load the data from the file into the new table. Any file_path that can be
129+
read by pandas should work here.
129130
130131
:param file_path: The local file to load
131132
:param schema_table_name: The schema.table name
132133
:param primary_keys: List[str] of primary keys for the table. Default None
133134
:param drop_table: Whether or not to drop the table. If this is False and the table already exists, the
134135
function will fail. Default False
135136
:param pandas_args: Extra parameters to be passed into the pd.read_csv function. Any parameters accepted
136-
in pd.read_csv will work here
137+
in pd.read_csv will work here
137138
:return: None
138139
"""
139140
import pandas as pd

0 commit comments

Comments
 (0)