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

adds quota manager, which helps in updating the project quotas #432

Merged
merged 2 commits into from
Apr 12, 2020

Conversation

yunus
Copy link
Member

@yunus yunus commented Mar 24, 2020

Provides a simple module quota.py to update the service quotas of projects programmatically via APIs.
The other option to update the quotas are via console which is a manual work. So this module enables GCP customer to automate the quota update process.

@googlebot googlebot added the cla: yes All committers have signed a CLA label Mar 24, 2020
@pull-request-size pull-request-size bot added the size/XL Denotes a PR that changes 500-999 lines. label Mar 24, 2020
@dvmorris
Copy link

dvmorris commented Apr 3, 2020

This is awesome! Have you ever tried updating a compute engine quota? I tried this morning and I am getting this error:

03/04/2020 07:28:05 INFO:URL being requested: POST https://serviceusage.googleapis.com/v1beta1/projects/*******/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%252Fnvidia_t4_gpus
/limits/%252Fproject%252Fregion/consumerOverrides?force=true&alt=json
Traceback (most recent call last):
  File "./update-computeengine-quota.py", line 109, in <module>
    project_quota=namespace.project_quota)
  File "./update-computeengine-quota.py", line 95, in main
    quota_updater.update_quota(project_quota, quota_dimensions)
  File "/home/dave/professional-services/tools/quota-manager/quota.py", line 171, in update_quota
    operation = self.__create_new_quota(new_quota, dimensions)
  File "/home/dave/professional-services/tools/quota-manager/quota.py", line 130, in __create_new_quota
    body=body)\
  File "/home/dave/.local/share/virtualenvs/quota-manager-7vDkce0R/lib/python3.7/site-packages/googleapiclient/_helpers.py", line 134, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/home/dave/.local/share/virtualenvs/quota-manager-7vDkce0R/lib/python3.7/site-packages/googleapiclient/http.py", line 898, in execute
    raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://serviceusage.googleapis.com/v1beta1/projects/*******/services/compute.googleapis.com/consumerQuotaMetrics/compute.googleapis.com%252F
nvidia_t4_gpus/limits/%252Fproject%252Fregion/consumerOverrides?force=true&alt=json returned "Precise limit override on metric 'compute.googleapis.com/nvidia_t4_gpus' with limit /project/region can't be applied in
 service :compute.googleapis.com">

I created a new class that passes the "dimension" attribute, and I tried updating a regional quota like nvidia_t4_gpus. I got the idea for the dimension attribute from this page: https://cloud.google.com/service-usage/docs/reference/rest/v1beta1/services.consumerQuotaMetrics.limits.adminOverrides#QuotaOverride

…mmatically via apis

fixes the multiline strings

adds yapf formatting

adds dimension option

yapify
@yunus
Copy link
Member Author

yunus commented Apr 3, 2020

@dvmorris I have added the dimensions but still getting the same error as you have. I suspect that compute engine apis cannot be updated via APIs. I have asked about this internally. You are in CC.

@yunus
Copy link
Member Author

yunus commented Apr 6, 2020

@dvmorris it turns out that compute engine quotas cannot be updated via APIs yet. But soon they will be ready for update.

@boredabdel boredabdel self-requested a review April 9, 2020 13:18
@boredabdel boredabdel self-assigned this Apr 9, 2020
Copy link
Member

@boredabdel boredabdel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except one comment

@boredabdel
Copy link
Member

I'm not able to merge this change but it looks good. Added Ryan and Jacob who i believe can merge

@ryanmcdowell ryanmcdowell merged commit c45fb5c into GoogleCloudPlatform:master Apr 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes All committers have signed a CLA size/XL Denotes a PR that changes 500-999 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants