在AzureML自定义python库中使用Azure存储库

2024-06-02 04:42:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我对Python有点陌生,所以我可能不完全理解如何准确地将库导入azureml

我有一堆数据存储在表存储中,我有本地Python代码来成功地连接所有这些数据,为ML实验做准备。我了解到AzureML环境没有安装Azure存储库,因此根据this的步骤来上载包含在anaconda3\lib\site包下找到的Azure存储库的ZIP文件。我把所有的azure目录放在一个zip文件下,然后按照链接中文档的底部上传zip文件作为数据集,并将数据集附加到ML中的executepython脚本节点

当我尝试运行节点时,会出现如下错误:

requestId = 825883c7ccb74f7e869e68e60d3cd919 errorComponent=Module. taskStatusCode=400. e "C:\pyhome\lib\ssl.py", line 856, in send return self._sslobj.write(data) File "C:\pyhome\lib\ssl.py", line 581, in write return self._sslobj.write(data)socket.timeout: The write operation timed outDuring 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) File "C:\pyhome\lib\ssl.py", line 886, in sendall v = self.send(data[count:]) File "C:\pyhome\lib\ssl.py", line 856, in send return self._sslobj.write(data) File "C:\pyhome\lib\ssl.py", line 581, in write return self._sslobj.write(data)requests.packages.urllib3.exceptions.ProtocolError: ('Connection aborted.', timeout('The write operation timed out',))During handling of the above exception, another exception occurred:Traceback (most recent call last): File "c:\temp\script bundle\azure\storage\storageclient.py", line 221, in _perform_request response = self._httpclient.perform_request(request) File "c:\temp\script bundle\azure\storage\_http\httpclient.py", line 114, in perform_request proxies=self.proxies) 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('The write operation 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\fa22884a19884f658d411dc0bdf05715.py", line 33, in azureml_main data = table_service.query_entities(table_name) File "c:\temp\script bundle\azure\storage\table\tableservice.py", line 728, in query_entities resp = self._query_entities(*args, **kwargs) File "c:\temp\script bundle\azure\storage\table\tableservice.py", line 795, in _query_entities operation_context=_context) File "c:\temp\script bundle\azure\storage\table\tableservice.py", line 1093, in _perform_request return super(TableService, self)._perform_request(request, parser, parser_args, operation_context) File "c:\temp\script bundle\azure\storage\storageclient.py", line 279, in _perform_request raise ex File "c:\temp\script bundle\azure\storage\storageclient.py", line 251, in _perform_request raise AzureException(ex.args[0])azure.common.AzureException: ('Connection aborted.', timeout('The write operation timed out',))Process returned with non-zero exit code 

我不确定我做错了什么


Tags: inpyselfsendrequestlibpackagesline
1条回答
网友
1楼 · 发布于 2024-06-02 04:42:07

在azuremlstudio中,Python脚本(以及R脚本)在沙盒中运行,因此无法通过网络访问资源。见limitations

The Execute Python Script currently has the following limitations:

  1. Sandboxed execution. The Python runtime is currently sandboxed and, as a result, does not allow access to the network...

因此,如果要从blob读取数据,请使用单独的导入数据模块;如果要向blob写入数据,请使用单独的导出数据模块。你知道吗

相关问题 更多 >