-
Notifications
You must be signed in to change notification settings - Fork 998
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
Improve GCP exception handling #1561
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4be7e3f
Remove try/catch that fails silently
woop 7e88de5
Remove unused import
woop 9c7a794
Provided clearer exception handling for GCP dependencies
woop 7cf3545
Ensure that GCP dependencies aren't loaded unnecessarily
woop 1169b30
Fix lint
woop File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
|
||
import pandas | ||
import pyarrow | ||
from google.auth.exceptions import DefaultCredentialsError | ||
from jinja2 import BaseLoader, Environment | ||
|
||
from feast.data_source import BigQuerySource, DataSource | ||
|
@@ -20,6 +19,15 @@ | |
from feast.registry import Registry | ||
from feast.repo_config import RepoConfig | ||
|
||
try: | ||
from google.auth.exceptions import DefaultCredentialsError | ||
from google.cloud import bigquery | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here as well, I think (though it may have been just one of gcp.py and bigquery.py where this happened) |
||
|
||
except ImportError as e: | ||
from feast.errors import FeastExtrasDependencyImportError | ||
|
||
raise FeastExtrasDependencyImportError("gcp", str(e)) | ||
|
||
|
||
class BigQueryOfflineStore(OfflineStore): | ||
@staticmethod | ||
|
@@ -192,7 +200,6 @@ class FeatureViewQueryContext: | |
|
||
def _upload_entity_df_into_bigquery(project, entity_df, client) -> str: | ||
"""Uploads a Pandas entity dataframe into a BigQuery table and returns a reference to the resulting table""" | ||
from google.cloud import bigquery | ||
|
||
# First create the BigQuery dataset if it doesn't exist | ||
dataset = bigquery.Dataset(f"{client.project}.feast_{project}") | ||
|
@@ -303,8 +310,6 @@ def build_point_in_time_query( | |
|
||
def _get_bigquery_client(): | ||
try: | ||
from google.cloud import bigquery | ||
|
||
client = bigquery.Client() | ||
except DefaultCredentialsError as e: | ||
raise FeastProviderLoginError( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iirc we didn't have google cloud dependencies imported at the top because Feast will try to import them even when the user is not using gcp (e.g. they're just trying things locally) due to this file being imported somewhere else. If you uninstall the google cloud pip packages in your venv and try the quickstart you can confirm whether this happens
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, but I think its cleaner to conditionally import our providers and stores than their subdependencies. Let me test to validate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think only this change was necessary. Our tests are failing for other reasons