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

Improve GCP exception handling #1561

Merged
merged 5 commits into from
May 15, 2021
Merged

Conversation

woop
Copy link
Member

@woop woop commented May 14, 2021

Signed-off-by: Willem Pienaar git@willem.co

What this PR does / why we need it:

If no gcloud account is specified, then users today are not provided with a useful exception. Instead, the exception is hidden behind a failure due to an anonymous client not having access to their resources.

Does this PR introduce a user-facing change?:

NONE

@feast-ci-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: woop

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jklegar
Copy link
Collaborator

jklegar commented May 14, 2021

/lgtm

@feast-ci-bot
Copy link
Collaborator

New changes are detected. LGTM label has been removed.

@woop woop changed the title Remove silent failure with GCS registry Improve GCP exception handling May 14, 2021
@@ -27,6 +26,14 @@
from feast.registry import Registry
from feast.repo_config import DatastoreOnlineStoreConfig, RepoConfig

try:
from google.auth.exceptions import DefaultCredentialsError
from google.cloud import bigquery, datastore
Copy link
Collaborator

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

Copy link
Member Author

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.

Copy link
Member Author

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

@@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The 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)

woop added 5 commits May 14, 2021 18:28
Signed-off-by: Willem Pienaar <git@willem.co>
Signed-off-by: Willem Pienaar <git@willem.co>
Signed-off-by: Willem Pienaar <git@willem.co>
Signed-off-by: Willem Pienaar <git@willem.co>
Signed-off-by: Willem Pienaar <git@willem.co>
@codecov-commenter
Copy link

codecov-commenter commented May 15, 2021

Codecov Report

Merging #1561 (1169b30) into master (1436a02) will decrease coverage by 0.08%.
The diff coverage is 52.17%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1561      +/-   ##
==========================================
- Coverage   83.81%   83.72%   -0.09%     
==========================================
  Files          65       65              
  Lines        5628     5634       +6     
==========================================
  Hits         4717     4717              
- Misses        911      917       +6     
Flag Coverage Δ
integrationtests 83.63% <52.17%> (-0.09%) ⬇️
unittests 78.66% <36.36%> (+1.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
sdk/python/feast/registry.py 79.11% <25.00%> (+0.16%) ⬆️
sdk/python/feast/infra/gcp.py 81.20% <50.00%> (-1.38%) ⬇️
sdk/python/feast/infra/offline_stores/bigquery.py 92.14% <50.00%> (-2.02%) ⬇️
sdk/python/feast/errors.py 62.50% <60.00%> (-0.47%) ⬇️
sdk/python/feast/infra/offline_stores/helpers.py 91.66% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1436a02...1169b30. Read the comment docs.

@woop woop merged commit 73ac3de into feast-dev:master May 15, 2021
@tedhtchang
Copy link
Contributor

Fixes #1560 #1485

woop added a commit that referenced this pull request May 19, 2021
* Remove try/catch that fails silently

Signed-off-by: Willem Pienaar <git@willem.co>

* Remove unused import

Signed-off-by: Willem Pienaar <git@willem.co>

* Provided clearer exception handling for GCP dependencies

Signed-off-by: Willem Pienaar <git@willem.co>

* Ensure that GCP dependencies aren't loaded unnecessarily

Signed-off-by: Willem Pienaar <git@willem.co>

* Fix lint

Signed-off-by: Willem Pienaar <git@willem.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants