Skip to content

Commit

Permalink
chore: Update online store docstrings (feast-dev#3066)
Browse files Browse the repository at this point in the history
* Update online store docstrings

Signed-off-by: Felix Wang <wangfelix98@gmail.com>

* Shorten

Signed-off-by: Felix Wang <wangfelix98@gmail.com>

* Redis docstring

Signed-off-by: Felix Wang <wangfelix98@gmail.com>

* Add links for data model

Signed-off-by: Felix Wang <wangfelix98@gmail.com>

* Fix Redis docstring

Signed-off-by: Felix Wang <wangfelix98@gmail.com>

* Fix

Signed-off-by: Felix Wang <wangfelix98@gmail.com>

* Add note

Signed-off-by: Felix Wang <wangfelix98@gmail.com>

* Format

Signed-off-by: Felix Wang <wangfelix98@gmail.com>

* Fix

Signed-off-by: Felix Wang <wangfelix98@gmail.com>

Signed-off-by: Felix Wang <wangfelix98@gmail.com>
  • Loading branch information
felixwang9817 authored Aug 22, 2022
1 parent f0874da commit ce94804
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 31 deletions.
9 changes: 7 additions & 2 deletions sdk/python/feast/infra/online_stores/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,13 @@ class DatastoreOnlineStoreConfig(FeastConfigBaseModel):

class DatastoreOnlineStore(OnlineStore):
"""
OnlineStore is an object used for all interaction between Feast and the service used for offline storage of
features.
Google Cloud Datastore implementation of the online store interface.
See https://github.com/feast-dev/feast/blob/master/docs/specs/online_store_format.md#google-datastore-online-store-format
for more details about the data model for this implementation.
Attributes:
_client: Datastore connection.
"""

_client: Optional[datastore.Client] = None
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/feast/infra/online_stores/dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class DynamoDBOnlineStoreConfig(FeastConfigBaseModel):

class DynamoDBOnlineStore(OnlineStore):
"""
Online feature store for AWS DynamoDB.
AWS DynamoDB implementation of the online store interface.
Attributes:
_dynamodb_client: Boto3 DynamoDB client.
Expand Down
72 changes: 46 additions & 26 deletions sdk/python/feast/infra/online_stores/online_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@

class OnlineStore(ABC):
"""
OnlineStore is an object used for all interaction between Feast and the service used for online storage of
features.
The interface that Feast uses to interact with the storage system that handles online features.
"""

@abstractmethod
Expand All @@ -42,21 +41,20 @@ def online_write_batch(
progress: Optional[Callable[[int], Any]],
) -> None:
"""
Write a batch of feature rows to the online store. This is a low level interface, not
expected to be used by the users directly.
Writes a batch of feature rows to the online store.
If a tz-naive timestamp is passed to this method, it should be assumed to be UTC by implementors.
If a tz-naive timestamp is passed to this method, it is assumed to be UTC.
Args:
config: The RepoConfig for the current FeatureStore.
table: Feast FeatureView
data: a list of quadruplets containing Feature data. Each quadruplet contains an Entity Key,
a dict containing feature values, an event timestamp for the row, and
the created timestamp for the row if it exists.
progress: Optional function to be called once every mini-batch of rows is written to
the online store. Can be used to display progress.
config: The config for the current feature store.
table: Feature view to which these feature rows correspond.
data: A list of quadruplets containing feature data. Each quadruplet contains an entity
key, a dict containing feature values, an event timestamp for the row, and the created
timestamp for the row if it exists.
progress: Function to be called once a batch of rows is written to the online store, used
to show progress.
"""
...
pass

@abstractmethod
def online_read(
Expand All @@ -67,20 +65,20 @@ def online_read(
requested_features: Optional[List[str]] = None,
) -> List[Tuple[Optional[datetime], Optional[Dict[str, ValueProto]]]]:
"""
Read feature values given an Entity Key. This is a low level interface, not
expected to be used by the users directly.
Reads features values for the given entity keys.
Args:
config: The RepoConfig for the current FeatureStore.
table: Feast FeatureView
entity_keys: a list of entity keys that should be read from the FeatureStore.
requested_features: (Optional) A subset of the features that should be read from the FeatureStore.
config: The config for the current feature store.
table: The feature view whose feature values should be read.
entity_keys: The list of entity keys for which feature values should be read.
requested_features: The list of features that should be read.
Returns:
Data is returned as a list, one item per entity key in the original order as the entity_keys argument.
Each item in the list is a tuple of event_ts for the row, and the feature data as a dict from feature names
to values. Values are returned as Value proto message.
A list of the same length as entity_keys. Each item in the list is a tuple where the first
item is the event timestamp for the row, and the second item is a dict mapping feature names
to values, which are returned in proto format.
"""
...
pass

@abstractmethod
def update(
Expand All @@ -92,7 +90,21 @@ def update(
entities_to_keep: Sequence[Entity],
partial: bool,
):
...
"""
Reconciles cloud resources with the specified set of Feast objects.
Args:
config: The config for the current feature store.
tables_to_delete: Feature views whose corresponding infrastructure should be deleted.
tables_to_keep: Feature views whose corresponding infrastructure should not be deleted, and
may need to be updated.
entities_to_delete: Entities whose corresponding infrastructure should be deleted.
entities_to_keep: Entities whose corresponding infrastructure should not be deleted, and
may need to be updated.
partial: If true, tables_to_delete and tables_to_keep are not exhaustive lists, so
infrastructure corresponding to other feature views should be not be touched.
"""
pass

def plan(
self, config: RepoConfig, desired_registry_proto: RegistryProto
Expand All @@ -101,7 +113,7 @@ def plan(
Returns the set of InfraObjects required to support the desired registry.
Args:
config: The RepoConfig for the current FeatureStore.
config: The config for the current feature store.
desired_registry_proto: The desired registry, in proto form.
"""
return []
Expand All @@ -113,4 +125,12 @@ def teardown(
tables: Sequence[FeatureView],
entities: Sequence[Entity],
):
...
"""
Tears down all cloud resources for the specified set of Feast objects.
Args:
config: The config for the current feature store.
tables: Feature views whose corresponding infrastructure should be deleted.
entities: Entities whose corresponding infrastructure should be deleted.
"""
pass
10 changes: 10 additions & 0 deletions sdk/python/feast/infra/online_stores/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ class RedisOnlineStoreConfig(FeastConfigBaseModel):


class RedisOnlineStore(OnlineStore):
"""
Redis implementation of the online store interface.
See https://github.com/feast-dev/feast/blob/master/docs/specs/online_store_format.md#redis-online-store-format
for more details about the data model for this implementation.
Attributes:
_client: Redis connection.
"""

_client: Optional[Union[Redis, RedisCluster]] = None

def delete_entity_values(self, config: RepoConfig, join_keys: List[str]):
Expand Down
3 changes: 1 addition & 2 deletions sdk/python/feast/infra/online_stores/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ class SqliteOnlineStoreConfig(FeastConfigBaseModel):

class SqliteOnlineStore(OnlineStore):
"""
OnlineStore is an object used for all interaction between Feast and the service used for offline storage of
features.
SQLite implementation of the online store interface. Not recommended for production usage.
Attributes:
_conn: SQLite connection.
Expand Down

0 comments on commit ce94804

Please sign in to comment.