0
使用從文檔的例子:如何處理配置的吞吐量例外dynamodb query_2
>>> rev_with_d = users.query_2(
... account_type__eq='standard_user',
... last_name__beginswith='D',
... reverse=True,
... limit=2
...)
>>> for user in rev_with_d:
... print user['first_name']
'John'
'Jane'
將如何吞吐量例外,在這種情況下,如何處理?
我曾嘗試在每個循環內使用指數回退,但異常不會在那裏被捕獲。
編輯:
回溯的要求:
Traceback (most recent call last):
File "kgraph.py", line 51, in <module>
for user in rev_with_d:
File "/Library/Python/2.7/site-packages/boto/dynamodb2/results.py", line 62, in __next__
self.fetch_more()
File "/Library/Python/2.7/site-packages/boto/dynamodb2/results.py", line 146, in fetch_more
results = self.the_callable(*args, **kwargs)
File "/Library/Python/2.7/site-packages/boto/dynamodb2/table.py", line 1132, in _query
**kwargs
File "/Library/Python/2.7/site-packages/boto/dynamodb2/layer1.py", line 1522, in query
body=json.dumps(params))
File "/Library/Python/2.7/site-packages/boto/dynamodb2/layer1.py", line 2100, in make_request
retry_handler=self._retry_handler)
File "/Library/Python/2.7/site-packages/boto/connection.py", line 937, in _mexe
status = retry_handler(response, i, next_sleep)
File "/Library/Python/2.7/site-packages/boto/dynamodb2/layer1.py", line 2134, in _retry_handler
response.status, response.reason, data)
boto.dynamodb2.exceptions.ProvisionedThroughputExceededException: ProvisionedThroughputExceededException: 400 Bad Request
{u'message': u'The level of configured provisioned throughput for the table was exceeded. Consider increasing your provisioning level with the UpdateTable API', u'__type': u'com.amazonaws.dynamodb.v20120810#ProvisionedThroughputExceededException'}
你有沒有可以提供的回溯,還是你要求假設的情況?此外,博託已經建立了指數退避。只需設置DynamoDBConnection.NumberRetries屬性將其設置爲任何你想要的,默認值是10. – Endophage 2014-10-03 23:59:20
我認爲這是我正在尋找的答案。謝謝 – user602525 2014-10-04 16:49:32
是的,當博託引發這個錯誤時,它已經嘗試過多次運行你的查詢。 – Endophage 2014-10-06 18:21:53