@@ -339,6 +339,52 @@ function PiConsumptionChart({ details, width = 300, height = 300, legend = true
339339 ) ;
340340}
341341
342+ function parseTRES ( tres ) {
343+ const result = { cpu : '' , mem : '' , node : '' , gpu : '' , gpuType : '' } ;
344+ if ( ! tres ) return result ;
345+ tres . split ( ',' ) . forEach ( part => {
346+ const [ key , val ] = part . split ( '=' ) ;
347+ if ( key === 'cpu' ) result . cpu = val ;
348+ else if ( key === 'mem' ) result . mem = val ;
349+ else if ( key === 'node' ) result . node = val ;
350+ else if ( key && key . startsWith ( 'gres/gpu' ) ) {
351+ const pieces = key . split ( ':' ) ;
352+ result . gpu = val ;
353+ if ( pieces [ 1 ] ) result . gpuType = pieces [ 1 ] ;
354+ }
355+ } ) ;
356+ return result ;
357+ }
358+
359+ function formatReqTres ( tres ) {
360+ const t = parseTRES ( tres ) ;
361+ return `cpu=${ t . cpu } mem=${ t . mem } node=${ t . node } gres/gpu=${ t . gpu } ` ;
362+ }
363+
364+ function formatAllocTres ( tres ) {
365+ const t = parseTRES ( tres ) ;
366+ const gpu = t . gpu
367+ ? t . gpuType
368+ ? `gres/gpu:(${ t . gpuType } )=${ t . gpu } `
369+ : `gres/gpu=${ t . gpu } `
370+ : '' ;
371+ return `cpu=${ t . cpu } mem=${ t . mem } node=${ t . node } ${ gpu } ` . trim ( ) ;
372+ }
373+
374+ function formatElapsed ( sec ) {
375+ if ( typeof sec !== 'number' ) return '' ;
376+ const h = Math . floor ( sec / 3600 )
377+ . toString ( )
378+ . padStart ( 2 , '0' ) ;
379+ const m = Math . floor ( ( sec % 3600 ) / 60 )
380+ . toString ( )
381+ . padStart ( 2 , '0' ) ;
382+ const s = Math . floor ( sec % 60 )
383+ . toString ( )
384+ . padStart ( 2 , '0' ) ;
385+ return `${ h } :${ m } :${ s } ` ;
386+ }
387+
342388function PaginatedJobTable ( { jobs } ) {
343389 const [ sortAsc , setSortAsc ] = useState ( true ) ;
344390 const [ page , setPage ] = useState ( 0 ) ;
@@ -363,12 +409,20 @@ function PaginatedJobTable({ jobs }) {
363409 React . createElement (
364410 'tr' ,
365411 null ,
366- React . createElement ( 'th' , null , 'Job' ) ,
412+ React . createElement ( 'th' , null , 'JobID' ) ,
413+ React . createElement ( 'th' , null , 'JobName' ) ,
414+ React . createElement ( 'th' , null , 'Partition' ) ,
415+ React . createElement ( 'th' , null , 'Start' ) ,
416+ React . createElement ( 'th' , null , 'End' ) ,
417+ React . createElement ( 'th' , null , 'Elapsed' ) ,
418+ React . createElement ( 'th' , null , 'ReqTRES' ) ,
419+ React . createElement ( 'th' , null , 'AllocTRES' ) ,
420+ React . createElement ( 'th' , null , 'State' ) ,
367421 React . createElement ( 'th' , null , 'Core Hours' ) ,
368422 React . createElement (
369423 'th' ,
370424 { className : 'clickable' , onClick : toggleSort } ,
371- '$ cost '
425+ '$ Cost '
372426 )
373427 )
374428 ) ,
@@ -380,6 +434,14 @@ function PaginatedJobTable({ jobs }) {
380434 'tr' ,
381435 { key : i } ,
382436 React . createElement ( 'td' , null , j . job ) ,
437+ React . createElement ( 'td' , null , j . job_name || '' ) ,
438+ React . createElement ( 'td' , null , j . partition || '' ) ,
439+ React . createElement ( 'td' , null , j . start || '' ) ,
440+ React . createElement ( 'td' , null , j . end || '' ) ,
441+ React . createElement ( 'td' , null , formatElapsed ( j . elapsed ) ) ,
442+ React . createElement ( 'td' , null , formatReqTres ( j . req_tres ) ) ,
443+ React . createElement ( 'td' , null , formatAllocTres ( j . alloc_tres ) ) ,
444+ React . createElement ( 'td' , null , j . state || '' ) ,
383445 React . createElement ( 'td' , null , j . core_hours ) ,
384446 React . createElement ( 'td' , null , j . cost )
385447 )
@@ -617,13 +679,41 @@ function Details({ details, daily, partitions = [], accounts = [], users = [] })
617679 . filter ( Boolean ) ;
618680
619681 function exportCSV ( ) {
620- const rows = [ [ 'Account' , 'Core Hours' , 'Cost' ] ] ;
682+ const rows = [
683+ [
684+ 'Account' ,
685+ 'User' ,
686+ 'JobID' ,
687+ 'JobName' ,
688+ 'Partition' ,
689+ 'Start' ,
690+ 'End' ,
691+ 'Elapsed' ,
692+ 'ReqTRES' ,
693+ 'AllocTRES' ,
694+ 'State' ,
695+ 'Core Hours' ,
696+ 'Cost'
697+ ]
698+ ] ;
621699 filteredDetails . forEach ( d => {
622- rows . push ( [ d . account , d . core_hours , d . cost ] ) ;
623700 ( d . users || [ ] ) . forEach ( u => {
624- rows . push ( [ ` ${ u . user } ` , u . core_hours , u . cost ] ) ;
625701 ( u . jobs || [ ] ) . forEach ( j => {
626- rows . push ( [ ` ${ j . job } ` , j . core_hours , j . cost ] ) ;
702+ rows . push ( [
703+ d . account ,
704+ u . user ,
705+ j . job ,
706+ j . job_name || '' ,
707+ j . partition || '' ,
708+ j . start || '' ,
709+ j . end || '' ,
710+ formatElapsed ( j . elapsed ) ,
711+ formatReqTres ( j . req_tres ) ,
712+ formatAllocTres ( j . alloc_tres ) ,
713+ j . state || '' ,
714+ j . core_hours ,
715+ j . cost
716+ ] ) ;
627717 } ) ;
628718 } ) ;
629719 } ) ;
0 commit comments