-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fix(ingestion/bigquery): user exceeded quota for concurrent project.lists requests #10578
Merged
hsheth2
merged 19 commits into
datahub-project:master
from
shubhamjagtap639:bigquery-project.lists-requests-quota-exceeded
Jun 15, 2024
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
6385a63
add Bigquery list projects rate limit
shubhamjagtap639 fc9a8cc
Address review comments
shubhamjagtap639 58194de
Modify comment
shubhamjagtap639 1bb7819
Merge branch 'master' into bigquery-project.lists-requests-quota-exce…
hsheth2 bcedaf5
Add rate limiter for bq client list projects request
shubhamjagtap639 18e3b90
Revert test case changes
shubhamjagtap639 8061a37
Modify ratelimiter code and reduce the max result of list project api
shubhamjagtap639 206a123
Modify the max result and page size in bq client list project
shubhamjagtap639 9fa2318
temporary debug changes
shubhamjagtap639 02b69a0
Temporary debug changes
shubhamjagtap639 6fc9842
Add retry to bq client list project api
shubhamjagtap639 f4f7388
Modify bq get project method
shubhamjagtap639 31eece4
Modify bq get project method
shubhamjagtap639 29a22a6
Add debug log in bg list project request
shubhamjagtap639 28b4a6e
Add back retry to bq client list project request
shubhamjagtap639 be8a63c
Revert the get_projects method and add retry in list project request
shubhamjagtap639 a8bb758
Modify get_project method and list project count in report
shubhamjagtap639 ae42a79
Modify comment in get_project method
shubhamjagtap639 a685b27
Merge branch 'master' into bigquery-project.lists-requests-quota-exce…
hsheth2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,12 +150,22 @@ def get_query_result(self, query: str) -> RowIterator: | |
def get_projects(self) -> List[BigqueryProject]: | ||
with self.report.list_projects: | ||
try: | ||
projects = self.bq_client.list_projects() | ||
|
||
return [ | ||
BigqueryProject(id=p.project_id, name=p.friendly_name) | ||
for p in projects | ||
] | ||
projects: List[BigqueryProject] = [] | ||
page_token: Optional[str] = None | ||
while True: | ||
projects_iterator = self.bq_client.list_projects( | ||
max_results=5, page_token=page_token | ||
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. why is max_results=5? 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. Sorry, this should be 50 as API returns max 50 projects per page. Refer link |
||
) | ||
projects.extend( | ||
[ | ||
BigqueryProject(id=p.project_id, name=p.friendly_name) | ||
for p in projects_iterator | ||
] | ||
) | ||
page_token = projects_iterator.next_page_token | ||
if page_token is None: | ||
break | ||
return projects | ||
except Exception as e: | ||
logger.error(f"Error getting projects. {e}", exc_info=True) | ||
return [] | ||
|
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
Oops, something went wrong.
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.
add a comment explaining why this was required
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.
Yes, Let me add the comment.
The thing is we are not able to regenerate the error but from doc we got to know two project.lists request is allowed per second and assumed that bigquery client method list_projects is not adding any limit in calling request.
Hence we are trying to add limit in requests per second externally,
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.
Yup I understand that, but having it as a comment in the code will help future editors of this file