Commit bb5d05bf authored by Leigh B Stoller's avatar Leigh B Stoller

Add "ProtoGeni" display modes.

parent e788fd7a
<?php <?php
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2008 University of Utah and the Flux Group. # Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
include("defs.php3"); include("defs.php3");
...@@ -30,6 +30,7 @@ $clause = 0; ...@@ -30,6 +30,7 @@ $clause = 0;
$having = ""; $having = "";
$active = 0; $active = 0;
$idle = 0; $idle = 0;
$protogeni = 0;
# #
# Hack for NSDI deadline. Generalize later. # Hack for NSDI deadline. Generalize later.
...@@ -79,6 +80,12 @@ if ($isadmin) { ...@@ -79,6 +80,12 @@ if ($isadmin) {
} else { } else {
echo "Idle, "; echo "Idle, ";
} }
if ($showtype != "ProtoGENI") {
echo "<a class='static' href='showexp_list.php3?showtype=ProtoGENI&sortby=$sortby&thumb=$thumb'>ProtoGENI</a>, ";
} else {
echo "ProtoGENI, ";
}
} }
if ($showtype != "all") { if ($showtype != "all") {
...@@ -129,6 +136,12 @@ elseif ((!strcmp($showtype, "idle")) && $isadmin ) { ...@@ -129,6 +136,12 @@ elseif ((!strcmp($showtype, "idle")) && $isadmin ) {
$idle = 1; $idle = 1;
$showlastlogin = 0; # do not show a lastlogin column $showlastlogin = 0; # do not show a lastlogin column
} }
elseif ($showtype == "ProtoGENI" && $isadmin) {
$title = "ProtoGENI";
$clause = "e.nonlocal_type='protogeni'";
$protogeni = 1;
$showlastlogin = 0; # do not show a lastlogin column
}
else { else {
# See active above # See active above
$title = "Active"; $title = "Active";
...@@ -255,12 +268,13 @@ count(r.node_id) as ncount, swap_requests, ...@@ -255,12 +268,13 @@ count(r.node_id) as ncount, swap_requests,
round((unix_timestamp(now())-unix_timestamp(last_swap_req))/3600,1) as lastreq, round((unix_timestamp(now())-unix_timestamp(last_swap_req))/3600,1) as lastreq,
(unix_timestamp(now()) - unix_timestamp(max(greatest( (unix_timestamp(now()) - unix_timestamp(max(greatest(
last_tty_act,last_net_act,last_cpu_act,last_ext_act)))) as idlesec, last_tty_act,last_net_act,last_cpu_act,last_ext_act)))) as idlesec,
(max(last_report) is not null) as canbeidle, s.rsrcidx (max(last_report) is not null) as canbeidle, s.rsrcidx, p.nonlocal_id
from experiments as e from experiments as e
left join reserved as r on e.pid=r.pid and e.eid=r.eid 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 left join experiment_stats as s on e.idx=s.exptidx
left join nodes as n on r.node_id=n.node_id 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 left join node_activity as na on r.node_id=na.node_id
left join projects as p on p.pid_idx=e.pid_idx
$openlist_join $openlist_join
where (n.type!='dnard' or n.type is null) $clause $openlist_clause where (n.type!='dnard' or n.type is null) $clause $openlist_clause
group by e.pid,e.eid $having order by $order"); group by e.pid,e.eid $having order by $order");
...@@ -284,8 +298,7 @@ where (n.type!='dnard' or n.type is null) and ...@@ -284,8 +298,7 @@ where (n.type!='dnard' or n.type is null) and
group by e.pid,e.eid $having order by $order"); group by e.pid,e.eid $having order by $order");
} }
if (! mysql_num_rows($experiments_result)) { if (! mysql_num_rows($experiments_result)) {
USERERROR("There are no experiments running in any of the projects ". USERERROR("There are no experiments running that match the criteria.", 1);
"you are a member of.", 1);
} }
if (mysql_num_rows($experiments_result)) { if (mysql_num_rows($experiments_result)) {
...@@ -375,17 +388,25 @@ if ($thumb && !$idle) { ...@@ -375,17 +388,25 @@ if ($thumb && !$idle) {
$pid = $row["pid"]; $pid = $row["pid"];
$eid = $row["eid"]; $eid = $row["eid"];
$huid = $row["expt_head_uid"]; $huid = $row["expt_head_uid"];
$sidx = $row["swapper_idx"];
$name = stripslashes($row["expt_name"]); $name = stripslashes($row["expt_name"]);
$date = $row["dshort"]; $date = $row["dshort"];
$rsrcidx = $row["rsrcidx"]; $rsrcidx = $row["rsrcidx"];
$state= $row["state"]; $state= $row["state"];
if (! ($head_user = User::Lookup($huid))) { if ($state == "active" && isset($sidx)) {
TBERROR("Could not lookup object for user $huid", 1); if (! ($user = User::Lookup($sidx))) {
TBERROR("Could not lookup object for user $sidx", 1);
}
}
else {
if (! ($user = User::Lookup($huid))) {
TBERROR("Could not lookup object for user $huid", 1);
}
} }
$showuser_url = CreateURL("showuser", $head_user); $showuser_url = CreateURL("showuser", $user);
$head_affil = $head_user->affil_abbrev(); $user_affil = $user->affil_abbrev();
$head_affil_text = $head_affil ? "&nbsp;($head_affil)" : ""; $user_affil_text = $user_affil ? "&nbsp;($user_affil)" : "";
if ($idle && ($str=="&nbsp;" || !$pcs)) { continue; } if ($idle && ($str=="&nbsp;" || !$pcs)) { continue; }
...@@ -448,7 +469,7 @@ if ($thumb && !$idle) { ...@@ -448,7 +469,7 @@ if ($thumb && !$idle) {
} }
echo "<font size=-2><b>Created by:</b> ". echo "<font size=-2><b>Created by:</b> ".
"<a href='$showuser_url'>$huid</a>$head_affil_text". "<a href='$showuser_url'>$huid</a>$user_affil_text".
"</font><br />\n"; "</font><br />\n";
$special = 0; $special = 0;
...@@ -489,48 +510,55 @@ if ($thumb && !$idle) { ...@@ -489,48 +510,55 @@ if ($thumb && !$idle) {
echo "<table border=2 cols=0 echo "<table border=2 cols=0
cellpadding=0 cellspacing=2 align=center> cellpadding=0 cellspacing=2 align=center>
<tr> <tr>
<th width=8%> <th >
<a class='static' href='showexp_list.php3?showtype=$showtype&sortby=pid$ni'> <a class='static'
href='showexp_list.php3?showtype=$showtype&sortby=pid$ni'>
PID</a></th> PID</a></th>
<th width=8%> <th >
<a class='static' href='showexp_list.php3?showtype=$showtype&sortby=eid$ni'> <a class='static'
href='showexp_list.php3?showtype=$showtype&sortby=eid$ni'>
EID</a></th> EID</a></th>
<th align=center width=3%> <th align=center >
<a class='static' href='showexp_list.php3?showtype=$showtype&sortby=pcs$ni'> <a class='static'
href='showexp_list.php3?showtype=$showtype&sortby=pcs$ni'>
PCs</a> [1]</th> PCs</a> [1]</th>
<th align=center width=3%> <th align=center >
<a class='static' href='showexp_list.php3?showtype=$showtype&sortby=idle$ni'> <a class='static'
Hours Idle</a> [2]</th>\n"; href='showexp_list.php3?showtype=$showtype&sortby=idle$ni'>
Hours Idle</a> [2]</th>\n";
if ($showlastlogin) if ($showlastlogin)
echo "<th width=17% align=center>Last Login</th>\n"; echo "<th align=center>Last Login</th>\n";
if ($idle) { if ($idle) {
#echo "<th width=4% align=center colspan=2>Swap Requests</th>\n"; #echo "<th width=4% align=center colspan=2>Swap Requests</th>\n";
echo "<th width=4% align=center>Swap Requests</th>\n"; echo "<th align=center>Swap Requests</th>\n";
} }
if (! $openlist_member) { if (! ($openlist_member || $protogeni)) {
echo "<th width=60%> echo "<th >
<a class='static' ". <a class='static' ".
"href='showexp_list.php3?showtype=$showtype". "href='showexp_list.php3?showtype=$showtype".
"&sortby=name$ni'>Description</a></th>\n"; "&sortby=name$ni'>Description</a></th>\n";
} }
echo " <th width=4%> echo " <th >
<a class='static' ". <a class='static' ".
"href='showexp_list.php3?showtype=$showtype&sortby=uid$ni'> "href='showexp_list.php3?showtype=$showtype&sortby=uid$ni'>
Head UID</a></th> Creator/<br>Swapper</a></th>
</tr>\n"; </tr>\n";
while ($row = mysql_fetch_array($experiments_result)) { while ($row = mysql_fetch_array($experiments_result)) {
$pid = $row["pid"]; $pid = $row["pid"];
$eid = $row["eid"]; $eid = $row["eid"];
$huid = $row["expt_head_uid"]; $huid = $row["expt_head_uid"];
$sidx = $row["swapper_idx"];
$name = stripslashes($row["expt_name"]); $name = stripslashes($row["expt_name"]);
$date = $row["dshort"]; $date = $row["dshort"];
$state= $row["state"]; $state= $row["state"];
$ignore = $row['idle_ignore']; $ignore = $row['idle_ignore'];
$idlesec= $row["idlesec"]; $idlesec= $row["idlesec"];
$swapreqs = $row["swap_requests"]; $swapreqs = $row["swap_requests"];
$nonlocal_id = $row["nonlocal_id"];
$nonlocal_user_id = $row["nonlocal_user_id"];
$isidle = ($idlesec >= 3600*$idlehours); $isidle = ($idlesec >= 3600*$idlehours);
$daysidle=0; $daysidle=0;
$idletime = ($idlesec > 300 ? round($idlesec/3600,1) : 0); $idletime = ($idlesec > 300 ? round($idlesec/3600,1) : 0);
...@@ -542,13 +570,19 @@ if ($thumb && !$idle) { ...@@ -542,13 +570,19 @@ if ($thumb && !$idle) {
} }
$stale = $experiment->IdleStale(); $stale = $experiment->IdleStale();
if (! ($head_user = User::Lookup($huid))) { if ($state == "active" && isset($sidx)) {
TBERROR("Could not lookup object for user $huid", 1); if (! ($user = User::Lookup($sidx))) {
TBERROR("Could not lookup object for user $sidx", 1);
}
} }
$showuser_url = CreateURL("showuser", $head_user); else {
$head_affil = $head_user->affil_abbrev(); if (! ($user = User::Lookup($huid))) {
$head_affil_text = $head_affil ? "&nbsp;($head_affil)" : ""; TBERROR("Could not lookup object for user $huid", 1);
}
}
$showuser_url = CreateURL("showuser", $user);
$user_affil = $user->affil_abbrev();
$user_affil_text = $user_affil ? "&nbsp;($user_affil)" : "";
if ($swapreqs && !$isidle) { if ($swapreqs && !$isidle) {
$swapreqs = ""; $swapreqs = "";
...@@ -664,7 +698,15 @@ if ($thumb && !$idle) { ...@@ -664,7 +698,15 @@ if ($thumb && !$idle) {
if ($nodes==0) { $nodes = "&nbsp;"; } if ($nodes==0) { $nodes = "&nbsp;"; }
echo "<tr> echo "<tr>
<td><A href='showproject.php3?pid=$pid'>$pid</A></td> <td><A href='showproject.php3?pid=$pid'>";
if ($protogeni && $nonlocal_id) {
echo $nonlocal_id;
}
else {
echo "$pid";
}
echo "</A>";
echo " </td>
<td><A href='showexp.php3?pid=$pid&eid=$eid'> <td><A href='showexp.php3?pid=$pid&eid=$eid'>
$eid</A></td>\n"; $eid</A></td>\n";
...@@ -696,11 +738,15 @@ if ($thumb && !$idle) { ...@@ -696,11 +738,15 @@ if ($thumb && !$idle) {
if ($showlastlogin) echo "$lastlogin\n"; if ($showlastlogin) echo "$lastlogin\n";
if ($idle) echo "$foo\n"; if ($idle) echo "$foo\n";
if (! $openlist_member) { if (! ($openlist_member || $protogeni)) {
echo "<td>$name</td>\n"; echo "<td>$name</td>\n";
} }
if ($protogeni) {
echo "<td><A href='$showuser_url'>$huid</A>$head_affil_text</td>\n"; echo "<td>$nonlocal_user_id</td>\n";
}
else {
echo "<td><A href='$showuser_url'>$huid</A>$user_affil_text</td>\n";
}
echo "</tr>\n"; echo "</tr>\n";
} }
echo "</table>\n"; echo "</table>\n";
......
<?php <?php
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2003, 2006, 2007 University of Utah and the Flux Group. # Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
include("defs.php3"); include("defs.php3");
...@@ -16,36 +16,61 @@ $isadmin = ISADMIN(); ...@@ -16,36 +16,61 @@ $isadmin = ISADMIN();
# #
# Verify page arguments # Verify page arguments
# #
$optargs = OptionalPageArguments("splitview", PAGEARG_BOOLEAN); $optargs = OptionalPageArguments("showtype", PAGEARG_STRING);
# #
# Standard Testbed Header # Standard Testbed Header
# #
PAGEHEADER("Project Information List"); PAGEHEADER("Project Information List");
# if (! isset($showtype)) {
# Admin users can see all projects, while normal users can only see $showtype="Splitview";
# projects for which they are the leader. }
#
# XXX Should we form the list from project members instead of leaders?
#
if (!isset($splitview) || !$isadmin)
$splitview = 0;
if ($isadmin) { if ($isadmin) {
if (! $splitview) { echo "<b>Show: ";
echo "<b><a href='showproject_list.php3?splitview=1'>Split View</a>
</b><br>\n"; if ($showtype != "Active") {
echo "<a class='static'
href='showproject_list.php3?showtype=Active'>Active</a>, ";
} }
else { else {
echo "<b><a href='showproject_list.php3'>Normal View</a> echo "Active, ";
</b><br>\n"; }
if ($showtype != "All") {
echo "<a class='static'
href='showproject_list.php3?showtype=All'>All</a>, ";
}
else {
echo "All, ";
}
if ($showtype != "Splitview") {
echo "<a class='static'
href='showproject_list.php3?showtype=Splitview'>Splitview</a>, ";
}
else {
echo "Splitview, ";
}
if ($showtype != "ProtoGENI") {
echo "<a class='static'
href='showproject_list.php3?showtype=ProtoGENI'>ProtoGENI</a>";
}
else {
echo "ProtoGENI";
} }
} }
echo "<br>\n";
$allproj_result = $allproj_result =
DBQueryFatal("SELECT pid,expt_count FROM projects as p"); DBQueryFatal("SELECT p.pid,p.expt_count, ".
" UNIX_TIMESTAMP(s.last_activity) as last_activity ".
" FROM projects as p ".
"left join project_stats as s ".
" on s.pid_idx=p.pid_idx");
# #
# This is summary info, indexed by the pid, so no need to alter it # This is summary info, indexed by the pid, so no need to alter it
# for admin vs non-admin. Thats handled in the project query below. # for admin vs non-admin. Thats handled in the project query below.
...@@ -116,17 +141,26 @@ if ($isadmin) { ...@@ -116,17 +141,26 @@ if ($isadmin) {
# #
$total_projects = mysql_num_rows($allproj_result); $total_projects = mysql_num_rows($allproj_result);
$active_projects = 0; $active_projects = 0;
$recently_active = 0;
while ($projectrow = mysql_fetch_array($allproj_result)) { while ($projectrow = mysql_fetch_array($allproj_result)) {
$expt_count = $projectrow["expt_count"]; $expt_count = $projectrow["expt_count"];
$last_activity = $projectrow["last_activity"];
if ($expt_count > 0) { if ($expt_count > 0) {
$active_projects++; $active_projects++;
} }
if (time() - $last_activity < (24 * 3600 * 90)) {
$recently_active++;
}
} }
$never_active = $total_projects - $active_projects; $never_active = $total_projects - $active_projects;
echo "<table border=0 align=center cellpadding=0 cellspacing=2> echo "<table border=0 align=center cellpadding=0 cellspacing=2>
<tr>
<td align=right><b>Recently Active:</b></td>
<td align=left>$recently_active</td>
</tr>
<tr> <tr>
<td align=right><b>Been Active:</b></td> <td align=right><b>Been Active:</b></td>
<td align=left>$active_projects</td> <td align=left>$active_projects</td>
...@@ -144,7 +178,7 @@ if ($isadmin) { ...@@ -144,7 +178,7 @@ if ($isadmin) {
function GENPLIST ($query_result) function GENPLIST ($query_result)
{ {
global $isadmin, $splitview, $ecounts, $ncounts, $pcounts; global $isadmin, $ecounts, $ncounts, $pcounts, $showtype;
$tablename = "SPL" . rand(); $tablename = "SPL" . rand();
...@@ -155,18 +189,20 @@ function GENPLIST ($query_result) ...@@ -155,18 +189,20 @@ function GENPLIST ($query_result)
echo "<th>PID</th>\n"; echo "<th>PID</th>\n";
echo "<th>(Approved?) Description</th>\n"; echo "<th>(Approved?) Description</th>\n";
echo "<th>Leader</th>\n"; if ($showtype != "ProtoGENI") {
echo "<th>Affil</th>\n"; echo "<th>Leader</th>\n";
echo "<th>Affil</th>\n";
}
echo "<th>Days<br>Idle</th>\n"; echo "<th>Days<br>Idle</th>\n";
echo "<th>Expts<br>Created</th>\n"; echo "<th>Expts<br>Created</th>\n";
echo "<th>Expts<br>Run</th>\n"; echo "<th>Expts<br>Running</th>\n";
echo "<th>Nodes<br>All</th>\n"; echo "<th>Nodes<br>All</th>\n";
echo "<th>Nodes<br>PCs</th>\n"; echo "<th>Nodes<br>PCs</th>\n";
# #
# Admin users get other fields. # Admin users get other fields.
# #
if ($isadmin) { if ($isadmin && $showtype != "ProtoGENI") {
echo "<th align=center>Pub?</th>\n"; echo "<th align=center>Pub?</th>\n";
} }
echo "</tr>\n"; echo "</tr>\n";
...@@ -200,17 +236,18 @@ function GENPLIST ($query_result) ...@@ -200,17 +236,18 @@ function GENPLIST ($query_result)
else { else {
echo " <img alt='N' src='redball.gif'>\n"; echo " <img alt='N' src='redball.gif'>\n";
} }
echo " $Pname</td> echo " $Pname</td>";
<td><A href='$showuser_url'>$headuid</A></td>\n"; if ($showtype != "ProtoGENI") {
echo "<td>$affil</td>\n"; echo "<td><A href='$showuser_url'>$headuid</A></td>\n";
echo "<td>$affil</td>\n";
}
echo "<td>$idle</td>\n"; echo "<td>$idle</td>\n";
echo "<td>$expt_count</td>\n"; echo "<td>$expt_count</td>\n";
echo "<td>$ecount</td>\n"; echo "<td>$ecount</td>\n";
echo "<td>$ncount</td>\n"; echo "<td>$ncount</td>\n";
echo "<td>$pcount</td>\n"; echo "<td>$pcount</td>\n";
if ($isadmin) { if ($isadmin && $showtype != "ProtoGENI") {
if ($public) { if ($public) {
echo "<td align=center><img alt='Y' src='greenball.gif'></td>"; echo "<td align=center><img alt='Y' src='greenball.gif'></td>";
} }
...@@ -251,7 +288,7 @@ if (! $isadmin) { ...@@ -251,7 +288,7 @@ if (! $isadmin) {
GENPLIST($query_result); GENPLIST($query_result);
} }
else { else {
if ($splitview) { if ($showtype == "Splitview") {
$query_result = $query_result =
DBQueryFatal("SELECT p.*, ". DBQueryFatal("SELECT p.*, ".
"IF(p.expt_last, ". "IF(p.expt_last, ".
...@@ -285,6 +322,39 @@ else { ...@@ -285,6 +322,39 @@ else {
} }
} }
elseif ($showtype == "Active") {
$query_result =
DBQueryFatal("select p.*, ".
"IF(p.expt_last, ".
" TO_DAYS(CURDATE()) - TO_DAYS(p.expt_last), ".
" TO_DAYS(CURDATE()) - TO_DAYS(p.created)) as idle ".
" FROM projects as p ".
"left join project_stats as s ".
" on s.pid_idx=p.pid_idx ".
"where (UNIX_TIMESTAMP(now()) - ".
" UNIX_TIMESTAMP(s.last_activity)) < ".
" (24 * 3600 * 90) ".
"group by p.pid order by p.pid");
if (mysql_num_rows($query_result)) {
GENPLIST($query_result);
}
}
elseif ($showtype == "ProtoGENI") {
$query_result =
DBQueryFatal("select p.*, ".
"IF(p.expt_last, ".
" TO_DAYS(CURDATE()) - TO_DAYS(p.expt_last), ".
" TO_DAYS(CURDATE()) - TO_DAYS(p.created)) as idle ".
" FROM projects as p ".
"where nonlocal_type is not null and ".
" nonlocal_type='protogeni' ".
"group by p.pid order by p.pid");
if (mysql_num_rows($query_result)) {
GENPLIST($query_result);
}
}
else { else {
$query_result = $query_result =
DBQueryFatal("select p.*, ". DBQueryFatal("select p.*, ".
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment