Skip to content

Commit 5bca082

Browse files
committed
Add batch retrieval to SDK
1 parent 838a1e7 commit 5bca082

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

sdk/python/feast/client.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def get(
245245
entity_data: pd.DataFrame,
246246
feature_ids: List[str],
247247
join_on: Dict[str, str] = None,
248-
batch: bool = True,
248+
batch: bool = False,
249249
) -> pd.DataFrame:
250250
self._connect_serving(skip_if_connected=True)
251251

@@ -296,13 +296,6 @@ def get_batch_features(
296296
timeout = time.time() + BATCH_FEATURE_REQUEST_WAIT_TIME_SECONDS
297297
previous_job = job
298298
while True:
299-
if time.time() > timeout:
300-
print(
301-
"Feature retrieval timed out while waiting for serving to export data."
302-
)
303-
break
304-
305-
time.sleep(1)
306299
job = get_batch_job_status(job)
307300

308301
if job.status == Job.status.JOB_STATUS_INVALID:
@@ -319,11 +312,21 @@ def get_batch_features(
319312
if job.status == Job.status.JOB_STATUS_DONE:
320313
print(f"Export complete for job id ${job.id}. Starting retrieval.")
321314

322-
feature_dataframe = feature_data_sets_to_pandas_dataframe(
323-
entity_data_set=entity_data.copy(),
324-
feature_data_sets=list(get_online_features_response_proto.feature_datasets),
325-
)
326-
return feature_dataframe
315+
feature_dataframe = feature_data_sets_to_pandas_dataframe(
316+
entity_data_set=entity_data.copy(),
317+
feature_data_sets=list(
318+
get_online_features_response_proto.feature_datasets
319+
),
320+
)
321+
return feature_dataframe
322+
323+
previous_job = job
324+
time.sleep(1)
325+
if time.time() > timeout:
326+
print(
327+
"Feature retrieval timed out while waiting for serving to export data."
328+
)
329+
break
327330

328331
def get_batch_job_status(self, job: Job):
329332
return self._serving_service_stub.ReloadJob(ReloadJobRequest(job=job))

0 commit comments

Comments
 (0)