Changeset 534


Ignore:
Timestamp:
07/10/08 14:40:20 (16 years ago)
Author:
ramonb
Message:

job_monarch/jobstore.php:

  • times and dates are now pretty and make sense

job_monarch/js/jobgrid.js:

  • changed column size

job_monarch/js/mainscript.js:

  • removed bogus example

job_monarch/overview.php,
job_monarch/libtoga.php:

  • moved time function
Location:
trunk/web2/addons/job_monarch
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/web2/addons/job_monarch/jobstore.php

    r532 r534  
    6767        foreach( $jobs as $jobid => $jobattrs )
    6868        {
    69                 //$jr           = $jobattrs;
    70                 $jr['jid']      = strval( $jobid );
    71                 $jr['status']   = $jobattrs['status'];
    72                 $jr['owner']    = $jobattrs['owner'];
    73                 $jr['queue']    = $jobattrs['queue'];
    74                 $jr['name']     = $jobattrs['name'];
    75                 $jr['requested_time']   = $jobattrs['requested_time'];
     69                if( $reported != $heartbeat )
     70                { // Old job: skip
     71                        continue;
     72                }
     73
     74                $jr['jid']              = strval( $jobid );
     75                $jr['status']           = $jobattrs['status'];
     76                $jr['owner']            = $jobattrs['owner'];
     77                $jr['queue']            = $jobattrs['queue'];
     78                $jr['name']             = $jobattrs['name'];
     79                $jr['requested_time']   = makeTime( timeToEpoch( $jobattrs['requested_time'] ) );
    7680
    7781                if( $jobattrs[status] == 'R' )
     
    8488                }
    8589
    86                 unset( $jr['nodes'] );
    87                 unset( $jr['poll_interval'] );
    88                 unset( $jr['reported'] );
     90                //unset( $jr['nodes'] );
     91                //unset( $jr['poll_interval'] );
     92                //unset( $jr['reported'] );
    8993
    90                 $jr['ppn']      = strval( $jobattrs[ppn] ? $jobattrs[ppn] : 1 );
    91                 $jr['cpu']      = strval( $nodes * (int) $ppn );
     94                $jr['ppn']              = strval( $jobattrs[ppn] ? $jobattrs[ppn] : 1 );
     95                $jr['cpu']              = strval( $nodes * (int) $ppn );
    9296
    9397
     
    96100                        $jr['nodes']    = implode( ",", $jobattrs['nodes'] );
    97101                }
    98                 $jr['queued_timestamp'] = $jobattrs['queued_timestamp'];
    99                 $jr['start_timestamp']  = ($jobattrs['start_timestamp'] ? $jobattrs['start_timestamp'] : "");
    100102
    101                 $jobresults[]   = $jr;
     103                $jr['queued_timestamp'] = makeDate( $jobattrs['queued_timestamp'] );
     104                $jr['start_timestamp']  = ($jobattrs['start_timestamp'] ? makeDate( $jobattrs['start_timestamp'] ) : "");
     105
     106                $jobresults[]           = $jr;
    102107        }
    103108
  • trunk/web2/addons/job_monarch/js/jobgrid.js

    r532 r534  
    7070        hidden: false
    7171      },{
    72         header: 'Requested CPU time',
     72        header: 'Requested Time',
    7373        readOnly: true,
    7474        dataIndex: 'requested_time',
     
    103103        readOnly: true,
    104104        dataIndex: 'queued_timestamp',
    105         width: 100,
     105        width: 140,
    106106        hidden: false
    107107      },{
     
    109109        readOnly: true,
    110110        dataIndex: 'start_timestamp',
    111         width: 100,
     111        width: 140,
    112112        hidden: false
    113113      }]
     
    11791179      items: JobListingEditorGrid
    11801180    });
    1181  
     1181
     1182  //debug(); 
    11821183  JobsDataStore.load();
    11831184  //JobListingEditorGrid.render();
  • trunk/web2/addons/job_monarch/libtoga.php

    r533 r534  
    23882388        if( $days > 0 )
    23892389        {
    2390                 if( $days > 1 )
    2391                 {
    2392                         $day_str .= $days . ' days';
    2393                 }
    2394                 else
    2395                 {
    2396                         $day_str .= $days . ' day';
     2390                if( $days > 1 )
     2391                {
     2392                        $date_str .= $days . ' days';
     2393                }
     2394                else
     2395                {
     2396                        $date_str .= $days . ' day';
    23972397                }
    23982398        }
     
    24032403        if( $hours > 0 )
    24042404        {
    2405                 $date_str .= $hours . ':';
    2406                 $date_unit = 'hours';
     2405                if( $hours > 1 )
     2406                {
     2407                        $date_unit      = 'hours';
     2408                }
     2409                else
     2410                {
     2411                        $date_unit      = 'hour';
     2412                }
     2413
     2414                if( $date_str != '' )
     2415                {
     2416                        $date_str .= ' ' . $hours . ' ' . $date_unit;
     2417                }
     2418                else
     2419                {
     2420                        $date_str .= $hours . ' ' . $date_unit;
     2421                }
    24072422        }
    24082423
     
    24122427        if( $minutes > 0 )
    24132428        {
    2414                 if( $minutes >= 10 )
    2415                 {
    2416                         $date_str .= $minutes . ':';
    2417                 }
    2418                 else
    2419                 {
    2420                         $date_str .= '0' . $minutes . ':';
    2421                 }
    2422 
    2423                 $date_unit = (!isset($date_unit)) ? 'minutes' : $date_unit;
     2429                if( $minutes > 1 )
     2430                {
     2431                        $date_unit      = 'minutes';
     2432                }
     2433                else
     2434                {
     2435                        $date_unit      = 'minute';
     2436                }
     2437
     2438                if( $date_str != '' )
     2439                {
     2440                        $date_str .= ' ' . $minutes . ' ' . $date_unit;
     2441                }
     2442                else
     2443                {
     2444                        $date_str .= $minutes . ' ' . $date_unit;
     2445                }
    24242446        }
    2425         else
    2426         {
    2427                 if($hours > 0 )
    2428                 {
    2429                         $date_str .= '00:';
    2430                         $date_unit = (!isset($date_unit)) ? 'minutes' : $date_unit;
    2431                 }
     2447
     2448        if( $seconds > 0 )
     2449        {
     2450                if( $seconds > 1 )
     2451                {
     2452                        $date_unit      = 'seconds';
     2453                }
     2454                else
     2455                {
     2456                        $date_unit      = 'second';
     2457                }
     2458
     2459                if( $date_str != '' )
     2460                {
     2461                        $date_str .= ' ' . $seconds . ' ' . $date_unit;
     2462                }
     2463                else
     2464                {
     2465                        $date_str .= $seconds . ' ' . $date_unit;
     2466                }
    24322467        }
    24332468
    2434         $date_unit = (!isset($date_unit)) ? 'seconds' : $date_unit;
    2435 
    2436         if( $seconds > 0 )
    2437         {
    2438                 if( $seconds >= 10 )
    2439                 {
    2440                         $date_str .= $seconds . ' ' . $date_unit;
    2441                 }
    2442                 else
    2443                 {
    2444                         $date_str .= '0' . $seconds . ' ' . $date_unit;
    2445                 }
    2446         }
    2447         else if ( $hours > 0 or $minutes > 0 )
    2448         {
    2449                 $date_str .= '00 ' . $date_unit;
    2450         }
    2451 
    2452         if( $days > 0)
    2453         {
    2454                 if( $hours > 0 or $minutes > 0 or $seconds > 0 )
    2455                 {
    2456                         $date_str = $day_str . ' - ' . $date_str;
    2457                 }
    2458                 else
    2459                 {
    2460                         $date_str = $day_str;
    2461                 }
    2462         }
    24632469        return $date_str;
    24642470}
  • trunk/web2/addons/job_monarch/overview.php

    r532 r534  
    105105}
    106106
    107 function timeToEpoch( $time )
    108 {
    109         $time_fields    = explode( ':', $time );
    110 
    111         if( count( $time_fields ) == 3 )
    112         {
    113                 $hours          = $time_fields[0];
    114                 $minutes        = $time_fields[1];
    115                 $seconds        = $time_fields[2];
    116 
    117         }
    118         else if( count( $time_fields ) == 2 )
    119         {
    120                 $hours          = 0;
    121                 $minutes        = $time_fields[0];
    122                 $seconds        = $time_fields[1];
    123 
    124         }
    125         else if( count( $time_fields ) == 1 )
    126         {
    127                 $hours          = 0;
    128                 $minutes        = 0;
    129                 $seconds        = $time_fields[0];
    130         }
    131 
    132         $myepoch        = intval( $seconds + (intval( $minutes * 60 )) + (intval( $hours * 3600 )) );
    133 
    134         return $myepoch;
    135 }
    136 
    137107function colorRed( $color )
    138108{
Note: See TracChangeset for help on using the changeset viewer.