Skip to content

Commit

Permalink
Merge pull request #19 from Ki-Insurance/rm/feature-service-metadata
Browse files Browse the repository at this point in the history
added optional metadata field to the FeatureService class
  • Loading branch information
RowanMankoo-Ki authored May 16, 2024
2 parents ce503e0 + 81540e1 commit ad2c363
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
3 changes: 3 additions & 0 deletions protos/feast/core/FeatureService.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ message FeatureServiceSpec {

// (optional) if provided logging will be enabled for this feature service.
LoggingConfig logging_config = 7;

// Hidden User defined metadata
map<string,string> metadata = 8;
}


Expand Down
13 changes: 9 additions & 4 deletions sdk/python/feast/feature_service.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import datetime
from typing import Dict, List, Optional, Union
from typing import Any, Dict, List, Optional, Union

from google.protobuf.json_format import MessageToJson
from typeguard import typechecked
Expand Down Expand Up @@ -49,6 +49,7 @@ class FeatureService:
created_timestamp: Optional[datetime] = None
last_updated_timestamp: Optional[datetime] = None
logging_config: Optional[LoggingConfig] = None
metadata: Optional[Dict[str, Any]] = None

@log_exceptions
def __init__(
Expand All @@ -60,6 +61,7 @@ def __init__(
description: str = "",
owner: str = "",
logging_config: Optional[LoggingConfig] = None,
metadata: Optional[Dict[str, Any]] = None,
):
"""
Creates a FeatureService object.
Expand All @@ -82,6 +84,7 @@ def __init__(
self.created_timestamp = None
self.last_updated_timestamp = None
self.logging_config = logging_config
self.metadata = metadata
for feature_grouping in self._features:
if isinstance(feature_grouping, BaseFeatureView):
self.feature_view_projections.append(feature_grouping.projection)
Expand Down Expand Up @@ -202,6 +205,7 @@ def from_proto(cls, feature_service_proto: FeatureServiceProto):
logging_config=LoggingConfig.from_proto(
feature_service_proto.spec.logging_config
),
metadata=dict(feature_service_proto.spec.metadata),
)
fs.feature_view_projections.extend(
[
Expand Down Expand Up @@ -240,11 +244,12 @@ def to_proto(self) -> FeatureServiceProto:
projection.to_proto() for projection in self.feature_view_projections
],
tags=self.tags,
metadata=self.metadata,
description=self.description,
owner=self.owner,
logging_config=self.logging_config.to_proto()
if self.logging_config
else None,
logging_config=(
self.logging_config.to_proto() if self.logging_config else None
),
)

return FeatureServiceProto(spec=spec, meta=meta)
Expand Down

0 comments on commit ad2c363

Please sign in to comment.