Skip to content

Commit 3cc7ae2

Browse files
committed
Switch to managing online stores by name
1 parent 1332fec commit 3cc7ae2

File tree

4 files changed

+21
-39
lines changed

4 files changed

+21
-39
lines changed

protos/feast/core/FeatureView.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ message FeatureViewSpec {
7272
DataSource batch_source = 7;
7373
// Streaming DataSource from where this view can consume "online" feature data.
7474
DataSource stream_source = 9;
75-
// Online DataSource which can find and rehydrate online features [DISCORD]
76-
DataSource online_source = 4701;
75+
// Online source name [DISCORD]
76+
string online_source = 4701;
7777

7878
// Whether these features should be served online or not
7979
bool online = 8;

sdk/python/feast/feature_view.py

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,9 @@ class FeatureView(BaseFeatureView):
8585
ttl: Optional[timedelta]
8686
batch_source: DataSource
8787
stream_source: Optional[DataSource]
88-
online_source_config: Optional[Any]
8988
entity_columns: List[Field]
9089
features: List[Field]
91-
online: bool
90+
online: Optional[str]
9291
description: str
9392
tags: Dict[str, str]
9493
owner: str
@@ -103,7 +102,7 @@ def __init__(
103102
schema: Optional[List[Field]] = None,
104103
entities: List[Entity] = None,
105104
ttl: Optional[timedelta] = timedelta(days=0),
106-
online: Union[bool, DataSource] = True,
105+
online: Optional[str] = None,
107106
description: str = "",
108107
tags: Optional[Dict[str, str]] = None,
109108
owner: str = "",
@@ -208,12 +207,8 @@ def __init__(
208207
tags=tags,
209208
owner=owner,
210209
)
211-
if isinstance(online, bool):
212-
self.online = online
213-
warnings.warn(f"FeatureView {self.name} is missing a defined online_store",UserWarning)
214-
else:
215-
self.online = True
216-
self.online_source_config = online
210+
211+
self.online = online
217212
self.materialization_intervals = []
218213

219214
def __hash__(self):
@@ -335,12 +330,6 @@ def to_proto(self) -> FeatureViewProto:
335330
stream_source_proto = self.stream_source.to_proto()
336331
stream_source_proto.data_source_class_type = f"{self.stream_source.__class__.__module__}.{self.stream_source.__class__.__name__}"
337332

338-
online_source_proto = None
339-
if self.online_source_config:
340-
online_source_proto = self.online_source_config.to_proto()
341-
online_source_proto.data_source_class_type = f"{self.online_source_config.__class__.__module__}.{self.online_source_config.__class__.__name__}"
342-
343-
344333
spec = FeatureViewSpecProto(
345334
name=self.name,
346335
entities=self.entities,
@@ -350,10 +339,9 @@ def to_proto(self) -> FeatureViewProto:
350339
tags=self.tags,
351340
owner=self.owner,
352341
ttl=(ttl_duration if ttl_duration is not None else None),
353-
online=self.online,
342+
online_source=self.online,
354343
batch_source=batch_source_proto,
355344
stream_source=stream_source_proto,
356-
online_source_proto=online_source_proto
357345
)
358346

359347
return FeatureViewProto(spec=spec, meta=meta)
@@ -395,19 +383,14 @@ def from_proto(cls, feature_view_proto: FeatureViewProto):
395383
if feature_view_proto.spec.HasField("stream_source")
396384
else None
397385
)
398-
online_source = (
399-
DataSource.from_proto(feature_view_proto.spec.online_source)
400-
if feature_view_proto.spec.HasField("online_source")
401-
else None
402-
)
403386

404387

405388
feature_view = cls(
406389
name=feature_view_proto.spec.name,
407390
description=feature_view_proto.spec.description,
408391
tags=dict(feature_view_proto.spec.tags),
409392
owner=feature_view_proto.spec.owner,
410-
online=online_source or feature_view_proto.spec.online,
393+
online=feature_view_proto.spec.online_source,
411394
ttl=(
412395
timedelta(days=0)
413396
if feature_view_proto.spec.ttl.ToNanoseconds() == 0

sdk/python/feast/protos/feast/core/FeatureView_pb2.py

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/python/feast/protos/feast/core/FeatureView_pb2.pyi

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,9 @@ class FeatureViewSpec(google.protobuf.message.Message):
111111
def stream_source(self) -> feast.core.DataSource_pb2.DataSource:
112112
"""Streaming DataSource from where this view can consume "online" feature data."""
113113
pass
114-
@property
115-
def online_source(self) -> feast.core.DataSource_pb2.DataSource:
116-
"""Online DataSource which can find and rehydrate online features [DISCORD]"""
117-
pass
114+
online_source: typing.Text = ...
115+
"""Online source name [DISCORD]"""
116+
118117
online: builtins.bool = ...
119118
"""Whether these features should be served online or not"""
120119

@@ -131,10 +130,10 @@ class FeatureViewSpec(google.protobuf.message.Message):
131130
ttl : typing.Optional[google.protobuf.duration_pb2.Duration] = ...,
132131
batch_source : typing.Optional[feast.core.DataSource_pb2.DataSource] = ...,
133132
stream_source : typing.Optional[feast.core.DataSource_pb2.DataSource] = ...,
134-
online_source : typing.Optional[feast.core.DataSource_pb2.DataSource] = ...,
133+
online_source : typing.Text = ...,
135134
online : builtins.bool = ...,
136135
) -> None: ...
137-
def HasField(self, field_name: typing_extensions.Literal["batch_source",b"batch_source","online_source",b"online_source","stream_source",b"stream_source","ttl",b"ttl"]) -> builtins.bool: ...
136+
def HasField(self, field_name: typing_extensions.Literal["batch_source",b"batch_source","stream_source",b"stream_source","ttl",b"ttl"]) -> builtins.bool: ...
138137
def ClearField(self, field_name: typing_extensions.Literal["batch_source",b"batch_source","description",b"description","entities",b"entities","entity_columns",b"entity_columns","features",b"features","name",b"name","online",b"online","online_source",b"online_source","owner",b"owner","project",b"project","stream_source",b"stream_source","tags",b"tags","ttl",b"ttl"]) -> None: ...
139138
global___FeatureViewSpec = FeatureViewSpec
140139

0 commit comments

Comments
 (0)