ATLAS Offline Software
LumiCalcRecover.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4 
5 import os
6 import glob
7 import cgitb
8 
9 # Enable debugging output for CGI
10 cgitb.enable()
11 
12 # Use importlib to import directly from path in cgi-bin?
13 import importlib.util
14 
15 if os.environ.get('SERVER_NAME', '') == 'atlas-lumicalc-dev.cern.ch':
16  spec = importlib.util.spec_from_file_location('LumiCalc', '/var/www/lumicalc_dev/athena/LumiBlock/LumiCalc/python/LumiCalcHtml.py')
17 else:
18  spec = importlib.util.spec_from_file_location('LumiCalc', '/var/www/lumicalc/athena/LumiBlock/LumiCalc/python/LumiCalcHtml.py')
19 
20 lcmod = importlib.util.module_from_spec(spec)
21 spec.loader.exec_module(lcmod)
22 lc = lcmod.LumiCalc()
23 
24 lc.workdir = os.getcwd()
25 lc.subdir = os.path.basename(os.path.normpath(lc.workdir))
26 try:
27  lc.grlfn = os.path.basename(glob.glob(lc.workdir+'/*.xml')[0])
28 except Exception:
29  lc.grlfn = ''
30 
31 lc.f = open(lc.workdir+'/working.html', 'a')
32 lc.parseOutput()
33 lc.printTable()
34 lc.printWarnings()
35 lc.printLinks()
36 lc.printFinish()
37 lc.cleanUp()
38 
39 # Redirect
40 print ('Content-Type: text/html')
41 print ()# Blank line, end of headers
42 print ('<html><head>')
43 print ('<meta http-equiv="Refresh" content="0; url=result.html">')
44 print ('</head></html>')
Trk::open
@ open
Definition: BinningType.h:40