[英]Azure ML with python - (SSLError(SSLError('The write operation timed out',),),) when doing a table storage entity query
嗨,我正在嘗試通過執行從表存儲帳戶中查詢數據的python腳本來開始Azure ML算法。 我這樣做:
entities_Azure=table_session.query_entities(table_name=table_name,
filter="PartitionKey eq '" + partitionKey + "'",
select='PartitionKey,RowKey,Timestamp,value',
next_partition_key = next_pk,
next_row_key = next_rk, top=1000)
我傳入了調用此代碼所在的函數時所需的變量,並且通過在Azure ML中包含一個zip文件來包含該函數。
我認為該錯誤是由於查詢時間太長或類似的原因所致,但它必須花費很長時間,因為我可能不得不查詢大量數據。...我看着Windows Azure存儲表連接后的SO 超時,在達到這些查詢的指定閾值方面,我認為這是一個類似的問題,但是我不知道如何避免。 該程序的運行時間只有大約1.5分鍾,然后才超時。
關於這種情況為什么發生以及我如何能夠解決的任何想法?
根據Peter Pan-MSFT的建議,我運行了一個更具體的查詢:
entities_Azure=table_service.query_entities(table_name='#######',select='PartitionKey,RowKey,Timestamp,value', next_partition_key = None, next_row_key = None, top=2)
這返回以下錯誤日志:
Error 0085: The following error occurred during script evaluation, please view the output log for more information:
---------- Start of error message from Python interpreter ----------
data:text/plain,Caught exception while executing function: Traceback (most recent call last):
File "C:\server\invokepy.py", line 169, in
batch odfs = mod.azureml_main(*idfs)
File "C:\temp\azuremod.py", line 61, in
azureml_main entities_Azure=table_service.query_entities(table_name='######',select='PartitionKey,RowKey,Timestamp,value', next_partition_key = None, next_row_key = None, top=2)
File "./Script Bundle\azure\storage\table\tableservice.py", line 421, in query_entities
response = self._perform_request(request)
File "./Script Bundle\azure\storage\storageclient.py", line 171, in _perform_request
resp = self._filter(request)
File "./Script Bundle\azure\storage\table\tableservice.py", line 664, in _perform_request_worker
return self._httpclient.perform_request(request)
File "./Script Bundle\azure\storage\_http\httpclient.py", line 181, in perform_request
self.send_request_body(connection, request.body)
File "./Script Bundle\azure\storage\_http\httpclient.py", line 145, in send_request_body
connection.send(None)
File "./Script Bundle\azure\storage\_http\requestsclient.py", line 81, in send
self.response = self.session.request(self.method, self.uri, data=request_body, headers=self.headers, timeout=self.timeout)
File "C:\pyhome\lib\site-packages\requests\sessions.py", line 456, in request
resp = self.send(prep, **send_kwargs)
File "C:\pyhome\lib\site-packages\requests\sessions.py", line 559, in send
r = adapter.send(request, **kwargs)
File "C:\pyhome\lib\site-packages\requests\adapters.py", line 382, in send
raise SSLError(e, request=request)
SSLError: The write operation timed out
---------- End of error message from Python interpreter
---------- Start time: UTC 11/18/2015 11:39:32 End time: UTC 11/18/2015 11:40:53
希望這會給情況帶來更多的見解!
我試圖用我自己生成的數據填充表存儲,並希望通過像您這樣的查詢來重現您的問題,但是失敗了。
我發現了REST API的表存儲查詢超時問題(用於python封裝的REST API的Azure存儲sdk)。 表服務REST API的頁面( https://msdn.microsoft.com/zh-cn/library/azure/dd894042.aspx )“查詢超時和分頁”顯示:
針對Table服務的查詢一次最多可以返回1,000個項目,並且最多可以執行五秒鍾。 如果結果集包含1,000多個項目,或者查詢未在五秒鍾內完成,或者查詢超出了分區邊界,則響應中包含的標頭將為開發人員提供繼續令牌,以便在站點上恢復查詢。結果集中的下一項。 可能會為查詢表操作或查詢實體操作返回連續令牌標頭。
請注意,分配給請求的用於計划和處理查詢的總時間為30秒,其中包括執行查詢的5秒。
查詢可能不返回任何結果,但仍返回繼續標頭。
我認為問題是由達到這些單獨的閾值引起的。
另外,我在Data Input and Output
使用了模塊Reader
, Data Input and Output
通過Azure Table
設置了數據源,以在Azure ML Studio實驗中成功快速地讀取1000個實體。
對於這種情況,建議您使用指定的查詢過濾器來查詢表存儲,例如:
entities_Azure=table_session.query_entities(table_name=table_name,
filter="PartitionKey eq '" + partitionKey + "' and Rowkey eq '" + rowkey + "'",
select='PartitionKey,RowKey,Timestamp,value',
next_partition_key = next_pk,
next_row_key = next_rk, top=1000)
我們可以使用此代碼來判斷問題是連接問題還是閾值問題。
如有任何疑問,請隨時告訴我。
在Azure ML實驗中,我在Access Azure博客存儲中遇到了一個非常類似的問題。 我第一次發布時並沒有意識到它們是相似的。 但是,隨着調試和幫助的繼續,這一點變得非常清楚。
底線:通過HTTPS / SSL訪問azure.storage.*
時,發生帶有超時的azure.storage.*
。 如果更改“ TableService”的創建以強制使用HTTP( protocol='http'
),則超時錯誤將停止。
table_service = TableService(account_name='myaccount', account_key='mykey',protocol='http')
完整的分析可以在上面的StackOverflow帖子中找到。 但是,我看到了這一點,覺得應該在這里直接提及以幫助搜索。 該修復程序適用於azure.storage.table,azure.storage.blob,azure.storage.page和azure.storage.queue。
PS。 是的,我知道使用HTTP並不是最佳選擇,但是,您正在 Azure 中運行所有內容。 當您離開Azure ML(或Azure應用服務)時,可以切換回HTTPS。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.