Skip to content
Prev Previous commit
Next Next commit
format
Signed-off-by: cmuhao <sduxuhao@gmail.com>
  • Loading branch information
HaoXuAI committed May 9, 2024
commit f33e7698464b33298a43318a7eb5e353b497fdd1
60 changes: 30 additions & 30 deletions sdk/python/feast/infra/online_stores/contrib/elastichsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ def _bulk_batch_actions(self, batch):
}

def online_write_batch(
self,
config: RepoConfig,
table: FeatureView,
data: List[
Tuple[EntityKeyProto, Dict[str, ValueProto], datetime, Optional[datetime]]
],
progress: Optional[Callable[[int], Any]],
self,
config: RepoConfig,
table: FeatureView,
data: List[
Tuple[EntityKeyProto, Dict[str, ValueProto], datetime, Optional[datetime]]
],
progress: Optional[Callable[[int], Any]],
) -> None:
insert_values = []
for entity_key, values, timestamp, created_ts in data:
Expand All @@ -96,16 +96,16 @@ def online_write_batch(

batch_size = config.online_config.batch_size
for i in range(0, len(insert_values), batch_size):
batch = insert_values[i: i + batch_size]
batch = insert_values[i : i + batch_size]
actions = self._bulk_batch_actions(batch)
helpers.bulk(self._get_client(config), actions)

def online_read(
self,
config: RepoConfig,
table: FeatureView,
entity_keys: List[EntityKeyProto],
requested_features: Optional[List[str]] = None,
self,
config: RepoConfig,
table: FeatureView,
entity_keys: List[EntityKeyProto],
requested_features: Optional[List[str]] = None,
) -> List[Tuple[Optional[datetime], Optional[Dict[str, ValueProto]]]]:
if not requested_features:
body = {
Expand Down Expand Up @@ -136,13 +136,13 @@ def online_read(
return results

def update(
self,
config: RepoConfig,
tables_to_delete: Sequence[FeatureView],
tables_to_keep: Sequence[FeatureView],
entities_to_delete: Sequence[Entity],
entities_to_keep: Sequence[Entity],
partial: bool,
self,
config: RepoConfig,
tables_to_delete: Sequence[FeatureView],
tables_to_keep: Sequence[FeatureView],
entities_to_delete: Sequence[Entity],
entities_to_keep: Sequence[Entity],
partial: bool,
):
# implement the update method
for table in tables_to_delete:
Expand All @@ -151,20 +151,20 @@ def update(
self.create_index(config, table)

def teardown(
self,
config: RepoConfig,
tables: Sequence[FeatureView],
entities: Sequence[Entity],
self,
config: RepoConfig,
tables: Sequence[FeatureView],
entities: Sequence[Entity],
):
pass

def retrieve_online_documents(
self,
config: RepoConfig,
table: FeatureView,
requested_feature: str,
embedding: List[float],
top_k: int,
self,
config: RepoConfig,
table: FeatureView,
requested_feature: str,
embedding: List[float],
top_k: int,
) -> List[
Tuple[
Optional[datetime],
Expand Down