Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In Historical Retrieval (SDK) use project from client context #1138

Merged
merged 2 commits into from
Nov 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 6 additions & 15 deletions sdk/python/feast/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,6 @@ def get_historical_features(
self,
feature_refs: List[str],
entity_source: Union[pd.DataFrame, FileSource, BigQuerySource],
project: Optional[str] = None,
output_location: Optional[str] = None,
) -> RetrievalJob:
"""
Expand All @@ -928,8 +927,6 @@ def get_historical_features(
The user needs to make sure that the source (or staging location, if entity_source is
a Panda DataFrame) is accessible from the Spark cluster that will be used for the
retrieval job.
project: Specifies the project that contains the feature tables
which the requested features belong to.
destination_path: Specifies the path in a bucket to write the exported feature data files

Returns:
Expand All @@ -945,13 +942,12 @@ def get_historical_features(
>>> feature_refs = ["bookings:bookings_7d", "bookings:booking_14d"]
>>> entity_source = FileSource("event_timestamp", ParquetFormat(), "gs://some-bucket/customer")
>>> feature_retrieval_job = feast_client.get_historical_features(
>>> feature_refs, entity_source, project="my_project")
>>> feature_refs, entity_source)
>>> output_file_uri = feature_retrieval_job.get_output_file_uri()
"gs://some-bucket/output/
"""
project = project or FEAST_DEFAULT_OPTIONS[CONFIG_PROJECT_KEY]
feature_tables = self._get_feature_tables_from_feature_refs(
feature_refs, project
feature_refs, self.project
)

if output_location is None:
Expand Down Expand Up @@ -988,7 +984,7 @@ def get_historical_features(
GetHistoricalFeaturesRequest(
feature_refs=feature_refs,
entity_source=entity_source.to_proto(),
project=project,
project=self.project,
output_format=output_format,
output_location=output_location,
),
Expand All @@ -1011,10 +1007,7 @@ def get_historical_features(
)

def get_historical_features_df(
self,
feature_refs: List[str],
entity_source: Union[FileSource, BigQuerySource],
project: str = None,
self, feature_refs: List[str], entity_source: Union[FileSource, BigQuerySource],
):
"""
Launch a historical feature retrieval job.
Expand All @@ -1027,8 +1020,6 @@ def get_historical_features_df(
entity_source (Union[FileSource, BigQuerySource]): Source for the entity rows.
The user needs to make sure that the source is accessible from the Spark cluster
that will be used for the retrieval job.
project: Specifies the project that contains the feature tables
which the requested features belong to.

Returns:
Returns the historical feature retrieval result in the form of Spark dataframe.
Expand All @@ -1043,10 +1034,10 @@ def get_historical_features_df(
>>> feature_refs = ["bookings:bookings_7d", "bookings:booking_14d"]
>>> entity_source = FileSource("event_timestamp", ParquetFormat, "gs://some-bucket/customer")
>>> df = feast_client.get_historical_features(
>>> feature_refs, entity_source, project="my_project")
>>> feature_refs, entity_source)
"""
feature_tables = self._get_feature_tables_from_feature_refs(
feature_refs, project
feature_refs, self.project
)
return start_historical_feature_retrieval_spark_session(
client=self,
Expand Down