-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen_jobs.py
131 lines (123 loc) · 3.64 KB
/
gen_jobs.py
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import fileinput, os
# ssh agave 'mq' | tail -n +2 | python jobs.py
OUTFILE = '/home/kiko/public_html/resultsWebsite/jobs.html'
fields = ['jobID','partition','jobName','ST','t','tLim',
'nodes','CPUcores','comment']
N = 0
mydict = dict((field,[]) for field in fields)
for line in fileinput.input():
linelist = [item for item in line.strip('\n').split(' ') if item]
linedict = dict((fields[i],linelist[i]) for i in range(0,len(fields)))
[ mydict[field].append(linedict[field]) for field in fields ]
N += 1
Nrun = mydict['ST'].count('RUNNING')
Npend = mydict['ST'].count('PENDING')
code = """<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/960_24_col.css">
<link rel="stylesheet" href="css/text.css">
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/jobs.css">
<link rel="stylesheet" href="css/monitor.css">
<script src="js/jquery-3.4.1.min.js"></script>
<script src="js/navigation.js"></script>
<meta http-equiv="refresh" content="30">
<title>Agave Jobs Information</title>
</head>
<body>
<div class="wrap container_24">
<header class="clearfix">
<h1 class="grid_14">Scheduled Jobs List</h1>
<nav class="grid_10">
<ul>
<li><a href="https://mathpost.asu.edu/~kiko">Home</a></li>
</ul>
</nav>
</header>
<div class="menu clearfix" id="MegaMenu">
<div class="header">
<h1>Knife Edge Viscosimeter</h1>
</div>
<div class="grid_8 alpha">
<h3>Monitors</h3>
<ul>
<li><a href="monitor_alpha0e0.html">α = 0e0</a></li>
<li><a href="monitor_alpha1e-2.html">α = 1e-2</a></li>
<li><a href="monitor_alpha1e-1.html">α = 1e-1</a></li>
</ul>
</div>
<div class="grid_8">
<h3>Videos</h3>
<ul>
<li><a href="movies_alpha0e0.html">α = 0e0</a></li>
<li><a href="movies_alpha1e-2.html">α = 1e-2</a></li>
<li><a href="movies_alpha1e-1.html">α = 1e-1</a></li>
</ul>
</div>
<div class="grid_8 omega">
<h3>Other</h3>
<ul>
</ul>
</div>
</div>
<div class="main clearfix">
<div class="primary grid_24">
<h3 class="info">Currently Running Jobs: {}</h3>
<h3 class="info">Currently Pending Jobs: {}</h3>
<table>
<tbody>
<tr>
<th>
<h4>Job ID</h4>
</th>
<th>
<h4>Partition</h4>
</th>
<th>
<h4>Job Name</h4>
</th>
<th>
<h4>Status</h4>
</th>
<th>
<h4>Time Used</h4>
</th>
<th>
<h4>Time Limit</h4>
</th>
<th>
<h4>Nodes</h4>
</th>
<th>
<h4>CPU Cores</h4>
</th>
<th>
<h4>Comment</h4>
</th>
</tr>
""".format(Nrun,Npend)
for j in range(0,N):
code +=""" <tr>
"""
for field in fields:
code +=""" <td>
<h5>{}</h5>
</td>
""".format(mydict[field][j])
code +=""" </tr>
"""
code +=""" </tbody>
</table>
</div>
</div>
</div>
</body>
</html>
"""
with open(OUTFILE,"w") as f:
f.write("%s" % code)
f.close()