【问题标题】:Time out: Access Azure blob storage from within an Azure ML experiment超时:从 Azure ML 实验中访问 Azure Blob 存储
【发布时间】:2017-11-18 20:30:30
【问题描述】:

我想从 Azure ML 实验中访问 Azure Blob 存储。我完全遵循了答案 Access Azure blog storage from within an Azure ML experiment 但是,出现了一些错误。

我的代码是

from azure.storage.blob import BlobService

def azureml_main(dataframe1 = None, dataframe2 = None):
   dataframe1.to_csv("output.csv", index=True)
   account_name = "acount_name"
   account_key="rJfqPEFcbgpS...SKZrBs5J2eOq0IJYrc2Vg=="
   CONTAINER_NAME = "CONTAINER_NAME"

   blob_service = BlobService(account_name, account_key, protocol='http')
   blob_service.put_block_blob_from_path(CONTAINER_NAME,"output","output.csv")

错误日志爆了

[Critical]     Error: Error 0085: The following error occurred during script 
evaluation, please view the output log for more information:
---------- Start of error message from Python interpreter ----------
Caught exception while executing function: Traceback (most recent call last):
File "C:\pyhome\lib\site-
packages\requests\packages\urllib3\connectionpool.py", line 559, in urlopen
body=body, headers=headers)
File "C:\pyhome\lib\site-
packages\requests\packages\urllib3\connectionpool.py", line 353, in 
_make_request
conn.request(method, url, **httplib_request_kw)
File "C:\pyhome\lib\http\client.py", line 1083, in request
self._send_request(method, url, body, headers)
File "C:\pyhome\lib\http\client.py", line 1128, in _send_request
self.endheaders(body)
File "C:\pyhome\lib\http\client.py", line 1079, in endheaders
self._send_output(message_body)
File "C:\pyhome\lib\http\client.py", line 911, in _send_output
self.send(msg)
File "C:\pyhome\lib\http\client.py", line 885, in send
self.sock.sendall(data)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\pyhome\lib\site-packages\requests\adapters.py", line 376, in send
timeout=timeout
File "C:\pyhome\lib\site-
packages\requests\packages\urllib3\connectionpool.py", line 609, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:\pyhome\lib\site-packages\requests\packages\urllib3\util\retry.py", 
line 247, in increment
raise six.reraise(type(error), error, _stacktrace)
File "C:\pyhome\lib\site-packages\requests\packages\urllib3\packages\six.py", 
line 309, in reraise
raise value.with_traceback(tb)
File "C:\pyhome\lib\site-
packages\requests\packages\urllib3\connectionpool.py", line 559, in urlopen
body=body, headers=headers)
File "C:\pyhome\lib\site-
packages\requests\packages\urllib3\connectionpool.py", line 353, in 
_make_request
conn.request(method, url, **httplib_request_kw)
File "C:\pyhome\lib\http\client.py", line 1083, in request
self._send_request(method, url, body, headers)
File "C:\pyhome\lib\http\client.py", line 1128, in _send_request
self.endheaders(body)
File "C:\pyhome\lib\http\client.py", line 1079, in endheaders
self._send_output(message_body)
File "C:\pyhome\lib\http\client.py", line 911, in _send_output
self.send(msg)
File "C:\pyhome\lib\http\client.py", line 885, in send
self.sock.sendall(data)
requests.packages.urllib3.exceptions.ProtocolError: ('Connection aborted.', 
timeout('timed out',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\server\invokepy.py", line 199, in batch
odfs = mod.azureml_main(*idfs)
File "C:\temp\a24f27b62ef74991b262bafe5e685164.py", line 39, in azureml_main
blob_service.put_block_blob_from_path(CONTAINER_NAME,"ppp","output.csv")
File "c:\temp\script bundle\azure\storage\blob\blobservice.py", line 975, in 
put_block_blob_from_path
retry_wait)
File "c:\temp\script bundle\azure\storage\blob\blobservice.py", line 1072, in 
put_block_blob_from_file
x_ms_lease_id)
File "c:\temp\script bundle\azure\storage\blob\blobservice.py", line 883, in 
put_blob
self._perform_request(request)
File "c:\temp\script bundle\azure\storage\storageclient.py", line 171, in 
_perform_request
resp = self._filter(request)
File "c:\temp\script bundle\azure\storage\storageclient.py", line 160, in 
_perform_request_worker
return self._httpclient.perform_request(request)
File "c:\temp\script bundle\azure\storage\_http\httpclient.py", line 181, in 
perform_request
self.send_request_body(connection, request.body)
File "c:\temp\script bundle\azure\storage\_http\httpclient.py", line 143, in 
send_request_body
connection.send(request_body)
File "c:\temp\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 468, in request
resp = self.send(prep, **send_kwargs)
File "C:\pyhome\lib\site-packages\requests\sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "C:\pyhome\lib\site-packages\requests\adapters.py", line 426, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', timeout('timed 
out',))
Process returned with non-zero exit code 1

感谢任何帮助或想法!

【问题讨论】:

  • 谢谢你的评论,彼得潘。

标签: python azure machine-learning blob azure-machine-learning-studio


【解决方案1】:

我尝试通过复制您的代码并上传包含 azure python library 的数据集 zip 文件来重现您的问题,但失败了。

根据报错信息,似乎只是网络层的问题。也许稍后再试一次,它会起作用的。

根据我的经验,其他建议如下。

  1. 检查您的存储帐户是否启用了Configuration 选项卡中的Secure transfer required 选项。如果是这样,请删除protocol='http' 代码或更改为https
  2. 根据您使用的存储API,它是Azure Storage Python SDK 的旧版本0.20.3。您可以上传包含新版本 0.34.3 的数据集 zip 文件,而不是旧版本以重试。

希望对你有帮助。

【讨论】:

    猜你喜欢
    • 2016-05-16
    • 2023-01-30
    • 2020-06-03
    • 2021-12-18
    • 1970-01-01
    • 2017-09-16
    • 2019-10-14
    • 2021-11-19
    • 2019-01-15
    相关资源
    最近更新 更多