@@ -9,7 +9,14 @@ const timeFormat = d3.timeFormat('%Y-%m-%dT%H:%M:%S-05:00');
9
9
let Layout = {
10
10
data : { } ,
11
11
}
12
-
12
+ const NODE_RANGES = [
13
+ '10.101.91.[1-20]' ,
14
+ '10.101.92.[1-20]' ,
15
+ '10.101.94.[1-20]' ,
16
+ '10.101.95.[1-10]' ,
17
+ '10.101.96.[1-20]' ,
18
+ '10.101.97.[1-20]' ,
19
+ ] ;
13
20
let serviceSelected = 0 ;
14
21
15
22
// let request = new Simulation('../HiperView/data/742020.json');
@@ -157,7 +164,8 @@ if (mode === 'realTime') {
157
164
d3 . select ( '#processBtn' ) . style ( 'display' , 'none' ) ;
158
165
159
166
// Bind action to process button
160
- d3 . select ( '#processBtn' ) . on ( 'click' , loadHistoricalData ) ;
167
+ // d3.select('#processBtn').on('click', loadHistoricalData);
168
+ d3 . select ( '#processBtn' ) . on ( 'click' , loadHistoricalAcrossRanges ) ;
161
169
162
170
// Handle time range changes
163
171
d3 . select ( '#realTimeRange' )
@@ -227,6 +235,58 @@ function buildRealTimeParams(rangeValue, intervalValue) {
227
235
compression : false
228
236
} ;
229
237
}
238
+ function combineResults ( resultsArray ) {
239
+ const combined = {
240
+ time_stamp : [ ] ,
241
+ nodes_info : { } ,
242
+ jobs_info : { }
243
+ } ;
244
+ console . log ( 'Combining results:' , resultsArray . length , 'results' ) ;
245
+ console . log ( resultsArray ) ;
246
+
247
+ for ( const result of resultsArray ) {
248
+ // Merge time stamps
249
+ combined . time_stamp . push ( ...( result . time_stamp ?? [ ] ) ) ;
250
+
251
+ // Merge nodes_info
252
+ for ( const [ node , info ] of Object . entries ( result . nodes_info ) ) {
253
+ if ( ! combined . nodes_info [ node ] ) {
254
+ combined . nodes_info [ node ] = info ;
255
+ }
256
+ }
257
+
258
+ // Merge jobs_info
259
+ for ( const [ jid , job ] of Object . entries ( result . jobs_info ) ) {
260
+ if ( ! combined . jobs_info [ jid ] ) {
261
+ combined . jobs_info [ jid ] = job ;
262
+ }
263
+ }
264
+ }
265
+
266
+ // Remove duplicate time_stamps and sort
267
+ combined . time_stamp = Array . from ( new Set ( combined . time_stamp ) ) . sort ( ( a , b ) => a - b ) ;
268
+
269
+ return combined ;
270
+ }
271
+
272
+ async function fetchAllNodeRanges ( startStr , endStr , isRealTime = false ) {
273
+ const allResults = [ ] ;
274
+
275
+ for ( const range of NODE_RANGES ) {
276
+ // const nodes = expandBrackets(range);
277
+ const params = {
278
+ ...( isRealTime
279
+ ? buildRealTimeParams ( Date . now ( ) - 1 * 60 * 60 * 1000 , Date . now ( ) ) // if needed
280
+ : buildHistoricalParams ( startStr , endStr ) ) ,
281
+ nodelist : range ,
282
+ } ;
283
+
284
+ const result = await fetchDataAndProcess ( params , true ) ;
285
+ allResults . push ( result ) ;
286
+ }
287
+
288
+ return combineResults ( allResults ) ;
289
+ }
230
290
231
291
function buildHistoricalParams ( startStr , endStr ) {
232
292
const parse = d3 . timeParse ( '%Y-%m-%dT%H:%M' ) ;
@@ -244,19 +304,24 @@ function buildHistoricalParams(startStr, endStr) {
244
304
end : format ( end ) ,
245
305
interval : interval ,
246
306
aggregation : "max" ,
247
- nodelist : "10.101.93 .[1-8 ]" ,
307
+ nodelist : "10.101.91 .[1-20 ]" ,
248
308
metrics : [
249
- "GPU_Usage" , "GPU_PowerConsumption" , "GPU_MemoryUsage" , "GPU_Temperature" ,
250
- "CPU_Usage" , "CPU_PowerConsumption" , "CPU_Temperature" ,
251
- "DRAM_Usage" , "DRAM_PowerConsumption" ,
252
- "System_PowerConsumption" , "Jobs_Info" , "NodeJobs_Correlation" , "Nodes_State"
309
+ "CPU_Usage" ,
310
+ "CPU_PowerConsumption" ,
311
+ "CPU_Temperature" ,
312
+ "DRAM_Usage" ,
313
+ "DRAM_PowerConsumption" ,
314
+ "System_PowerConsumption" ,
315
+ "Jobs_Info" ,
316
+ "NodeJobs_Correlation" ,
317
+ "Nodes_State"
253
318
] ,
254
319
compression : false
255
320
} ;
256
321
}
257
322
258
323
function fetchDataAndProcess_old ( Params ) {
259
- return fetch ( 'http://narumuu.ttu.edu/api/h100 /' , {
324
+ return fetch ( 'http://narumuu.ttu.edu/api/zen4 /' , {
260
325
method : 'POST' ,
261
326
headers : { 'Content-Type' : 'application/json' } ,
262
327
body : JSON . stringify ( Params )
@@ -418,7 +483,7 @@ async function fetchDataAndProcess(Params, isRealTime = true) {
418
483
419
484
if ( isRealTime ) {
420
485
// Real-time: Fetch from API
421
- apiData = await fetch ( 'http://narumuu.ttu.edu/api/h100 /' , {
486
+ apiData = await fetch ( 'http://narumuu.ttu.edu/api/zen4 /' , {
422
487
method : 'POST' ,
423
488
headers : { 'Content-Type' : 'application/json' } ,
424
489
body : JSON . stringify ( Params )
@@ -445,10 +510,11 @@ async function fetchDataAndProcess(Params, isRealTime = true) {
445
510
cpus : Array ( len ) . fill ( ) . map ( ( ) => [ ] ) ,
446
511
job_id : Array ( len ) . fill ( ) . map ( ( ) => [ ] ) ,
447
512
system_power : Array ( len ) . fill ( ) . map ( ( ) => [ ] ) ,
448
- gpu_power : Array ( len ) . fill ( ) . map ( ( ) => [ ] ) ,
513
+ // gpu_power: Array(len).fill().map(() => []),
449
514
cpu_power : Array ( len ) . fill ( ) . map ( ( ) => [ ] ) ,
450
- gpu_mem : Array ( len ) . fill ( ) . map ( ( ) => [ ] ) ,
451
- gpu_usage : Array ( len ) . fill ( ) . map ( ( ) => [ ] ) ,
515
+ // gpu_mem: Array(len).fill().map(() => []),
516
+ // gpu_usage: Array(len).fill().map(() => []),
517
+ temperature : Array ( len ) . fill ( ) . map ( ( ) => [ ] ) ,
452
518
cpu_usage : Array ( len ) . fill ( ) . map ( ( ) => [ ] ) ,
453
519
dram_usage : Array ( len ) . fill ( ) . map ( ( ) => [ ] ) ,
454
520
dram_power : Array ( len ) . fill ( ) . map ( ( ) => [ ] ) ,
@@ -460,10 +526,11 @@ async function fetchDataAndProcess(Params, isRealTime = true) {
460
526
nodes_info [ node ] . cpus [ idx ] = entry . cores ?? [ ] ;
461
527
nodes_info [ node ] . job_id [ idx ] = entry . jobs ?? [ ] ;
462
528
nodes_info [ node ] . system_power [ idx ] = entry . system_power_consumption ?? [ ] ;
463
- nodes_info [ node ] . gpu_power [ idx ] = ( entry . gpu_power_consumption ?? [ ] ) . map ( v => v / 1000 ) ;
529
+ // nodes_info[node].gpu_power[idx] = (entry.gpu_power_consumption ?? []).map(v => v / 1000);
464
530
nodes_info [ node ] . cpu_power [ idx ] = entry . cpu_power_consumption ?? [ ] ;
465
- nodes_info [ node ] . gpu_mem [ idx ] = entry . gpu_memory_usage ?? [ ] ;
466
- nodes_info [ node ] . gpu_usage [ idx ] = entry . gpu_usage ?? [ ] ;
531
+ // nodes_info[node].gpu_mem[idx] = entry.gpu_memory_usage ?? [];
532
+ // nodes_info[node].gpu_usage[idx] = entry.gpu_usage ?? [];
533
+ nodes_info [ node ] . temperature [ idx ] = entry . temperature ?? [ ] ;
467
534
nodes_info [ node ] . cpu_usage [ idx ] = entry . cpu_usage ?? [ ] ;
468
535
nodes_info [ node ] . dram_usage [ idx ] = entry . dram_usage ?? [ ] ;
469
536
nodes_info [ node ] . dram_power [ idx ] = ( entry . dram_power_consumption ?? [ ] ) . map ( v => v / 1000 ) ;
@@ -593,6 +660,20 @@ function startRealTimePolling(isRealTime = true) {
593
660
initTimeElement ( ) ;
594
661
realTimeIntervalId = setInterval ( fetchAndUpdate , intervalMs ) ;
595
662
}
663
+
664
+ async function loadHistoricalAcrossRanges ( ) {
665
+ const start = document . getElementById ( 'startTime' ) ?. value ;
666
+ const end = document . getElementById ( 'endTime' ) ?. value ;
667
+ if ( ! start || ! end ) {
668
+ console . warn ( 'Start or End time is missing.' ) ;
669
+ return ;
670
+ }
671
+
672
+ const data = await fetchAllNodeRanges ( start , end ) ;
673
+ request = new Simulation ( Promise . resolve ( data ) ) ; // you might need to adapt Simulation constructor
674
+ initdraw ( ) ;
675
+ initTimeElement ( ) ;
676
+ }
596
677
function loadHistoricalData ( ) {
597
678
if ( realTimeIntervalId ) clearInterval ( realTimeIntervalId ) ;
598
679
@@ -662,9 +743,12 @@ $(document).ready(function () {
662
743
serviceSelected = + command . service ;
663
744
if ( command . metric !== undefined && _ . isNumber ( + command . metric ) )
664
745
serviceSelected = + command . metric ;
746
+ // serviceListattr = [
747
+ // "system_power", "gpu_power", "cpu_power", "dram_power",
748
+ // "gpu_mem", "gpu_usage", "cpu_usage", "dram_usage",
749
+ // ];
665
750
serviceListattr = [
666
- "system_power" , "gpu_power" , "cpu_power" , "dram_power" ,
667
- "gpu_mem" , "gpu_usage" , "cpu_usage" , "dram_usage" ,
751
+ "system_power" , "cpu_power" , "dram_power" , "temperature" , "cpu_usage" , "dram_usage" ,
668
752
] ;
669
753
670
754
serviceLists = serviceListattr . map ( ( key , index ) => ( {
@@ -677,7 +761,7 @@ $(document).ready(function () {
677
761
enable : true ,
678
762
idroot : index ,
679
763
angle : 0 ,
680
- range : [ 0 , 3000 ]
764
+ range : index == 3 ? [ 0 , 100 ] : [ 0 , 3000 ] ,
681
765
} ]
682
766
} ) ) ;
683
767
serviceFullList = [ ] ;
0 commit comments