Changeset 880
- Timestamp:
- 05/18/13 18:25:10 (10 years ago)
- Location:
- branches/1.0/web/addons/job_monarch
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/web/addons/job_monarch/libtoga.php
r874 r880 211 211 } 212 212 213 function searchDbase( $id = null, $queue = null, $owner = null, $name = null, $start_from_time = null, $start_to_time = null, $end_from_time = null, $end_to_time = null )213 function searchDbase( $id = null, $queue = null, $owner = null, $name = null, $start_from_time = null, $start_to_time = null, $end_from_time = null, $end_to_time = null, $include_running = false ) 214 214 { 215 215 global $SEARCH_RESULT_LIMIT; 216 216 217 if( $include_running ) 218 { 219 $status_query = " AND job_status != 'Q'"; 220 } 221 else 222 { 223 $status_query = " AND job_status = 'F'"; 224 } 225 217 226 if( $id ) 218 227 { 219 $select_query = "SELECT job_id FROM jobs WHERE job_id = '$id' AND job_status = 'F'";228 $select_query = "SELECT job_id FROM jobs WHERE job_id = '$id'" . $status_query; 220 229 $this->resultcount = 1; 221 230 } … … 253 262 } 254 263 255 $query = "FROM jobs WHERE job_status = 'F' AND";264 $query = "FROM jobs WHERE "; 256 265 $extra_query_args = ''; 257 266 … … 267 276 } 268 277 } 269 $query .= $extra_query_args ;278 $query .= $extra_query_args . $status_query; 270 279 271 280 $count_result_idname = "COUNT(job_id)"; -
branches/1.0/web/addons/job_monarch/search.php
r817 r880 226 226 global $end_from_time, $end_to_time, $filter, $default_showhosts, $m, $hosts_up, $hc; 227 227 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 229 230 230 231 $longtitle = "Batch Archive Search :: Powered by Job Monarch!"; … … 236 237 $tpl_data = new Dwoo_Data(); 237 238 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 } 238 244 $tpl_data->assign( "self", $self ); 239 245 $tpl_data->assign( "cluster", $clustername ); … … 264 270 if( $end_from_time ) $end_from_time = datetimeToEpoch( $end_from_time ); 265 271 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 ); 267 273 268 274 //print_r( $search_ids ); … … 354 360 $job_start = $job['start_timestamp']; 355 361 $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 357 376 $node_list["started"]= makeDate( $job_start ); 358 $node_list["finished"]= makeDate( $job_stop );359 377 $node_list["runningtime"]= makeTime( $runningtime ); 360 378 … … 371 389 $tpl_data->assign("checked$showhosts", "checked"); 372 390 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 ); 376 397 $period_start = intval( $job_start - (intval( $runningtime * 0.10 ) ) ); 398 } 377 399 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 384 420 385 421 $tpl_data->assign( "timeperiod", "yes" ); -
branches/1.0/web/addons/job_monarch/templates/search.tpl
r811 r880 187 187 <TD></TD> 188 188 <TD></TD> 189 <TD>< /TD>189 <TD><input type="checkbox" name="include_running" {$running_checked}>Include running jobs</TD> 190 190 <TD> 191 191 <INPUT TYPE="submit" VALUE="Search archive" onClick="setSearchTimestamps();">
Note: See TracChangeset
for help on using the changeset viewer.