-
Notifications
You must be signed in to change notification settings - Fork 1
/
nodeinfo.html
258 lines (254 loc) · 8.96 KB
/
nodeinfo.html
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Nodeinfo</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/themes/vue-tabs.css"
/>
<link
rel="stylesheet"
type="text/css"
href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css"
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css"
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/css/dataTables.bulma.min.css"
/>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-router/dist/vue-router.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue-tabs.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/axios.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue-axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/moment.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/moment-duration-format.min.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/js/dataTables.bulma.min.js"></script>
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/any-number.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/mousetrap.min.js"></script>
<script src="./utils.js"></script>
</head>
<body>
<nav class="navbar is-transparent">
<div class="navbar-brand">
<p class="navbar-item">
<strong class="is-size-3">SLURM web interface</strong>
</p>
<a class="navbar-item " href="./squeue.html">SQUEUE</a>
<a class="navbar-item is-active" href="./nodeinfo.html"><strong>NODEINFO</strong></a>
</div>
</nav>
<div id="app">
<p
v-if="globalinfo"
class="box is-size-4 has-background-light"
id="totals"
>
Nodes states: ALLOCATED:{{ globalinfo["ALLOCATED"] }}   IDLE:{{
globalinfo["IDLE"]
}}
 
<template
v-for="v,k in globalinfo"
v-if="k !== 'ALLOCATED' && k !=='IDLE'"
>
{{ k }}:{{ v }} 
</template>
</p>
<p>
The <strong>LoadPerAlloc</strong> shows CPULoad/CPUAlloc. Ideally, it
should be close to 1.0 on all nodes. (<input
type="checkbox"
v-model="outliersOnly"
/>
Show only outliers where LoadPerAlloc < 0.75 or LoadperAlloc >
1.25)
</p>
<table
id="nodeinfo"
class="table"
cellspacing="0"
width="100%"
v-if="squeue"
></table>
<div class="container" v-else=""><img src="default.gif" /></div>
</div>
<footer class="footer">
<div class="container">
<div class="content has-text-centered">
Credits: Developed by
<a href="mailto:[email protected]">Roy Dragseth</a> using
<a href="https://bottlepy.org">Bottle</a> for the server side and
<a href="https://vuejs.org">Vue</a>,
<a href="https://datatables.net/">Datatables</a>
and <a href="https://craig.is/killing/mice/">Mousetrap</a> for the
client side.<br />
Source and docs:
<a href="https://github.com/dragz/slurmbrowser/">On GitHub.</a>
</div>
</div>
</footer>
<script>
var MIN_LOAD, MAX_LOAD;
const nodeinfoVue = new Vue({
el: "#app",
data: {
nodeinfo: null,
squeue: null,
nodeinfoTable: null,
globalinfo: null,
outliersOnly: false,
max_load: 1.75,
min_load: 0.25
},
methods: {
fetchSqueue() {
return this.axios.get("../data/squeue");
},
fetchNodeinfo() {
return this.axios.get("../data/nodeinfo");
},
updateNodeinfo() {
this.calculateExtraInfo();
this.nodeinfoTable = $("#nodeinfo").DataTable({
data: this.nodeinfo,
columns: [
{ data: "NodeName", title: "NodeName" },
{ data: "CPUTot", title: "CPUTot" },
{ data: "CPUAlloc", title: "CPUAlloc" },
{ data: "CPULoad", title: "CPULoad" },
{
data: "LoadPerAlloc",
title: "LoadPerAlloc",
type: "any-number"
},
{ data: "RealMemory", title: "RealMemory" },
{ data: "AllocMem", title: "AllocMem" },
{ data: "FreeMem", title: "FreeMem" },
{ data: "State", title: "State" },
{ data: "JOBS", title: "JOBS", render: this.render_joblist }
],
order: [[1, "asc"]],
pageLength: 50,
lengthMenu: [[50, 100, -1], [50, 100, "All"]],
stateSave: true
});
},
calculateExtraInfo() {
const jobs = this.squeue.jobinfo;
const hostjobs = {};
for (const j in jobs) {
const job = jobs[j];
const hostlist = expand_nodelist(job["NodeList"]);
for (const h in hostlist) {
const hostname = hostlist[h];
if (!(hostname in hostjobs)) {
hostjobs[hostname] = [];
}
hostjobs[hostname].push({
jobid: job["JobId"],
user: job["UserId"]
});
}
}
const nodestates = {};
for (const n in this.nodeinfo) {
const hostinfo = this.nodeinfo[n];
const cpualloc = hostinfo["CPUAlloc"];
const cpuload = hostinfo["CPULoad"];
let loadperalloc = "";
if (cpualloc >= 1) {
loadperalloc = (cpuload / cpualloc).toFixed(2);
} else {
loadperalloc = "N/A";
}
hostinfo["LoadPerAlloc"] = loadperalloc;
if (hostinfo["NodeName"] in hostjobs) {
hostinfo["JOBS"] = hostjobs[hostinfo["NodeName"]];
} else {
hostinfo["JOBS"] = "";
}
if (!nodestates.hasOwnProperty(hostinfo["State"])) {
nodestates[hostinfo["State"]] = 0;
}
nodestates[hostinfo["State"]]++;
}
this.globalinfo = nodestates;
},
render_joblist(data, type, row) {
const jobdisp = [];
for (const d in data) {
const j = data[d];
jobdisp.push(
"<a href=job.html?jobid=" +
j["jobid"] +
">" +
j["jobid"] +
"</a>:" +
"<a href=jobhist.html?user=" +
j["user"].replace(/\(.*\)/, "") +
">" +
j["user"].replace(/\(.*\)/, "") +
"</a>"
);
}
return jobdisp.join(",");
}
},
mounted() {
this.axios
.all([this.fetchSqueue(), this.fetchNodeinfo()])
.then(
this.axios.spread(
(s, n) => (
(this.squeue = s.data), (this.nodeinfo = n.data.nodeinfo)
)
)
)
.finally(() => this.updateNodeinfo());
window.MAX_LOAD = this.max_load;
window.MIN_LOAD = this.min_load;
},
watch: {
outliersOnly: {
immediate: true,
handler: function(newVal, oldVal) {
if (this.outliersOnly) {
this.min_load = 0.75;
this.max_load = 1.25;
} else {
this.min_load = -1;
this.max_load = 10000.0;
}
window.MAX_LOAD = this.max_load;
window.MIN_LOAD = this.min_load;
this.nodeinfoTable.draw();
}
}
}
});
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex) {
if (window.MIN_LOAD < 0.0) {
return true;
}
if (
parseFloat(data[4]) < window.MIN_LOAD ||
parseFloat(data[4]) > window.MAX_LOAD
) {
return true;
} else {
return false;
}
});
</script>
</body>
</html>