-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcreateWebPageFunctions.sh
More file actions
executable file
·525 lines (385 loc) · 18.9 KB
/
createWebPageFunctions.sh
File metadata and controls
executable file
·525 lines (385 loc) · 18.9 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
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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
#!/bin/bash
#
# Author: Jochen Thaeder (LBNL) <jochen@thaeder.de>
# Functions produce webpage of data usage
#
###################################################
# -----------------------------------------------------------------------------------------------------------------
function printBegin() {
typeTable=$1
fileName=$2
if [ $# -eq 3 ] ; then
useJS=$3
else
useJS=YES
fi
cat >${fileName} <<EOL
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>RNC Data USAGAE AT NERSC/LBNL</title>
<script src="../jsLibrary/sorttable.js"></script>
<script src="http://code.jquery.com/jquery.min.js"></script>
<script src="../jqTree/tree.jquery.js"></script>
<link rel="stylesheet" href="../jqTree/jqtree.css">
<link rel="stylesheet" href="../style/style.css">
EOL
if [ "${typeTable}" = "embedding" ] ; then
dataFiles="embeddingv1 embeddingv2"
elif [ "${typeTable}" = "alice_user" ] ; then
dataFiles="alice_user"
elif [ "${typeTable}" = "rnc_user" ] ; then
dataFiles="rnc_user"
elif [ "${typeTable}" = "picodsts" ] ; then
dataFiles="picodstsv1 picodstsv2 picodstsv3"
elif [ "${typeTable}" = "pwgstar" ] ; then
dataFiles="pwgstar"
elif [ "${typeTable}" = "overview" ] ; then
dataFiles="alice_user rnc_user pwgstar"
dataFiles="${dataFiles} embeddingv1 embeddingv2"
dataFiles="${dataFiles} picodstsv1 picodstsv2 picodstsv3"
elif [ "${typeTable}" = "overview_input" ] ; then
dataFiles="project_alice project_star project_starprod projecta_starprod"
dataFiles="${dataFiles} project projecta"
fi
if [ "${useJS}" = "YES" ] ; then
for dataFile in ${dataFiles} ; do
addScript ${dataFile} ${fileName};
done
echo ' <script src="../jsLibrary/functions_'${typeTable}'.js"></script>' >> ${fileName}
fi
cat >>${fileName} <<EOL
</head>
<body>
<table width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="menuTD"><a href="../overview/index.html">Overview</a></td>
<td class="menuTD"><a href="../embedding/index.html">STAR embedding</a></td>
<td class="menuTD"><a href="../userRNC/index.html">RNC users</a></td>
<td class="menuTD"><a href="../pwgSTAR/index.html">STAR PWGs</a></td>
<td class="menuTD"><a href="../picoDstSTAR/index.html">STAR picoDSTs</a></td>
</tr>
<tr>
<td class="menuTD"><a href="../overview/indexExt.html">Overview Input</a></td>
<td class="menuTD"><a href="../embedding/indexExt.html">STAR embedding extended</a></td>
<td class="menuTD"><a href="../userALICE/index.html">ALICE users</a></td>
<td class="menuTD"> </td>
<td class="menuTD"><a href="../picoDstSTAR/indexExt.html">STAR picoDSTs extended</a></td>
</tr>
</table>
<br/>
<div style="width:100%;height: 5px; border-bottom:solid gray 2px;"> </div>
EOL
}
# -----------------------------------------------------------------------------------------------------------------
function addScript () {
dataFile=$1
fileName=$2
echo ' <script src="../data/outfile_'${dataFile}.js'"></script>' >> ${fileName}
}
# -----------------------------------------------------------------------------------------------------------------
function printBarSize() {
fileName=$1
total=$2
totalTB=$3
used=$4
usedTB=$5
title="$6"
percent=$(echo "scale=4; ${used}/${total}*100" | bc -l)
let percentINT=100*used/total
if [ $percentINT -ge 90 ] ; then
barColor=Red
elif [ $percentINT -ge 80 ] ; then
barColor=Orange
else
barColor=""
fi
echo ' <h4>'${title} - size'</h4>' >> ${fileName}
echo ' <div class="bar"><div class="value'${barColor}'" style="width:'${percent%00}'%;"> '${usedTB}'/'${totalTB}' TB ('${percent%00}'%)</div></div>' >> ${fileName}
}
# -----------------------------------------------------------------------------------------------------------------
function printBarInode() {
fileName=$1
total=$2
used=$3
title="$4"
percent=$(echo "scale=4; ${used}/${total}*100" | bc -l)
let percentINT=100*used/total
if [ $percentINT -ge 90 ] ; then
barColor=Red
elif [ $percentINT -ge 80 ] ; then
barColor=Orange
else
barColor=""
fi
echo ' <h4>'${title}' - inodes</h4>' >> ${fileName}
echo ' <div class="bar"><div class="value'${barColor}'" style="width:'${percent%00}'%;"> '${used}'/'${total}' ('${percent%00}'%)</div></div>' >> ${fileName}
}
# -----------------------------------------------------------------------------------------------------------------
function printBarProjectQuota() {
fileName=$1
disk=$2
title="$2"
if [[ $# -eq 3 && "$3" == "a" ]] ; then
script="/usr/common/usg/bin/prjaquota"
else
script="/usr/common/usg/bin/prjquota"
fi
total=`$script $disk | tail -n 1 | awk -F' ' '{ print $3 }'`
totalTB=$(echo "scale=3; ${total}/1024" | bc -l)
used=`$script $disk | tail -n 1 | awk -F' ' '{ print $2 }'`
usedTB=$(echo "scale=3; ${used}/1024" | bc -l)
printBarSize $fileName $total $totalTB $used $usedTB "$disk"
total=`$script $disk | tail -n 1 | awk -F' ' '{ print $6 }'`
totalTB=$(echo "scale=3; ${total}/1024" | bc -l)
used=`$script $disk | tail -n 1 | awk -F' ' '{ print $5 }'`
usedTB=$(echo "scale=3; ${used}/1024" | bc -l)
printBarInode $fileName $total $used "$disk"
}
# -----------------------------------------------------------------------------------------------------------------
function printLine() {
fileName=$1
echo '<div style="width:85%;height: 25px; border-bottom:solid gray 2px;"> </div>' >> ${fileName}
}
# -----------------------------------------------------------------------------------------------------------------
function printEnd() {
fileName=$1
echo ' <div style="width:100%;height: 25px; border-bottom:solid gray 2px;"> </div>' >> ${fileName}
echo ' <h3>Last Updated (PROJECT): '${modDatePROJECT}'</h3>' >> ${fileName}
echo ' <h3>Last Updated (PROJECTA): '${modDatePROJECTA}'</h3>' >> ${fileName}
echo ' </body>' >> ${fileName}
echo '</html>' >> ${fileName}
}
# -----------------------------------------------------------------------------------------------------------------
function printTable() {
if [ $# -eq 2 ] ; then
typeTable=$1
version=""
fileName=$2
else
typeTable=$1
version=$2
fileName=$3
fi
tableName=output/outfile_Table_${typeTable}${version}
# -- HEAD -------------------------------------------------------
echo '<table class="sortable" cellspacing="0" cellpadding="2"><thead>' >> ${fileName}
if [[ "${typeTable}" = "alice_user" || "${typeTable}" = "rnc_user" ]] ; then
echo '<tr><th class="user">User</th>' >> ${fileName}
elif [ "${typeTable}" = "embedding" ] ; then
echo '<tr><th class="user">TrgSetupName</th>' >> ${fileName}
if [ "${version}" = "v2" ] ; then
tableName=output/outfile_Table_Ext_${typeTable}v1
echo '<th class="user">Production</th>' >> ${fileName}
echo '<th class="user">File Set</th>' >> ${fileName}
fi
elif [ "${typeTable}" = "picodsts" ] ; then
echo '<tr><th class="user">PicoDsts</th>' >> ${fileName}
if [ "${version}" = "v3" ] ; then
echo '<th class="storage">Storage</th>' >> ${fileName}
fi
elif [ "${typeTable}" = "pwgstar" ] ; then
echo '<tr><th class="user">PWG</th>' >> ${fileName}
fi
echo '<th class="size">Size (GB)</th><th class="nFiles">N Files</th><th class="time">Created</th><th class="time">Last Mod.</th><th class="time">Last Access</th></tr>' >> ${fileName}
echo '</thead>' >> ${fileName}
# -- BODY -------------------------------------------------------
echo '<tbody>' >> ${fileName}
cat ${tableName}.txt >> ${fileName}
echo '</tbody>' >> ${fileName}
# -- FOOT -------------------------------------------------------
echo '<tfoot>' >> ${fileName}
cat ${tableName}_Sum.txt >> ${fileName}
echo '</tfoot></table>' >> ${fileName}
}
# -----------------------------------------------------------------------------------------------------------------
function printUserRNC() {
typeTable=rnc_user
fileName=www/${1}/index.html
printBegin ${typeTable} ${fileName}
echo ' <table width="100%" cellspacing="0" cellpadding="10"><tr>' >> ${fileName}
echo ' <td class="halfColumn" style="width: 60%">' >> ${fileName}
echo ' <h3><span style="font-style:italic">RNC users</span> summary table at NERSC</h3>' >> ${fileName}
printTable ${typeTable} ${fileName}
echo ' </td><td class="halfColumn" style="width: 40%">' >> ${fileName}
echo ' <h3><span style="font-style:italic">RNC users</span> at NERSC</h3>' >> ${fileName}
echo ' <h4>user</h4>' >> ${fileName}
echo ' <div id="rncUser"></div>' >> ${fileName}
printLine ${fileName}
echo ' </td></tr></table>' >> ${fileName}
printEnd ${fileName}
}
# -----------------------------------------------------------------------------------------------------------------
function printUserALICE() {
typeTable=alice_user
fileName=www/${1}/index.html
printBegin ${typeTable} ${fileName}
echo ' <table width="100%" cellspacing="0" cellpadding="10"><tr>' >> ${fileName}
echo ' <td class="halfColumn" style="width: 60%">' >> ${fileName}
echo ' <h3><span style="font-style:italic">ALICE users</span> summary table at NERSC</h3>' >> ${fileName}
printTable ${typeTable} ${fileName}
echo ' </td><td class="halfColumn" style="width: 40%"> ' >> ${fileName}
echo ' <h3><span style="font-style:italic">ALICE users</span> at NERSC</h3> ' >> ${fileName}
echo ' <h4>user</h4>' >> ${fileName}
echo ' <div id="aliceUser"></div>' >> ${fileName}
printLine ${fileName}
echo ' </td></tr></table>' >> ${fileName}
printEnd ${fileName}
}
# -----------------------------------------------------------------------------------------------------------------
function printEmbedding() {
typeTable=embedding
version=v1
fileName=www/${1}/index.html
printBegin ${typeTable} ${fileName}
echo ' <table width="100%" cellspacing="0" cellpadding="10"><tr>' >> ${fileName}
echo ' <td class="halfColumn" style="width: 60%">' >> ${fileName}
echo ' <h3><span style="font-style:italic">STAR embedding</span> summary table at NERSC</h3>' >> ${fileName}
printTable ${typeTable} ${version} ${fileName}
echo ' </td><td class="halfColumn" style="width: 40%">' >> ${fileName}
echo ' <h3><span style="font-style:italic">STAR Embedding</span> at NERSC</h3>' >> ${fileName}
echo ' <h4>trgSetupName > merged fileSet > production</h4>' >> ${fileName}
echo ' <div id="embeddingv1"></div>' >> ${fileName}
echo ' <div style="width:85%;height: 25px; border-bottom:solid gray 2px;"> </div>' >> ${fileName}
echo ' <h4>trgSetupName > fileSet > production</h4>' >> ${fileName}
echo ' <div id="embeddingv2"></div>' >> ${fileName}
echo ' <div style="width:85%;height: 25px; border-bottom:solid gray 2px;"> </div>' >> ${fileName}
echo ' </td></tr></table>' >> ${fileName}
printEnd ${fileName}
# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
version=v2
fileName=www/${1}/indexExt.html
printBegin ${typeTable} ${fileName} NONE
echo ' <table width="100%" cellspacing="0" cellpadding="10"><tr>' >> ${fileName}
echo ' <td class="halfColumn" style="width: 90%">' >> ${fileName}
echo ' <h3><span style="font-style:italic">STAR embedding</span> summary table at NERSC</h3>' >> ${fileName}
printTable ${typeTable} ${version} ${fileName}
echo ' </td><td class="halfColumn" style="width:10%"> </td></tr></table>' >> ${fileName}
printEnd ${fileName}
}
# -----------------------------------------------------------------------------------------------------------------
function printPicoDSTs() {
typeTable=picodsts
version=v1
fileName=www/${1}/index.html
printBegin ${typeTable} ${fileName}
echo ' <table width="100%" cellspacing="0" cellpadding="10"><tr>' >> ${fileName}
echo ' <td class="halfColumn" style="width: 60%">' >> ${fileName}
echo ' <h3><span style="font-style:italic">STAR picoDSTs</span> summary table at NERSC</h3>' >> ${fileName}
printTable ${typeTable} ${version} ${fileName}
echo ' </td><td class="halfColumn" style="width: 40%">' >> ${fileName}
echo ' <h3><span style="font-style:italic">STAR picoDsts</span> at NERSC</h3>' >> ${fileName}
echo ' <h4>picoDsts (merged storage)</h4>' >> ${fileName}
echo ' <div id="picoDstsv1"></div>' >> ${fileName}
echo ' <h4>picoDsts > storage</h4>' >> ${fileName}
echo ' <div id="picoDstsv2"></div>' >> ${fileName}
echo ' <h4>storage > picoDsts</h4>' >> ${fileName}
echo ' <div id="picoDstsv3"></div>' >> ${fileName}
echo ' </td></tr></table>' >> ${fileName}
printEnd ${fileName}
# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
version=v3
fileName=www/${1}/indexExt.html
printBegin ${typeTable} ${fileName} NONE
echo ' <table width="100%" cellspacing="0" cellpadding="10"><tr>' >> ${fileName}
echo ' <td class="halfColumn" style="width: 90%">' >> ${fileName}
echo ' <h3><span style="font-style:italic">STAR PicoDsts</span> summary table at NERSC</h3>' >> ${fileName}
printTable ${typeTable} ${version} ${fileName}
echo ' </td><td class="halfColumn" style="width:10%"> </td></tr></table>' >> ${fileName}
printEnd ${fileName}
}
# -----------------------------------------------------------------------------------------------------------------
function printPwgSTAR() {
typeTable=pwgstar
fileName=www/${1}/index.html
printBegin ${typeTable} ${fileName}
echo ' <table width="100%" cellspacing="0" cellpadding="10"><tr>' >> ${fileName}
echo ' <td class="halfColumn" style="width: 60%">' >> ${fileName}
echo ' <h3><span style="font-style:italic">STAR PWG directories</span> summary table at NERSC</h3>' >> ${fileName}
printTable ${typeTable} ${fileName}
echo ' </td><td class="halfColumn" style="width: 40%">' >> ${fileName}
echo ' <h3><span style="font-style:italic">STAR PWG directories</span> at NERSC</h3>' >> ${fileName}
echo ' <h4>PWGs</h4>' >> ${fileName}
echo ' <div id="pwgSTAR"></div>' >> ${fileName}
printLine ${fileName}
echo ' </td></tr></table>' >> ${fileName}
printEnd ${fileName}
}
# -----------------------------------------------------------------------------------------------------------------
function printOverview() {
typeTable=overview
fileName=www/${1}/index.html
printBegin ${typeTable} ${fileName}
cat >>${fileName} <<EOL
<table width="100%" cellspacing="0" cellpadding="2"><tr>
<td class="column"> <!-- ------------------------------------------------------------------------ -->
<h3><span style="font-style:italic">STAR Embedding</span> at NERSC</h3>
<h4>trgSetupName > merged fileSet > production</h4>
<div id="embeddingv1"></div>
<h4>trgSetupName > fileSet > production</h4>
<div id="embeddingv2"></div>
<div style="width:85%;height: 25px; border-bottom:solid gray 2px;"> </div>
</td><td class="column"> <!-- ------------------------------------------------------------------------ -->
<h3><span style="font-style:italic">RNC users</span> at NERSC</h3>
<h4>user</h4>
<div id="rncUser"></div>
<div style="width:85%;height: 25px; border-bottom:solid gray 2px;"> </div>
<h3><span style="font-style:italic">ALICE users</span> at NERSC</h3>
<h4>user</h4>
<div id="aliceUser"></div>
<div style="width:85%;height: 25px; border-bottom:solid gray 2px;"> </div>
</td><td class="column"> <!-- ------------------------------------------------------------------------ -->
<h3><span style="font-style:italic">STAR picoDsts</span> at NERSC</h3>
<h4>picoDsts (merged storage)</h4>
<div id="picoDstsv1"></div>
<h4>picoDsts > storage</h4>
<div id="picoDstsv2"></div>
<h4>storage > picoDsts</h4>
<div id="picoDstsv3"></div>
<div style="width:85%;height: 25px; border-bottom:solid gray 2px;"> </div>
<h3><span style="font-style:italic">STAR PWG directories</span> tree at NERSC</h3>
<h4>PWGs</h4>
<div id="pwgSTAR"></div>
<div style="width:85%;height: 25px; border-bottom:solid gray 2px;"> </div>
</td></tr></table>
EOL
printEnd ${fileName}
# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
typeTable=overview_input
fileName=www/${1}/indexExt.html
printBegin ${typeTable} ${fileName}
cat >>${fileName} <<EOL
<table width="100%" cellspacing="0" cellpadding="2"><tr>
<td class="column"> <!-- ------------------------------------------------------------------------ -->
<h3>Input trees: <span style="font-style:italic">STAR</span> of <span style="font-style:italic">PROJECT</span></h3>
<div id="project_star"></div>
<h3>Input trees: <span style="font-style:italic">STARPROD</span> of <span style="font-style:italic">PROJECT</span></h3>
<div id="project_starprod"></div>
<h3>Input trees: <span style="font-style:italic">ALICE</span> of <span style="font-style:italic">PROJECT</span></h3>
<div id="project_alice"></div>
<div style="width:85%;height: 25px; border-bottom:solid gray 2px;"> </div>
<h3>Input trees: <span style="font-style:italic">STARPROD</span> of <span style="font-style:italic">PROJECTA</span></h3>
<div id="projecta_starprod"></div>
</td><td class="column"> <!-- ------------------------------------------------------------------------ -->
<h3>Storage: <span style="font-style:italic">PROJECT</span></h3>
<div id="project"></div>
<div style="width:85%;height: 25px; border-bottom:solid gray 2px;"> </div>
<h3>Storage: <span style="font-style:italic">PROJECTA</span></h3>
<div id="projecta"></div>
</td><td class="column"> <!-- ------------------------------------------------------------------------ -->
EOL
echo ' <h3>FillStatus (Quota): <span style="font-style:italic">PROJECT</span> ('$now')</h3>' >> ${fileName}
printBarProjectQuota ${fileName} star
printLine ${fileName}
printBarProjectQuota ${fileName} starprod
printLine ${fileName}
printBarProjectQuota ${fileName} alice
printLine ${fileName}
echo ' <h3>FillStatus (Quota): <span style="font-style:italic">PROJECTA</span> ('$now')</h3>' >> ${fileName}
printBarProjectQuota ${fileName} starprod a
cat >>${fileName} <<EOL
</td></tr></table>
EOL
printEnd ${fileName}
}