ATLAS Offline Software
Loading...
Searching...
No Matches
index.py
Go to the documentation of this file.
1# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
2
3"""
4ATLAS Beam Spot web page. This is the root page that sets up the tree of beam spot
5web pages. This is intended to be run by CherryPy through Apache's mod_python, but
6you can test it locally using `python index.py`.
7
8Sample Apache configuration:
9
10<Location "/">
11 PythonPath "sys.path+['/home/jb/atl/InDetBeamSpotExample/www']"
12 SetHandler python-program
13 PythonHandler cherrypy._cpmodpy::handler
14 PythonOption cherrypy.setup index::setup_server
15 PythonDebug On
16</Location>
17"""
18
19__author__ = 'Juerg Beringer'
20__version__ = 'index.py atlas/athena'
21
22import os
23import cherrypy
24
25from BeamSpotWebPage import BeamSpotWebPage, DummyPage
26from BeamSpotSummary import BeamSpotSummary
27from JobBrowser import JobBrowser
28from JobDetails import JobDetails
29from FileBrowser import FileBrowser
30from PlotServer import PlotServer
31from MyPlots import MyPlots
32from WebPlots import WebPlots
33from DebugPage import DebugPage
34
35
36# Application configuration
37currentDir = os.path.dirname(os.path.abspath(__file__))
38beamSpotConfig = {
39 '/': { 'tools.staticdir.root': currentDir},
40 '/css': { 'tools.staticdir.on': True,
41 'tools.staticdir.dir': 'css'},
42 '/js': { 'tools.staticdir.on': True,
43 'tools.staticdir.dir': 'js'},
44 '/images': { 'tools.staticdir.on': True,
45 'tools.staticdir.dir': 'images'},
46 '/tmp': { 'tools.staticdir.on': True,
47 'tools.staticdir.dir': 'tmp'}
48}
49
50
51# Root page configuration
53root.globalConfig.baseUrl = '/webapp'
54
55root.globalConfig['jobDir'] = os.environ.get('JOBDIR', '/afs/cern.ch/user/a/atlidbs/jobs')
56root.globalConfig['taskDb'] = os.environ.get('TASKDB', 'auth_file:/afs/cern.ch/user/a/atlidbs/private/beamspotdbinfo_r.dat')
57root.globalConfig['wwwDir'] = os.environ.get('WWWDIR', '/var/vhost/atlas-beamspot/secure/InDetBeamSpotExample/www')
58root.globalConfig['ntDir'] = os.environ.get('NTDIR', '/afs/cern.ch/user/a/atlidbs/nt')
59root.globalConfig['periodDir'] = os.environ.get('PERIODDIR','/afs/cern.ch/user/a/atlidbs/nt/DataPeriods')
60root.globalConfig['webPlotDir'] = os.environ.get('WEBPLOTDIR', '/afs/cern.ch/user/a/atlidbs/nt/webplots')
61
62# Local for testing
63#root.globalConfig['jobDir'] = os.environ.get('JOBDIR', '/data/atlas/jobs/atlidbs')
64#root.globalConfig['taskDb'] = os.environ.get('TASKDB', 'sqlite_file:'+root.globalConfig['jobDir']+'/taskdata.db')
65#root.globalConfig['wwwDir'] = os.environ.get('WWWDIR', '/home/jb/ATLAS/BeamSpot/InDetBeamSpotExample/www')
66#root.globalConfig['ntDir'] = os.environ.get('NTDIR', '/data/atlas/analysis/BeamSpot/nt')
67#root.globalConfig['periodDir'] = os.environ.get('PERIODDIR','/home/jb/analysis/BeamSpot/nt/DataPeriods')
68#root.globalConfig['webPlotDir'] = os.environ.get('WEBPLOTDIR', '/data/atlas/analysis/BeamSpot/nt/webplots')
69
70# Page tree
71root.addPage('summary', BeamSpotSummary())
72root.addPage('t0Summary', BeamSpotSummary(), query='?type=DB_BEAMSPOT')
73root.addPage('bcidSummary', BeamSpotSummary(), query='?type=BCID&limit=0')
74root.addPage('reprocSummary', BeamSpotSummary(), query='?type=REPR&limit=0')
75root.addPage('jobs', JobBrowser())
76root.addPage('details', JobDetails())
77root.addPage('files', FileBrowser('/jobfiles'))
78root.addPage('myplots', MyPlots())
79root.addPage('plots', PlotServer())
80root.addPage('webplots',WebPlots())
81root.addPage('debug', DebugPage())
82
83
84# Setup for mod_python
86 cherrypy.config.update({'environment': 'production',
87 'log.screen': False,
88 'server.socket_host': '127.0.0.1',
89 'log.error_file': '/tmp/site.log',
90 'show_tracebacks': False})
91 cherrypy.tree.mount(root, root.globalConfig.baseUrl, config=beamSpotConfig)
92
93
94# Code to test or run locally
95if __name__ == '__main__':
96
97 # For plain CGI
98 #import cgi
99 #import cgitb; cgitb.enable()
100 #p = Root(pageTitle = 'HelloWorld Test', contentType='Content-type: text/html\n\n')
101 #print p.index()
102
103 # For local CherryPy (run as `python index.py')
104 # NOTE: see http://www.cherrypy.org/wiki/StaticContent on how to
105 # serve static content such as the css file
106 import cherrypy
107 cherrypy.quickstart(root, root.globalConfig.baseUrl, config=beamSpotConfig)
setup_server()
Definition index.py:85