简体   繁体   中英

Azure ML Execute Python Module: Network I/O Disabled?

Is there no way to connect to a URL from azure ml and get it's content

my code:

import requests
def azureml_main(dataframe1 = None, dataframe2 = None):    
    b= requests.get("http://www.google.com",timeout=30)
    dataframe1 = b.content
    return dataframe1

Is there any change need to be made to connect to URL

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 ----------
data:text/plain,Caught exception while executing function: Traceback (most recent call last):
File "C:\server\invokepy.py", line 167, in batch
odfs = mod.azureml_main(*idfs)
File "C:\temp\azuremod.py", line 24, in azureml_main
b= requests.get("http://www.google.com",timeout=30)
File "C:\pyhome\lib\site-packages\requests\api.py", line 55, in get
return request('get', url, **kwargs)
File "C:\pyhome\lib\site-packages\requests\api.py", line 44, in request
return session.request(method=method, url=url, **kwargs)
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 375, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='www.google.com', port=80): Max retries exceeded with url: / (Caused by <class 'socket.gaierror'>: [Errno 11001] getaddrinfo failed)

---------- End of error message from Python  interpreter  ---------

Or is there any change needed to be made on the azure ml settings

UPDATE 1/28/2016

Network I/O for Execute Python Script is now supported.

Out of date

Network I/O is not support from Execute Python Modules. In order to execute such a program, you should instead launch a virtual machine(Windows or Linux your choice).

Windows:

  1. RDP into Virtual Machine
  2. Install your choice of Python
  3. You can drag and drop your Python program from your Local Windows machine onto your RDP screen to transfer your code
  4. Then run your program

Ubuntu:

  1. SSH into your virtual machine using Cygwin or Putty(Windows) or Terminal SSH (mac) ssh yourUserName@yourAzureVM.cloudapps.net
  2. install Python sudo apt-get install python
  3. open your preferred Linux text editor vi myProgram.py
  4. Copy and Paste your code into the editor (leave vi with esc :wq )
  5. Run your code python myProgram.py

To move data from your VM to AzureML please check out the Azure-MachineLearning-ClientLibrary-Python on Github

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM