Ignore:
Timestamp:
05/18/13 18:25:10 (11 years ago)
Author:
ramonb
Message:

libtoga.php:

  • allow searchDbase query to include running jobs

templates/search.tpl:

  • added "include running jobs" checkbox

search.php:

  • pass include running option submit to searchDbase
  • some modifications to start/stop times for running jobs
  • closes #167
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.0/web/addons/job_monarch/search.php

    r817 r880  
    226226    global $end_from_time, $end_to_time, $filter, $default_showhosts, $m, $hosts_up, $hc;
    227227    global $period_start, $period_stop, $sortby, $sortorder, $COLUMN_REQUESTED_MEMORY;
    228     global $SEARCH_RESULT_LIMIT, $COLUMN_NODES, $metricname, $self, $conf;
     228    global $SEARCH_RESULT_LIMIT, $COLUMN_NODES, $metricname, $self, $conf, $include_running;
     229
    229230
    230231    $longtitle = "Batch Archive Search :: Powered by Job Monarch!";
     
    236237    $tpl_data = new Dwoo_Data();
    237238
     239    if( in_array( $include_running, array('on','checked','true','yes') ) )
     240    {
     241        $include_running = true;
     242        $tpl_data->assign( "running_checked", "checked='on'" );
     243    }
    238244    $tpl_data->assign( "self", $self );
    239245    $tpl_data->assign( "cluster", $clustername );
     
    264270        if( $end_from_time ) $end_from_time = datetimeToEpoch( $end_from_time );
    265271        if( $end_to_time ) $end_to_time = datetimeToEpoch( $end_to_time );
    266         $search_ids = $tdb->searchDbase( $id, $queue, $owner, $name, $start_from_time, $start_to_time, $end_from_time, $end_to_time );
     272        $search_ids = $tdb->searchDbase( $id, $queue, $owner, $name, $start_from_time, $start_to_time, $end_from_time, $end_to_time, $include_running );
    267273
    268274        //print_r( $search_ids );
     
    354360            $job_start = $job['start_timestamp'];
    355361            $job_stop = $job['stop_timestamp'];
    356             $runningtime = intval( $job_stop - $job_start );
     362
     363            if( $job['status'] == 'R' )
     364            {
     365                $period_stop = time();
     366                $runningtime = $period_stop - intval( $job_start );
     367                $period_start = intval( $job_start - (intval( $runningtime * 0.10 ) ) );
     368                $node_list["finished"]= '';
     369            }
     370            else
     371            {
     372                $runningtime = intval( $job_stop - $job_start );
     373                $node_list["finished"]= makeDate( $job_stop );
     374            }
     375
    357376            $node_list["started"]= makeDate( $job_start );
    358             $node_list["finished"]= makeDate( $job_stop );
    359377            $node_list["runningtime"]= makeTime( $runningtime );
    360378           
     
    371389            $tpl_data->assign("checked$showhosts", "checked");
    372390
    373             if( $showhosts ) {
    374 
    375                 if( !$period_start ) // Add an extra 10% to graphstart
     391            if( $showhosts )
     392            {
     393                if( $job['status'] == 'R' )
     394                {
     395                    $period_stop = time();
     396                    $runningtime = $period_stop - intval( $job_start );
    376397                    $period_start = intval( $job_start - (intval( $runningtime * 0.10 ) ) );
     398                }
    377399                else
    378                     $period_start = datetimeToEpoch( $period_start );
    379 
    380                 if( !$period_stop ) // Add an extra 10% to graphend
    381                     $period_stop = intval( $job_stop + (intval( $runningtime * 0.10 ) ) );
    382                 else
    383                     $period_stop = datetimeToEpoch( $period_stop );
     400                {
     401                    if( !$period_start ) // Add an extra 10% to graphstart
     402                    {
     403                        $period_start = intval( $job_start - (intval( $runningtime * 0.10 ) ) );
     404                    }
     405                    else
     406                    {
     407                        $period_start = datetimeToEpoch( $period_start );
     408                    }
     409
     410                    if( !$period_stop ) // Add an extra 10% to graphend
     411                    {
     412                        $period_stop = intval( $job_stop + (intval( $runningtime * 0.10 ) ) );
     413                    }
     414                    else
     415                    {
     416                        $period_stop = datetimeToEpoch( $period_stop );
     417                    }
     418                }
     419
    384420
    385421                $tpl_data->assign( "timeperiod", "yes" );
Note: See TracChangeset for help on using the changeset viewer.