gpt4 book ai didi

python-2.7 - app_identity_service.GetAccessToken() 需要比可用配额更多的配额

转载 作者:太空宇宙 更新时间:2023-11-03 15:35:06 25 4
gpt4 key购买 nike

我使用 App Engine 和大查询作为我网站的后端。每当用户点击时,我都会将他们登录到 bigquery,以便在当天晚些时候进行分析。我每天的点击次数接近 75,000 次。直到上周它工作正常。这是我使用的代码。

    body = {"rows":[bodyFields]}

credentials = appengine.AppAssertionCredentials(scope=BIGQUERY_SCOPE)
http = credentials.authorize(httplib2.Http())
bigquery = discovery.build('bigquery', 'v2', http=http)

response = bigquery.tabledata().insertAll(
projectId=PROJECT_ID,
datasetId=BIGQUERY_DATASETID,
tableId=BIGQUERY_TABLEID,
body=body).execute()

现在突然间我遇到了配额异常。我的应用程序是付费应用引擎实例。下面是我的异常的堆栈跟踪

dashboard screenshot

Attempting refresh to obtain initial access_token

The API call app_identity_service.GetAccessToken() required more quota than is available.
Traceback (most recent call last):
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in __call__
return handler.dispatch()
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "/base/data/home/apps/s~projectname/bigqueryapi.387952303347375306/filename.py", line 1611, in post
bigquery = discovery.build('bigquery', 'v2', http=http)
File "/base/data/home/apps/s~projectname/bigqueryapi.387952303347375306/oauth2client/util.py", line 129, in positional_wrapper
return wrapped(*args, **kwargs)
File "/base/data/home/apps/s~projectname/bigqueryapi.387952303347375306/apiclient/discovery.py", line 198, in build
resp, content = http.request(requested_url)
File "/base/data/home/apps/s~projectname/bigqueryapi.387952303347375306/oauth2client/util.py", line 129, in positional_wrapper
return wrapped(*args, **kwargs)
File "/base/data/home/apps/s~projectname/bigqueryapi.387952303347375306/oauth2client/client.py", line 516, in new_request
self._refresh(request_orig)
File "/base/data/home/apps/s~projectname/bigqueryapi.387952303347375306/oauth2client/appengine.py", line 194, in _refresh
scopes, service_account_id=self.service_account_id)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/app_identity/app_identity.py", line 589, in get_access_token
scopes, service_account_id=service_account_id)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/app_identity/app_identity.py", line 547, in get_access_token_uncached
return rpc.get_result()
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 613, in get_result
return self.__get_result_hook(self)
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/app_identity/app_identity.py", line 519, in get_access_token_result
rpc.check_success()
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 579, in check_success
self.__rpc.CheckSuccess()
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/apiproxy_rpc.py", line 134, in CheckSuccess
raise self.exception
OverQuotaError: The API call app_identity_service.GetAccessToken() required more quota than is available.

我的流量并没有增加太多,处理程序被命中的次数与过去 2 个月的数据几乎相同。那么为什么我会收到此错误。

最佳答案

为了确定您遇到配额错误的原因,您需要分享有关您的使用情况的更多详细信息。配额应每 24 小时重置一次。您知道错误出现需要多长时间,以及您在那个时间点成功服务了多少流量吗?

您提到您“在当天晚些时候进行分析”,这表明您可能正在使用 TaskQueue APIDeferred Tasks .这些任务可能由于其他原因而失败,并且 retrying ,这可能会很快耗尽您的配额。如果您正在使用 TaskQueues,您可以尝试调整 queue configuration and retry options .

您可能能够节省配额的另一种方法是将您正在构建的 bigquery 发现服务保存到 Memcache API 之类的东西中,以便它可以重复用于多个请求BigQuery 服务。

关于python-2.7 - app_identity_service.GetAccessToken() 需要比可用配额更多的配额,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33207825/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com