Skip to content

Commit f21f501

Browse files
committed
Added date to logging, made page_down.html
Figured the date and time may come in handy for the logging in queue_mapd.log. Also added the capability to write to a log from the create_memory_html function. Created page_down.html to be set as the index.html for /var/www/html in times when configuring or something breaks.
1 parent e2f9e17 commit f21f501

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

page_down.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
3+
<html>
4+
<head>
5+
<title>CRC Queue Status</title>
6+
<link rel="stylesheet" href="../styles.css">
7+
<META HTTP-EQUIV="refresh" CONTENT="60">
8+
<link rel="shortcut icon" type="image/x-icon" href="../templates/favicon.ico" />
9+
</head>
10+
11+
<body>
12+
<span class=info>The page and or server is currently under maintence. Please check back later!
13+
<br>
14+
If this page remains in this condition for an extended period of time, please contact: ckankel@nd.edu. Thank you.
15+
</span>
16+
17+
18+
</body>
19+
</html>

queue_mapd.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from that information for a 'heat' map of the queue. This partial page is a component to
66
be included from index.php on the current web-server. There are two other components,
77
header.html and footer.html for each: Debug and Long. There is also a pending job file.
8-
Latest update: Sept 23rd, 2016.
8+
Latest update: Sept 30th, 2016.
99
Exit codes: 0 - Good
1010
20 - Bad Pending Job status
1111
21 - Bad memory translate
@@ -528,8 +528,8 @@ def create_memory_html(node_list, header, queue, link_to_others):
528528
mem_table += red_node.format(node.get_name())
529529
num_red += 1
530530
else:
531-
# Need to making logging function not in pending class!!!!
532-
sys.exit(22)
531+
# Halt and catch fire, bad data
532+
write_to_log('create_memory_html', 22, temp_ratio)
533533

534534
mem_table += '\n</td>\n</tr>\n</table>\n'
535535
date = subprocess.getoutput("date")
@@ -591,7 +591,9 @@ def write_to_log(loc_from, code, prob_var):
591591
"""Method which writes to a log named as a global--LOG_NAME. It takes the name of the function as a STRING--loc_from and the
592592
intened exit code as code as an INT, and it takes prob_var as a STRING (for easy printing!)"""
593593

594+
date = subprocess.getoutput("date")
594595
file = open(LOG_NAME, 'a') # Appending the log, to keep a better history of what has happened.
596+
file.write('DATE: {0}\n-----------------------------------\n'.format(date))
595597
file.write('I am {0}, and I had an issue with the var: {1}.\n'.format(loc_from, prob_var))
596598
file.close()
597599
sys.exit(code)

0 commit comments

Comments
 (0)