ATLAS Offline Software
Loading...
Searching...
No Matches
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
5import os
6import glob
7import cgitb
8
9# Enable debugging output for CGI
10cgitb.enable()
11
12# Use importlib to import directly from path in cgi-bin?
13import importlib.util
14
15if 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')
17else:
18 spec = importlib.util.spec_from_file_location('LumiCalc', '/var/www/lumicalc/athena/LumiBlock/LumiCalc/python/LumiCalcHtml.py')
19
20lcmod = importlib.util.module_from_spec(spec)
21spec.loader.exec_module(lcmod)
22lc = lcmod.LumiCalc()
23
24lc.workdir = os.getcwd()
25lc.subdir = os.path.basename(os.path.normpath(lc.workdir))
26try:
27 lc.grlfn = os.path.basename(glob.glob(lc.workdir+'/*.xml')[0])
28except Exception:
29 lc.grlfn = ''
30
31lc.f = open(lc.workdir+'/working.html', 'a')
32lc.parseOutput()
33lc.printTable()
34lc.printWarnings()
35lc.printLinks()
36lc.printFinish()
37lc.cleanUp()
38
39# Redirect
40print ('Content-Type: text/html')
41print ()# Blank line, end of headers
42print ('<html><head>')
43print ('<meta http-equiv="Refresh" content="0; url=result.html">')
44print ('</head></html>')