Search code examples
amplneos-server

BadStatusLine error when running AMPL on NEOS server


I was trying to run AMPL code on NEOS server from local machine through Kestrel as described on AMPL website: run ampl on neos. I used a simple model file with the following options in it:

option solver "/home/arthur/amplide.linux64/kestrel";
option kestrel_options 'solver=loqo';
option loqo_options 'minlocfil sigfig=8 outlev=2';
option neos_server 'www.neos-server.org:3333';

The last line is from tutorial on NEOS website: https://neos-server.org/neos/kestrel.html

I get the following error and no job seems to be queued:

File "/home/arthur/amplide.linux64/kestrel", line 217, in <module>
    kestrel = kestrelAMPL()
File "/home/arthur/amplide.linux64/kestrel", line 19, in __init__
    result = self.neos.ping()
...
File "/usr/lib/python2.7/httplib.py", line 408, in _read_status
    raise BadStatusLine(line)
httplib.BadStatusLine: ''
exit code 1
<BREAK>

If I do it in AMPL IDE instead of terminal, it just hangs.


Solution

  • So I found a simple solution to this.

    If you edit the kestrel file in your AMPL directory (the file that comes from Kestrel archive) in any text editor, you can replace the line

    self.neos = xmlrpclib.ServerProxy("http://%s:%s" % (self.host,self.port))
    

    with

    self.neos = xmlrpclib.ServerProxy("https://%s:%s" % (self.host,self.port) )
    

    After that my jobs got through successfully. It appears that NEOS deprecated http calls in July 2016.

    Alternatively (I have not tried this), instead of using the version of kestrel from AMPL or NEOS websites, you can, perhaps, try the modified package from here: https://github.com/Pyomo/pyomo/blob/master/pyomo/neos/kestrel.py