在 AzureML 中使用 Azure 存储库 - 自定义 python 库
Using Azure Storage libraries in AzureML - Custom python library
我是 Python 的新手,所以我可能不完全理解如何将库正确地导入 Azure ML。
我有一堆数据存储在 Table 存储中,我有本地 Python 代码可以成功加入所有这些数据,为 ML 实验做准备。我了解到 AzureML 环境没有安装 Azure 存储库,因此按照 this 的步骤上传了一个包含我在 anaconda3\lib\site-packages 下找到的 Azure 存储库的 ZIP 文件。我获取了所有 azure 目录并将它们放在一个 zip 文件下,然后按照 link 中文档的底部将 zip 文件作为数据集上传并将数据集附加到执行 Python 脚本ML 中的节点。
当我尝试 运行 节点时出现这样的错误:
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
我不确定我做错了什么
在 Azure ML Studio 中,Python 脚本(以及与此相关的 R 脚本)运行 在沙箱中,因此无法通过网络访问资源。见 limitations:
The Execute Python Script currently has the following limitations:
- Sandboxed execution. The Python runtime is currently sandboxed and, as
a result, does not allow access to the network...
因此,如果您想从 blob 读取数据,请使用单独的导入数据模块;如果您想写入 blob,请使用单独的导出数据模块。
我是 Python 的新手,所以我可能不完全理解如何将库正确地导入 Azure ML。
我有一堆数据存储在 Table 存储中,我有本地 Python 代码可以成功加入所有这些数据,为 ML 实验做准备。我了解到 AzureML 环境没有安装 Azure 存储库,因此按照 this 的步骤上传了一个包含我在 anaconda3\lib\site-packages 下找到的 Azure 存储库的 ZIP 文件。我获取了所有 azure 目录并将它们放在一个 zip 文件下,然后按照 link 中文档的底部将 zip 文件作为数据集上传并将数据集附加到执行 Python 脚本ML 中的节点。
当我尝试 运行 节点时出现这样的错误:
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
我不确定我做错了什么
在 Azure ML Studio 中,Python 脚本(以及与此相关的 R 脚本)运行 在沙箱中,因此无法通过网络访问资源。见 limitations:
The Execute Python Script currently has the following limitations:
- Sandboxed execution. The Python runtime is currently sandboxed and, as a result, does not allow access to the network...
因此,如果您想从 blob 读取数据,请使用单独的导入数据模块;如果您想写入 blob,请使用单独的导出数据模块。