showexp_list.php3 19.8 KB
Newer Older
1
<?php
Leigh Stoller's avatar
Leigh Stoller committed
2 3
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
Leigh Stoller's avatar
Leigh Stoller committed
5 6
# All rights reserved.
#
7 8 9 10 11
include("defs.php3");

#
# Standard Testbed Header
#
12
PAGEHEADER("Experiment Information Listing");
13 14 15 16 17 18 19

#
# Only known and logged in users can end experiments.
#
$uid = GETLOGIN();
LOGGEDINORDIE($uid);

20
$isadmin     = ISADMIN($uid);
21 22
$clause      = 0;
$having      = "";
23 24
$active      = 0;
$idle        = 0;
25

Leigh Stoller's avatar
Leigh Stoller committed
26 27
if (! isset($showtype))
    $showtype="active";
28 29
if (! isset($sortby))
    $sortby = "normal";
30 31
if (! isset($thumb)) 
    $thumb = 0;
32 33
if (! isset($noignore)) 
    $noignore = 0;
34

35
echo "<b>Show: ";
36

37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
if ($showtype != "active") {
    echo "<a class='static' href='showexp_list.php3?showtype=active&sortby=$sortby&thumb=$thumb'>Active</a>, ";
} else {
    echo "Active, ";
}

if ($showtype != "batch") {
    echo "<a class='static' href='showexp_list.php3?showtype=batch&sortby=$sortby&thumb=$thumb'>Batch</a>, ";
} else {
    echo "Batch, ";
}

if ($isadmin) {
    if ($showtype != "idle") {
	echo "<a class='static' href='showexp_list.php3?showtype=idle&sortby=$sortby&thumb=$thumb'>Idle</a>, ";
    } else {
	echo "Idle, ";
    }
}

if ($showtype != "all") {
    echo "<a class='static' href='showexp_list.php3?showtype=all&sortby=$sortby&thumb=$thumb'>All</a>";
} else {
    echo "All";
}

echo "</b><br />\n";

65 66 67 68 69
# Default value for showlastlogin is 1 for admins
$showlastlogin = $isadmin;
# Note: setting this to 1 for non-admins still doesn't make the column
# show properly... it just shows the header in the table, over the
# wrong column. 
Leigh Stoller's avatar
Leigh Stoller committed
70

71 72
# How many hours is considered idle...
$idlehours = TBGetSiteVar("idle/threshold");
73

Leigh Stoller's avatar
Leigh Stoller committed
74 75 76 77 78 79 80
#
# Handle showtype
# 
if (! strcmp($showtype, "all")) {
    $title  = "All";
}
elseif (! strcmp($showtype, "active")) {
81 82
    # Active is now defined as "having nodes reserved" - we just depend on
    # the fact that we skip expts with no nodes further down...
83 84 85
    # But for speed, explicitly exclude expts that say they are "swapped"
    # (leave in activating, swapping, etc.)
    $clause = "e.state !='$TB_EXPTSTATE_SWAPPED'";
Leigh Stoller's avatar
Leigh Stoller committed
86
    $title  = "Active";
87
    $having = "having (ncount>0)";
88
    $active = 1;
Leigh Stoller's avatar
Leigh Stoller committed
89 90
}
elseif (! strcmp($showtype, "batch")) {
91 92
    $clause = "(e.batchmode=1 and e.batchstate!='" .
               TBDB_BATCHSTATE_PAUSED . "')";
Leigh Stoller's avatar
Leigh Stoller committed
93
    $title  = "Batch";
94
}
95
elseif ((!strcmp($showtype, "idle")) && $isadmin ) {
96
    # Do not put active in the clause for same reason as active
97 98
    # However, it takes a long time with so many swapped expts
    $clause = "e.state !='$TB_EXPTSTATE_SWAPPED'";
99
    $title  = "Idle";
100 101
    #$having = "having (lastswap>=1)"; # At least one day since swapin
    $having = "having (lastswap>=0)";
102
    $idle = 1;
103
    $showlastlogin = 0; # don't show a lastlogin column
104
}
105
else {
106
    # See active above
Leigh Stoller's avatar
Leigh Stoller committed
107
    $title  = "Active";
108
    $having = "having (ncount>0)";
109
    $active = 1;
110
}
111

112 113 114


if (!$idle) {
115 116 117
    echo "<b>View: ";

    if ($thumb != 0) {
118
	echo "<a class='static' href='showexp_list.php3?showtype=$showtype&sortby=$sortby&thumb=0'>";
119 120 121 122 123 124 125 126
	echo "List";
        echo "</a>";
    } else {
        echo "List";
    }
    echo ", ";

    if ($thumb != 1) {
127
	echo "<a class='static' href='showexp_list.php3?showtype=$showtype&sortby=$sortby&thumb=1'>";
128 129
	echo "Detailed Thumbnails";
        echo "</a>";
130
    } else {
131
        echo "Detailed Thumbnails";
132
    }
133 134 135
    echo ", ";

    if ($thumb != 2) {
136
	echo "<a class='static' href='showexp_list.php3?showtype=$showtype&sortby=$sortby&thumb=2'>";
137 138 139 140 141 142
	echo "Brief Thumbnails";
        echo "</a>";
    } else {
        echo "Brief Thumbnails";
    }
    echo "</b><br />\n";
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183

if ($thumb && !$idle) {
    echo "<b>Sort by: ";
    if (isset($sortby) && $sortby != "normal" && $sortby != "pid") {
	echo "<a class='static' href='showexp_list.php3?showtype=$showtype&sortby=pid&thumb=$thumb'>";
	echo "Project";
        echo "</a>, ";
    } else {
        echo "Project, ";
    }	
    if ($sortby != "eid") {
	echo "<a class='static' href='showexp_list.php3?showtype=$showtype&sortby=eid&thumb=$thumb'>";
	echo "Experiment ID";
        echo "</a>, ";
    } else {
        echo "Experiment ID, ";
    }
    if ($sortby != "pcs") {
	echo "<a class='static' href='showexp_list.php3?showtype=$showtype&sortby=pcs&thumb=$thumb'>";
	echo "Node Usage";
        echo "</a>, ";
    } else {
        echo "Node Usage, ";
    }	
    if ($sortby != "name") {
	echo "<a class='static' href='showexp_list.php3?showtype=$showtype&sortby=name&thumb=$thumb'>";
	echo "Experiment Description";
        echo "</a>, ";
    } else {
        echo "Experiment Description, ";
    }	
    if ($sortby != "uid") {
	echo "<a class='static' href='showexp_list.php3?showtype=$showtype&sortby=uid&thumb=$thumb'>";
	echo "Creator";
        echo "</a>";
    } else {
        echo "Creator";
    }

    echo "</b><br />\n";
}
184
}
185
 
186 187
echo "<br />\n";

Leigh Stoller's avatar
Leigh Stoller committed
188 189 190
#
# Handle sortby.
# 
191 192 193 194 195 196 197 198 199
if (! strcmp($sortby, "normal") ||
    ! strcmp($sortby, "pid"))
    $order = "e.pid,e.eid";
elseif (! strcmp($sortby, "eid"))
    $order = "e.eid,e.expt_head_uid";
elseif (! strcmp($sortby, "uid"))
    $order = "e.expt_head_uid,e.pid,e.eid";
elseif (! strcmp($sortby, "name"))
    $order = "e.expt_name";
200
elseif (! strcmp($sortby, "pcs"))
201
    $order = "ncount DESC,e.pid,e.eid";
202 203
elseif (! strcmp($sortby, "idle"))
    $order = "canbeidle desc,idle_ignore,idlesec DESC,ncount desc,e.pid,e.eid";
204 205 206
else 
    $order = "e.pid,e.eid";

207 208 209 210
#
# Show a menu of all experiments for all projects that this uid
# is a member of. Or, if an admin type person, show them all!
#
211 212 213 214 215
if ($clause) {
    $clause = "and ($clause)";
} else {
    $clause = "";
}
216 217 218 219 220

# Notes about the queries below:
# - idle is fudged by 121 seconds so that in the five minutes between 
#   slothd reports we don't get active expts showing up as idle for 0.1 hrs

221
if ($isadmin) {
Leigh Stoller's avatar
Leigh Stoller committed
222
    $experiments_result =
223 224 225 226 227 228 229 230
	DBQueryFatal("
select e.*, date_format(expt_swapped,'%Y-%m-%d') as d, 
date_format(expt_swapped,'%c/%e') as dshort, 
(to_days(now())-to_days(expt_swapped)) as lastswap, 
count(r.node_id) as ncount, swap_requests, 
round((unix_timestamp(now())-unix_timestamp(last_swap_req))/3600,1) as lastreq,
(unix_timestamp(now()) - unix_timestamp(max(greatest(
last_tty_act,last_net_act,last_cpu_act,last_ext_act)))) as idlesec,
231
(max(last_report) is not null) as canbeidle, s.rsrcidx
232
from experiments as e 
233 234
left join reserved as r on e.pid=r.pid and e.eid=r.eid
left join experiment_stats as s on e.idx=s.exptidx
235 236 237 238
left join nodes as n on r.node_id=n.node_id
left join node_activity as na on r.node_id=na.node_id
where (n.type!='dnard' or n.type is null) $clause 
group by e.pid,e.eid $having order by $order");
239 240
}
else {
Leigh Stoller's avatar
Leigh Stoller committed
241
    $experiments_result =
242 243 244 245 246
	DBQueryFatal("
select distinct e.*, date_format(expt_swapped,'%Y-%m-%d') as d, 
date_format(expt_swapped,'%c/%e') as dshort, count(r.node_id) as ncount, 
(unix_timestamp(now()) - unix_timestamp(max(greatest(
last_tty_act,last_net_act,last_cpu_act,last_ext_act)))) as idlesec,
247
(max(last_report) is not null) as canbeidle, s.rsrcidx
248 249
from group_membership as g 
left join experiments as e on g.pid=e.pid and g.pid=g.gid 
250
left join experiment_stats as s on e.idx=s.exptidx
251 252 253 254 255 256
left join reserved as r on e.pid=r.pid and e.eid=r.eid 
left join nodes as n on r.node_id=n.node_id 
left join node_activity as na on r.node_id=na.node_id
where (n.type!='dnard' or n.type is null) and 
 g.uid='$uid' and e.pid is not null and e.eid is not null $clause 
group by e.pid,e.eid $having order by $order");    
257
}
258
if (! mysql_num_rows($experiments_result)) {
259 260
    USERERROR("There are no experiments running in any of the projects ".
              "you are a member of.", 1);
261 262
}

263 264
if (mysql_num_rows($experiments_result)) {
    echo "<center>
Leigh Stoller's avatar
Leigh Stoller committed
265
           <h2>$title Experiments</h2>
266
          </center>\n";
267

268
    if ($idle) {
269
      echo "<p><center><b>Experiments that have been idle at least 
270 271 272 273 274 275
$idlehours hours</b><br>\n";
      if ($noignore) {
        echo "<a class='static' href='showexp_list.php3?showtype=idle&sortby=$sortby&thumb=$thumb'>\n
Exclude idle-ignore experiments</a></center></p><br />\n";
      } else {
        echo "<a class='static' href='showexp_list.php3?showtype=idle&sortby=$sortby&thumb=$thumb&noignore=1'>\n
276
Include idle-ignore experiments</a></center></p><br />\n";
277
      }
278
    }
279
    
280
    $idlemark = "<b>*</b>";
281 282 283
    $stalemark = "<b>?</b>";
    $parens = 0;
    
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
    #
    # Okay, I decided to do this as one big query instead of a zillion
    # per-exp queries in the loop below. No real reason, except my personal
    # desire not to churn the DB.
    # 
    $total_usage  = array();
    $perexp_usage = array();

    #
    # Geta all the classes of nodes each experiment is using, and create
    # a two-D array with their counts.
    # 
    $usage_query =
	DBQueryFatal("select r.pid,r.eid,nt.class, ".
		     "  count(nt.class) as ncount ".
		     "from reserved as r ".
		     "left join nodes as n on r.node_id=n.node_id ".
		     "left join node_types as nt on n.type=nt.type ".
		     "where n.type!='dnard' ".
		     "group by r.pid,r.eid,nt.class");

    while ($row = mysql_fetch_array($usage_query)) {
	$pid   = $row[0];
	$eid   = $row[1];
	$class = $row[2];
	$count = $row[3];
	
	$perexp_usage["$pid:$eid"][$class] = $count;
    }
313 314 315 316

    #
    # Now shove out the column headers.
    #
317
if ($thumb && !$idle) {
318 319 320 321 322
    if ($thumb == 2) {
	echo "<table border=2 cols=4 cellpadding=2 cellspacing=2 align=center><tr>";
    } else {
	echo "<table border=2 cols=2 cellpadding=2 cellspacing=2 align=center><tr>";
    }
323 324 325 326 327 328 329
    $thumbCount = 0;
 
    while ($row = mysql_fetch_array($experiments_result)) {	
	$pid  = $row["pid"];
	$eid  = $row["eid"]; 
	$huid = $row["expt_head_uid"];
	$name = stripslashes($row["expt_name"]);
330
	$date = $row["dshort"];
331
        $rsrcidx = $row["rsrcidx"];
332 333
	
	if ($idle && ($str=="&nbsp;" || !$pcs)) { continue; }
334

335 336 337 338
	if ($thumb == 2) {
	    if ($pid != "emulab-ops") {
		echo "<td align=center>".
		     "<a href='shownsfile.php3?pid=$pid&eid=$eid'>".
339
		     "<img border=1 class='stealth' ".
340 341
		     " src='showthumb.php3?idx=$rsrcidx'>".
		     "<br>\n".
342 343 344 345 346
		     "<b>".
		     "<a href='showproject.php3?pid=$pid'>$pid</a>/<br />".
		     "<a href='showexp.php3?pid=$pid&eid=$eid'>$eid</a>".
		     "</b>".
		     "</td>";
347 348 349

		$thumbcount++;
		if (($thumbcount % 4) == 0) { echo "</tr><tr>\n"; }
350 351 352 353 354 355
	    }
	} else {

	    echo "<td>".
		 "<table border=0 cellpadding=4 cellspacing=0>".
		 "<tr>".
356
		 "<td width=160 align=center>".
357
	         "<a href='shownsfile.php3?pid=$pid&eid=$eid'>".
358
		 "<img border=1 class='stealth' ".
359
		 " src='showthumb.php3?idx=$rsrcidx'>".
360 361 362 363 364 365 366 367 368 369
	         "</a>".
                 "</td>".
	         "<td align=left class='paddedcell'>".
	         "<b>".
 	         "<a href='showproject.php3?pid=$pid'>$pid</a>/".
                 "<a href='showexp.php3?pid=$pid&eid=$eid'>$eid</a>".
	         "</b>".
	         "<br />\n".
	         "<b><font size=-1>$name</font></b>".
                 "<br />\n";
370 371


372 373 374 375 376 377 378 379 380
	    if ($isadmin) {
		$swappable= $row["swappable"];
		$swapreq=$row["swap_requests"];
		$lastswapreq=$row["lastreq"];
		$lastlogin = "";
		if ($lastexpnodelogins = TBExpUidLastLogins($pid, $eid)) {
		    $daysidle=$lastexpnodelogins["daysidle"];
		    #if ($idle && $daysidle < 1)
		    #  continue;
381
		    $lastlogin .= $lastexpnodelogins["shortdate"] . " " .
382 383 384
			"(" . $lastexpnodelogins["uid"] . ")";
		} elseif ($state=="active") {
		    $daysidle=$row["lastswap"];
385
		    $lastlogin .= "$date swapin";
386 387 388 389 390 391
		}
		# if ($lastlogin=="") { $lastlogin="<td>&nbsp;</td>\n"; }
		if ($lastlogin != "") {
		    echo "<font size=-2><b>Last Login:</b> $lastlogin</font><br />\n";
		}
	    }	
392

393 394 395
	    echo "<font size=-2><b>Created by:</b> ".
		 "<a href='showuser.php3?target_uid=$huid'>$huid</a>".
		 "</font><br />\n";
396

397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418
	    $special = 0;
	    $pcs     = 0;
	    reset($perexp_usage);
	    if (isset($perexp_usage["$pid:$eid"])) {
		while (list ($class, $count) = each($perexp_usage["$pid:$eid"])) {
		    if (strcmp($class, "pc")) {
			$special += $count;
		    } else {
			$pcs += $count;
		    }
		}
	    }

	    if ($pcs) {
		if ($pcs == 1) { $plural = ""; } else { $plural = "s"; }  
		echo "<font size=-1><b>Using <font color=red>$pcs PC</font> Node$plural</b></font><br />\n";
	    }
	    if ($special) {
		if ($special == 1) { $plural = ""; } else { $plural = "s"; }  
		echo "<font size=-1><b>Using <font color=red>$special Special</font> Node$plural</b></font><br />\n";
	    }

419 420
	    echo "</td></tr></table> \n";
	    echo "</td>";
421

422
	    $thumbcount++;
423 424
	    if (($thumbcount % 2) == 0) { echo "</tr><tr>\n"; }
	}
425 426 427 428
    }

    echo "</tr></table>";
} else {
429 430 431

    $ni = ($noignore ? "&noignore=$noignore" : "");
    
432 433 434
    echo "<table border=2 cols=0
                 cellpadding=0 cellspacing=2 align=center>
            <tr>
Chad Barb's avatar
Chad Barb committed
435
              <th width=8%>
436
               <a class='static' href='showexp_list.php3?showtype=$showtype&sortby=pid$ni'>
437
                  PID</a></th>
Chad Barb's avatar
Chad Barb committed
438
              <th width=8%>
439
               <a class='static' href='showexp_list.php3?showtype=$showtype&sortby=eid$ni'>
440
                  EID</a></th>
Chad Barb's avatar
Chad Barb committed
441
              <th align=center width=3%>
442
               <a class='static' href='showexp_list.php3?showtype=$showtype&sortby=pcs$ni'>
443
                  PCs</a> [1]</th>
444
              <th align=center width=3%>
445
               <a class='static' href='showexp_list.php3?showtype=$showtype&sortby=idle$ni'>
446
               Hours Idle</a> [2]</th>\n";
447
    
448
    if ($showlastlogin)
Chad Barb's avatar
Chad Barb committed
449
        echo "<th width=17% align=center>Last Login</th>\n";
450
    if ($idle) {
451 452
	#echo "<th width=4% align=center colspan=2>Swap Requests</th>\n";
	echo "<th width=4% align=center>Swap Requests</th>\n";
453
    }
454

Chad Barb's avatar
Chad Barb committed
455
    echo "    <th width=60%>
456
               <a class='static' href='showexp_list.php3?showtype=$showtype&sortby=name$ni'>
457
                  Name</a></th>
Chad Barb's avatar
Chad Barb committed
458
              <th width=4%>
459
               <a class='static' href='showexp_list.php3?showtype=$showtype&sortby=uid$ni'>
460
                  Head UID</a></th>
461 462
            </tr>\n";

463
    while ($row = mysql_fetch_array($experiments_result)) {
464 465 466
	$pid  = $row["pid"];
	$eid  = $row["eid"]; 
	$huid = $row["expt_head_uid"];
Leigh Stoller's avatar
Leigh Stoller committed
467
	$name = stripslashes($row["expt_name"]);
468
	$date = $row["dshort"];
469
	$state= $row["state"];
470 471 472 473
	$ignore = $row['idle_ignore'];
	$idlesec= $row["idlesec"];
	$swapreqs = $row["swap_requests"];
	$isidle = ($idlesec >= 3600*$idlehours);
474
	$stale = TBGetExptIdleStale($pid,$eid);
475
	$daysidle=0;
476
	$idletime = ($idlesec > 300 ? round($idlesec/3600,1) : 0);
477 478
	# reset pcs
	$pcs=0;
479 480 481
	
	if ($swapreqs && !$isidle) {
	    $swapreqs = "";
482 483 484 485
	    mysql_query("update experiments set swap_requests='' ".
			"where pid='$pid' and eid='$eid'");
	}

486
	if ($isadmin) {
487 488 489
	    $swappable= $row["swappable"];
	    $swapreq=$row["swap_requests"];
	    $lastswapreq=$row["lastreq"];
490 491 492 493 494 495
	    if ($lastswapreq > $idletime) {
		# My last request was from _before_ it was idle this time
		mysql_query("update experiments set swap_requests='' ".
			    "where pid='$pid' and eid='$eid'");
		$swapreq=0;
	    }
496 497
	    $idlemailinterval = TBGetSiteVar("idle/mailinterval");
	    # Is it toosoon to send another mail?
498
	    $toosoon = ($swapreq>0 && ($lastswapreq < $idlemailinterval));
499
	    $lastlogin = "<td>";
500
	    if ($lastexpnodelogins = TBExpUidLastLogins($pid, $eid)) {
501
	        $daysidle=$lastexpnodelogins["daysidle"];
502 503
	        #if ($idle && $daysidle < 1)
		#  continue;
504
		$lastlogin .= $lastexpnodelogins["shortdate"] . " " .
505
		 "(" . $lastexpnodelogins["uid"] . ")";
506
	    } elseif ($state=="active") {
507
	        $daysidle=$row["lastswap"];
508
	        $lastlogin .= "$date swapin";
509
	    }
510 511
	    $lastlogin.="</td>\n";
	    if ($lastlogin=="<td></td>\n") { $lastlogin="<td>&nbsp;</td>\n"; }
512
	}
513
	
514
	if ($idle) {
515
	    # If it is ignored, skip it now.
516
	    if ($ignore && !$noignore) { continue; }
517
	    #$lastlogin .= "<td align=center>$daysidle</td>\n";
518 519 520
	    if (isset($perexp_usage["$pid:$eid"]) &&
		isset($perexp_usage["$pid:$eid"]["pc"])) {
	      $pcs = $perexp_usage["$pid:$eid"]["pc"];
521
	    }
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538
	    $foo = "<td align=center valign=center>\n";
	    #$label = "";
	    # Probably don't need this when we're using stalemark
	    #if ($stale) { $label .= "stale "; }
	    # Don't really need this if we're marking ignore with ()
	    #if ($ignore) { $label .= "ignore "; }
	    #if (!$swappable) { $label .= "unswap. "; }
 	    #if ($isidle && !$stale && !$ignore && !$toosoon && $pcs) {
	    #    $fooswap = "<td><a ".
	    #       "href=\"request_swapexp.php3?pid=$pid&eid=$eid\">".
	    #       "<img border=0 src=\"redball.gif\"></a> $label</td>\n" ;
	    #} else {
	    #   if ($label == "") { $label = "&nbsp;"; }
	    #   $fooswap = "<td>$label</td>";
	    #   if (!$pcs) { $foo .= "(no PCs)\n"; }
	    #   else { $foo .="&nbsp;"; }
	    #}
539
	    if ($swapreq > 0) {
540
	      $foo .= "$swapreq&nbsp;sent<br>".
541
	              "<font size=-2>(${lastswapreq}&nbsp;hrs&nbsp;ago)</font>\n";
542
	    }
543 544 545
	    #$foo .= "</td>".$fooswap."\n"; 
	    if (!$swappable) { $foo .= "unswap.\n"; }
	    
546
	}
547

548
	if ($idle && (!$pcs || !$isidle)) { continue; }
549

550 551
	$nodes   = 0;
	$special = 0;
552 553 554 555
	reset($perexp_usage);
	if (isset($perexp_usage["$pid:$eid"])) {
	    while (list ($class, $count) = each($perexp_usage["$pid:$eid"])) {
		$nodes += $count;
556
		if (strcmp($class, "pc")) {
557
		    $special = 1;
558 559 560 561
		} else {
		    $pcs = $count;
		}

562 563 564 565 566 567 568

		# Summary counts for just the experiments in the projects
		# the user is a member of.
		if (!isset($total_usage[$class]))
		    $total_usage[$class] = 0;
			
		$total_usage[$class] += $count;
569
	    }
570
	}
571 572 573

	# in idle or active, skip experiments with no nodes.
	if (($idle || $active) && $nodes == 0) { continue; }
574 575
	if ($nodes==0) { $nodes = "&nbsp;"; }
	
576 577
	echo "<tr>
                <td><A href='showproject.php3?pid=$pid'>$pid</A></td>
Leigh Stoller's avatar
Leigh Stoller committed
578
                <td><A href='showexp.php3?pid=$pid&eid=$eid'>
579
                       $eid</A></td>\n";
580
	
581
	if ($isidle && !$ignore) { $nodes = $nodes.$idlemark; }
582 583
	# If multiple classes, then hightlight the number.
	if ($special)
584 585 586 587
	    if ($idle)
		echo "<td><font color=red>$nodes</font> ($pcs)</td>\n";
	    else
                echo "<td><font color=red>$nodes</font></td>\n";
588 589
	else
            echo "<td>$nodes</td>\n";
590

Chad Barb's avatar
Chad Barb committed
591
	if ($idletime == -1) {
592
	    $idlestr = "&nbsp;";
Chad Barb's avatar
Chad Barb committed
593
	} else {
594 595 596 597
	    $idlestr = "$idletime";
	    # Order between the next two lines determines if the
	    # stalemark goes inside or outside the parens
	    if ($stale && $pcs > 0) { $idlestr .= $stalemark; }
598
	    if ($ignore && $idletime !=0) {
599 600
		$idlestr = "($idlestr)";
		$parens = 1;
601
	    }
Chad Barb's avatar
Chad Barb committed
602
	}
603
	echo "<td>$idlestr</td>";
604 605
	
	if ($showlastlogin) echo "$lastlogin\n";
606
	if ($idle) echo "$foo\n";
607 608

        echo "<td>$name</td>
609 610
                <td><A href='showuser.php3?target_uid=$huid'>
                       $huid</A></td>
611 612 613
               </tr>\n";
    }
    echo "</table>\n";
614

615 616
    
    echo "<font size=-1><ol>
617
             <li><font color=red>Red</font> indicates nodes other than PCs.
618 619
                 A $idlemark mark by the node count indicates that the
                 experiment is currently considered idle.
620 621 622 623 624 625 626 627 628
             <li>A $stalemark indicates that the data is stale, and
		 at least one node in the experiment has not reported
		 on its proper schedule.\n";
    if ($parens) {
	# don't show this unless we did it... most users shouldn't ever
	# need to know that you can set expts to have their idleness ignored
	echo "Values are in parenthesis for idle-ignore experiments.\n";
    }
    echo "</ol></font>\n";
629 630
    
    echo "<center><b>Node Totals</b></center>\n";
631 632 633
    echo "<table border=0
                 cellpadding=1 cellspacing=1 align=center>\n";
    $total = 0;
634
    ksort($total_usage);
635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654
    while (list($type, $count) = each($total_usage)) {
	    $total += $count;
	    echo "<tr>
                    <td align=right>${type}:</td>
                    <td>&nbsp &nbsp &nbsp &nbsp</td>
                    <td align=center>$count</td>
                  </tr>\n";
    }
    echo "<tr>
             <td align=right><hr></td>
             <td>&nbsp &nbsp &nbsp &nbsp</td>
             <td align=center><hr></td>
          </tr>\n";
    echo "<tr>
             <td align=right><b>Total</b>:</td>
             <td>&nbsp &nbsp &nbsp &nbsp</td>
             <td align=center>$total</td>
          </tr>\n";
    
    echo "</table>\n";
655 656
} # if ($thumb && !$idle)
} # if (mysql_num_rows($experiments_result))
657 658 659 660 661 662

#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>