Feeds:
Posts
Comments

Archive for January, 2013

In the .htaccess file

AddHandler fcgid-script .py

Here is the .py code that will work.

#!/ramdisk/bin/python

wsgi_variables = ( ‘REQUEST_METHOD’,
‘SCRIPT_NAME’,
‘PATH_INFO’,
‘QUERY_STRING’,
‘CONTENT_TYPE’,
‘CONTENT_LENGTH’,
‘SERVER_NAME’,
‘SERVER_PORT’,
‘HTTP_ACCEPT’,
‘HTTP_ACCEPT_ENCODING’,
‘HTTP_ACCEPT_LANGUAGE’,
‘HTTP_CONNECTION’,
‘HTTP_COOKIE’,
‘HTTP_DNT’,
‘HTTP_HOST’,
‘HTTP_USER_AGENT’,
‘wsgi.version’,
‘wsgi.url_scheme’,
‘wsgi.input’,
‘wsgi.errors’,
‘wsgi.multithread’,
‘wsgi.multiprocess’,
‘wsgi.run_once’
)

import sys, os

sys.path.insert( 0, ‘/home5/cvxcloud/local/lib/python2.6/site-packages’)
sys.path.insert( 0, ‘/usr/lib/python2.6/site-packages’)
sys.path.insert( 0, ‘/home5/cvxcloud/local/lib64/python2.6/site-packages’)
sys.path.insert( 0, ‘/home5/cvxcloud/.local/lib/python2.6/site-packages’)

os.environ[‘LD_LIBRARY_PATH’] = ‘/home5/cvxcloud/local/lib:/home5/cvxcloud/.loc\
al/lib’
_PROJECT_DIR = ‘/home5/cvxcloud/django/jan2013’
sys.path.insert(0,_PROJECT_DIR)

_PROJECT_NAME = ‘jan2013’
os.environ[‘DJANGO_SETTINGS_MODULE’] = “%s.settings” % _PROJECT_NAME
# placeholder
def hello(environ, start_response):
start_response( ‘200 OK’, [(‘Content-type’, ‘text/plain’)] )
r = “<html><body>Hello from py</body></html>”
return[r]

if __name__ == ‘__main__’:

environ = dict(os.environ.items())

environ[‘wsgi.version’] = (1,0)
environ[‘wsgi.url_scheme’] = ‘http’
environ[‘wsgi.multithread’] = False
environ[‘wsgi.multiprocess’] = True
environ[‘wsgi.run_once’] = True
environ[‘wsgi.input’] = sys.stdin
environ[‘wsgi.errors’] = sys.stderr

from django.core.wsgi import get_wsgi_application
from flup.server.fcgi_fork import WSGIServer

WSGIServer( hello ).run()

Advertisements

Read Full Post »

This afternoon I started writing a parser for AMPL from example files oil.mod and oil.dat.  Funky features of the specifications include wildcard shorthands like

(X,*) := A B C

which evaluates to (X,A) (X,B) (X,C) and so on for sets.  In any case, there are layers of evaluations before numerical figures for parameters in the actual objective function and constraints can be reached and this evaluation is needed to construct the A and G matrices for cvxopt.

Now I am thinking of looking over my efforts to learn and then implement the parsers using flex and bison for which I found an excellent seeming tutorial.

Read Full Post »

So I have been preparing the Red Hat 4.4.6-4 Operon 1900 MHz machine that runs http://www.cvxcloudopt.com.  Numpy and Scipy python libraries work with linear algebra packages ATLAS or BLAS+LAPACK.  The compilation is not trivial because basic compiler flags like -m64 and -fPIC are not set in the default.  I was going to write steps to these installs but found that Marco Budisic had already done so.

Incidentally, a performance benchmark had shown that numpy performs comparably to C++/BLAS and python/BLAS.

I will proceed after this step to installing cvxopt, scipy, numpy and then prepare to transfer the django application to the server to begin recoding the cloud process management with a web front end.

Read Full Post »