Skip to content

Commit c180c25

Browse files
committed
address comments
1 parent 800aa70 commit c180c25

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

Diff for: python/hsfs/engine/python.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ def parse_schema_feature_group(
752752
name = util.autofix_feature_name(feat_name)
753753
try:
754754
pd_type = arrow_schema.field(feat_name).type
755-
if pd_type == "null" and feature_type_map.get(name):
755+
if pa.types.is_null(pd_type) and feature_type_map.get(name):
756756
converted_type = feature_type_map.get(name)
757757
else:
758758
converted_type = convert_pandas_dtype_to_offline_type(pd_type)

Diff for: python/hsfs/feature_view.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
from hsfs.statistics_config import StatisticsConfig
7373
from hsfs.training_dataset_split import TrainingDatasetSplit
7474
from hsfs.transformation_function import TransformationFunction
75-
75+
from hsml.model import Model
7676

7777
_logger = logging.getLogger(__name__)
7878

@@ -3606,7 +3606,7 @@ def log(
36063606
transformed: Optional[bool] = False,
36073607
write_options: Optional[Dict[str, Any]] = None,
36083608
training_dataset_version: Optional[int] = None,
3609-
hopsworks_model=None,
3609+
model: Model = None,
36103610
) -> Optional[Job]:
36113611
"""Log features and optionally predictions for the current feature view. The logged features are written periodically to the offline store. If you need it to be available immediately, call `materialize_log`.
36123612
@@ -3619,7 +3619,7 @@ def log(
36193619
transformed: Whether the features are transformed. Defaults to False.
36203620
write_options: Options for writing the log. Defaults to None.
36213621
training_dataset_version: Version of the training dataset. Defaults to None.
3622-
hopsworks_model: `hsml.model.Model` Hopsworks model associated with the log. Defaults to None.
3622+
model: `hsml.model.Model` Hopsworks model associated with the log. Defaults to None.
36233623
36243624
# Returns
36253625
`Job` job information if python engine is used
@@ -3649,9 +3649,9 @@ def log(
36493649
transformed,
36503650
write_options,
36513651
training_dataset_version=(
3652-
training_dataset_version or self.get_last_accessed_training_dataset()
3652+
training_dataset_version or (model.training_dataset_version if model else None) or self.get_last_accessed_training_dataset()
36533653
),
3654-
hsml_model=hopsworks_model,
3654+
hsml_model=model,
36553655
)
36563656

36573657
def get_log_timeline(
@@ -3691,7 +3691,7 @@ def read_log(
36913691
filter: Optional[Union[Filter, Logic]] = None,
36923692
transformed: Optional[bool] = False,
36933693
training_dataset_version: Optional[int] = None,
3694-
hopsworks_model=None,
3694+
model: Model = None,
36953695
) -> Union[
36963696
TypeVar("pyspark.sql.DataFrame"),
36973697
pd.DataFrame,
@@ -3707,7 +3707,7 @@ def read_log(
37073707
filter: Filter to apply on the log entries. Can be a Filter or Logic object. Defaults to None.
37083708
transformed: Whether to include transformed logs. Defaults to False.
37093709
training_dataset_version: Version of the training dataset. Defaults to None.
3710-
hopsworks_model: HSML model associated with the log. Defaults to None.
3710+
model: HSML model associated with the log. Defaults to None.
37113711
37123712
# Example
37133713
```python
@@ -3718,7 +3718,7 @@ def read_log(
37183718
# read log entries of a specific training dataset version
37193719
log_entries = feature_view.read_log(training_dataset_version=1)
37203720
# read log entries of a specific hopsworks model
3721-
log_entries = feature_view.read_log(hopsworks_model=Model(1, "dummy", version=1))
3721+
log_entries = feature_view.read_log(model=Model(1, "dummy", version=1))
37223722
# read log entries by applying filter on features of feature group `fg` in the feature view
37233723
log_entries = feature_view.read_log(filter=fg.feature1 > 10)
37243724
```
@@ -3739,7 +3739,7 @@ def read_log(
37393739
filter,
37403740
transformed,
37413741
training_dataset_version,
3742-
hopsworks_model,
3742+
model,
37433743
)
37443744

37453745
def pause_logging(self) -> None:

Diff for: python/hsml/model.py

+4
Original file line numberDiff line numberDiff line change
@@ -571,5 +571,9 @@ def shared_registry_project_name(self):
571571
def shared_registry_project_name(self, shared_registry_project_name):
572572
self._shared_registry_project_name = shared_registry_project_name
573573

574+
@property
575+
def training_dataset_version(self) -> int:
576+
return self._training_dataset_version
577+
574578
def __repr__(self):
575579
return f"Model(name: {self._name!r}, version: {self._version!r})"

0 commit comments

Comments
 (0)