-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstatusPage.py
More file actions
42 lines (35 loc) · 1.63 KB
/
statusPage.py
File metadata and controls
42 lines (35 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import time
def statusPage(ListStatuses,season):
Header=['<!DOCTYPE HTML>\n','<html>\n','<head>','<link rel="stylesheet" type="text/css" href="statusPageCss.css">','<title> Status </title>\n','</head>\n','<body>','<table align="center">','<th bgcolor="#bfbfbf">Step</th>','<th bgcolor = "#bfbfbf">Status</th>']
stepList=['Setup Environment','Initialize Master List','Finalize Master List','Force Photometry','Host Match','Make Truth Tables','Combine Data Files','Make Plots','Make Proto ATC']
Date=time.strftime("%Y-%m-%d-%H-%M")
moreInfo=['<div id="info">','<p>Last Run: '+Date+'</p>','<p><a id="status" href="output'+season+'.txt">Log</a></p>','</div>']
statusPage=open('statusPage'+season+'.html','w+')
for line in Header:
statusPage.write(line)
statusPage.close()
statusPage=open('statusPage'+season+'.html','a')
for x in moreInfo:
statusPage.write(x)
statusPage.close()
ListStatuses=ListStatuses[:-1]
statusPage=open('statusPage'+season+'.html','a')
for i in range(len(ListStatuses)):
status=ListStatuses[i]
step=stepList[i]
if status==True:
stat="Success"
color="#00FF00"
else:
stat="Failed"
color="#FF0000"
data=["<tr>","<th>"+step+"</th>","<td bgcolor="+color+"><font color='#000000'>"+stat+"</font></td>","</tr>"]
for line in data:
statusPage.write(line)
statusPage.close()
closingLines=['</tr>']
statlins=['</body>','</html>']
stausPage=open('statusPage'+season+'.html','a')
for lin in statlins:
stausPage.write(lin)
statusPage.close()