ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/WEBCONDDB/CondWebServer/server.py
(Generate patch)

Comparing COMP/WEBCONDDB/CondWebServer/server.py (file contents):
Revision 1.18 by xiezhen, Thu Dec 11 17:20:38 2008 UTC vs.
Revision 1.29 by xiezhen, Mon Jun 22 17:31:22 2009 UTC

# Line 4 | Line 4 | import cherrypy
4   from optparse import OptionParser
5   import DLFCN
6   sys.setdlopenflags(DLFCN.RTLD_GLOBAL+DLFCN.RTLD_LAZY)
7 < from Applications import iovInspect, iovExport, payload, globaltag,serviceMap
7 > from Applications import iovInspect,iovInspectOld,iovExport,globaltag,serviceMapOld,serviceMap,luminosityApp
8   from Common import config
9 < from pluginCondDBPyInterface import *
10 <
9 > #from pluginCondDBPyInterface import *
10 > os.environ["QUIET_ASSERT"]='yes'
11   class Root(object):
12      @cherrypy.expose
13      def index(self):
# Line 19 | Line 19 | class Server(object):
19      def __init__(self):
20          self.__hostname='localhost'
21          self.__port=6789
22 <        self.__configfile='application.conf'
23 <
22 >        self.__oldappconfigfile='oldapplication.conf'
23 >        self.__appconfigfile='application.conf'
24 >        self.__detconfigfile='detector31x.conf'
25 >        self.__olddetconfigfile='detector.conf'
26      def start (self):
27          """Start server
28          """
# Line 29 | Line 31 | class Server(object):
31                            help="port default 6789")      
32          parser.add_option("--hostname",action="store",dest="hostname",
33                            help="hostname default localhost")      
34 <        parser.add_option("--configfile",action="store",dest="configfile",
35 <                          help="configuration file default application.conf")
34 >        parser.add_option("--configdir",action="store",dest="configdir",
35 >                          help="configuration dir. Default to currentdir/config")
36          (options, args) = parser.parse_args()
37          if options.hostname:
38              self.__hostname=options.hostname.strip(' ')
39          if options.port:
40              self.__port=int(options.port)
41 <        #if options.configfile:
42 <        #    self.__configfile = options.configfile.strip(' ')
43 <        
41 >        if options.configdir:
42 >            self.__configdir = options.configdir.strip(' ')
43 >        else:
44 >            currentdir=os.path.dirname(os.path.abspath(__file__))
45 >            self.__configdir = os.path.join(currentdir,'config')
46          serverconfig={'global':{'server.socket_host':self.__hostname,'server.socket_port':self.__port,'server.environment':'production'}}
47          cherrypy.config.update(serverconfig)
48          cherrypy.tree.mount(Root(),script_name='/')
45        currentdir=os.path.dirname(os.path.abspath(__file__))
46        appconfigfile=os.path.join(currentdir,'config','application.conf')
49  
50          # here for the time being
51          self.__config=config.Config()
52 <        self.__config.from_ini(appconfigfile)
53 <        self.__authpath=self.__config.common.auth_path
54 <        os.environ["CORAL_AUTH_PATH"] = self.__authpath
55 <        print "auth path ", os.environ["CORAL_AUTH_PATH"]
56 <        # this one shall be alive all the time...
57 <        self.__cmsframe = FWIncantation
58 <        
59 <        cherrypy.tree.mount(iovInspect.IOV(appconfigfile),script_name='/iov')
58 <        cherrypy.tree.mount(iovExport.IOV(appconfigfile),script_name='/exportIov')
59 <        detconfigfile=os.path.join(currentdir,'config','detector.conf')
60 <        #print 'detconfigfile',detconfigfile
61 <        cherrypy.tree.mount(serviceMap.serviceMap(detconfigfile),script_name='/serviceMap')
62 <        cherrypy.tree.mount(globaltag.GlobalTag(appconfigfile),script_name='/globaltag')
52 >        self.__config.from_ini(os.path.join(self.__configdir,self.__appconfigfile))
53 >        cherrypy.tree.mount(iovInspect.IOV(os.path.join(self.__configdir,self.__appconfigfile)),script_name='/iov')
54 >        cherrypy.tree.mount(iovInspectOld.IOV(os.path.join(self.__configdir,self.__appconfigfile)),script_name='/oldiov')
55 >        cherrypy.tree.mount(iovExport.IOV(os.path.join(self.__configdir,self.__appconfigfile)),script_name='/exportIov')
56 >        cherrypy.tree.mount(serviceMap.serviceMap(os.path.join(self.__configdir,self.__detconfigfile)),script_name='/serviceMap')
57 >        cherrypy.tree.mount(serviceMap.serviceMap(os.path.join(self.__configdir,self.__olddetconfigfile)),script_name='/oldserviceMap')
58 >        cherrypy.tree.mount(globaltag.GlobalTag(os.path.join(self.__configdir,self.__appconfigfile)),script_name='/globaltag')
59 >        cherrypy.tree.mount(luminosityApp.lumi(os.path.join(self.__configdir,self.__appconfigfile)),script_name='/lumi')
60          cherrypy.server.quickstart()
61          cherrypy.engine.start()
62  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines