All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

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

Add "ProtoGeni" display modes.

parent e788fd7a
<?php
#
# 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.
#
include("defs.php3");
......@@ -30,6 +30,7 @@ $clause = 0;
$having = "";
$active = 0;
$idle = 0;
$protogeni = 0;
#
# Hack for NSDI deadline. Generalize later.
......@@ -79,6 +80,12 @@ if ($isadmin) {
} else {
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") {
......@@ -129,6 +136,12 @@ elseif ((!strcmp($showtype, "idle")) && $isadmin ) {
$idle = 1;
$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 {
# See active above
$title = "Active";
......@@ -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,
(unix_timestamp(now()) - unix_timestamp(max(greatest(
last_tty_act,last_net_act,last_cpu_act,last_ext_act)))) as idlesec,
(max(last_report) is not null) as canbeidle, s.rsrcidx
from experiments as e
(max(last_report) is not null) as canbeidle, s.rsrcidx, p.nonlocal_id
from experiments as e
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 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 projects as p on p.pid_idx=e.pid_idx
$openlist_join
where (n.type!='dnard' or n.type is null) $clause $openlist_clause
group by e.pid,e.eid $having order by $order");
......@@ -284,8 +298,7 @@ where (n.type!='dnard' or n.type is null) and
group by e.pid,e.eid $having order by $order");
}
if (! mysql_num_rows($experiments_result)) {
USERERROR("There are no experiments running in any of the projects ".
"you are a member of.", 1);
USERERROR("There are no experiments running that match the criteria.", 1);
}
if (mysql_num_rows($experiments_result)) {
......@@ -375,17 +388,25 @@ if ($thumb && !$idle) {
$pid = $row["pid"];
$eid = $row["eid"];
$huid = $row["expt_head_uid"];
$sidx = $row["swapper_idx"];
$name = stripslashes($row["expt_name"]);
$date = $row["dshort"];
$rsrcidx = $row["rsrcidx"];
$state= $row["state"];
if (! ($head_user = User::Lookup($huid))) {
TBERROR("Could not lookup object for user $huid", 1);
if ($state == "active" && isset($sidx)) {
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);
$head_affil = $head_user->affil_abbrev();
$head_affil_text = $head_affil ? "&nbsp;($head_affil)" : "";
$showuser_url = CreateURL("showuser", $user);
$user_affil = $user->affil_abbrev();
$user_affil_text = $user_affil ? "&nbsp;($user_affil)" : "";
if ($idle && ($str=="&nbsp;" || !$pcs)) { continue; }
......@@ -448,7 +469,7 @@ if ($thumb && !$idle) {
}
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";
$special = 0;
......@@ -489,48 +510,55 @@ if ($thumb && !$idle) {
echo "<table border=2 cols=0
cellpadding=0 cellspacing=2 align=center>
<tr>
<th width=8%>
<a class='static' href='showexp_list.php3?showtype=$showtype&sortby=pid$ni'>
<th >
<a class='static'
href='showexp_list.php3?showtype=$showtype&sortby=pid$ni'>
PID</a></th>
<th width=8%>
<a class='static' href='showexp_list.php3?showtype=$showtype&sortby=eid$ni'>
<th >
<a class='static'
href='showexp_list.php3?showtype=$showtype&sortby=eid$ni'>
EID</a></th>
<th align=center width=3%>
<a class='static' href='showexp_list.php3?showtype=$showtype&sortby=pcs$ni'>
<th align=center >
<a class='static'
href='showexp_list.php3?showtype=$showtype&sortby=pcs$ni'>
PCs</a> [1]</th>
<th align=center width=3%>
<a class='static' href='showexp_list.php3?showtype=$showtype&sortby=idle$ni'>
Hours Idle</a> [2]</th>\n";
<th align=center >
<a class='static'
href='showexp_list.php3?showtype=$showtype&sortby=idle$ni'>
Hours Idle</a> [2]</th>\n";
if ($showlastlogin)
echo "<th width=17% align=center>Last Login</th>\n";
echo "<th align=center>Last Login</th>\n";
if ($idle) {
#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) {
echo "<th width=60%>
if (! ($openlist_member || $protogeni)) {
echo "<th >
<a class='static' ".
"href='showexp_list.php3?showtype=$showtype".
"&sortby=name$ni'>Description</a></th>\n";
}
echo " <th width=4%>
echo " <th >
<a class='static' ".
"href='showexp_list.php3?showtype=$showtype&sortby=uid$ni'>
Head UID</a></th>
Creator/<br>Swapper</a></th>
</tr>\n";
while ($row = mysql_fetch_array($experiments_result)) {
$pid = $row["pid"];
$eid = $row["eid"];
$huid = $row["expt_head_uid"];
$sidx = $row["swapper_idx"];
$name = stripslashes($row["expt_name"]);
$date = $row["dshort"];
$state= $row["state"];
$ignore = $row['idle_ignore'];
$idlesec= $row["idlesec"];
$swapreqs = $row["swap_requests"];
$nonlocal_id = $row["nonlocal_id"];
$nonlocal_user_id = $row["nonlocal_user_id"];
$isidle = ($idlesec >= 3600*$idlehours);
$daysidle=0;
$idletime = ($idlesec > 300 ? round($idlesec/3600,1) : 0);
......@@ -542,13 +570,19 @@ if ($thumb && !$idle) {
}
$stale = $experiment->IdleStale();
if (! ($head_user = User::Lookup($huid))) {
TBERROR("Could not lookup object for user $huid", 1);
if ($state == "active" && isset($sidx)) {
if (! ($user = User::Lookup($sidx))) {
TBERROR("Could not lookup object for user $sidx", 1);
}
}
$showuser_url = CreateURL("showuser", $head_user);
$head_affil = $head_user->affil_abbrev();
$head_affil_text = $head_affil ? "&nbsp;($head_affil)" : "";
else {
if (! ($user = User::Lookup($huid))) {
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) {
$swapreqs = "";
......@@ -664,7 +698,15 @@ if ($thumb && !$idle) {
if ($nodes==0) { $nodes = "&nbsp;"; }
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'>
$eid</A></td>\n";
......@@ -696,11 +738,15 @@ if ($thumb && !$idle) {
if ($showlastlogin) echo "$lastlogin\n";
if ($idle) echo "$foo\n";
if (! $openlist_member) {
if (! ($openlist_member || $protogeni)) {
echo "<td>$name</td>\n";
}
echo "<td><A href='$showuser_url'>$huid</A>$head_affil_text</td>\n";
if ($protogeni) {
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 "</table>\n";
......
<?php
#
# 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.
#
include("defs.php3");
......@@ -16,36 +16,61 @@ $isadmin = ISADMIN();
#
# Verify page arguments
#
$optargs = OptionalPageArguments("splitview", PAGEARG_BOOLEAN);
$optargs = OptionalPageArguments("showtype", PAGEARG_STRING);
#
# Standard Testbed Header
#
PAGEHEADER("Project Information List");
#
# Admin users can see all projects, while normal users can only see
# 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 (! isset($showtype)) {
$showtype="Splitview";
}
if ($isadmin) {
if (! $splitview) {
echo "<b><a href='showproject_list.php3?splitview=1'>Split View</a>
</b><br>\n";
if ($isadmin) {
echo "<b>Show: ";
if ($showtype != "Active") {
echo "<a class='static'
href='showproject_list.php3?showtype=Active'>Active</a>, ";
}
else {
echo "<b><a href='showproject_list.php3'>Normal View</a>
</b><br>\n";
echo "Active, ";
}
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 =
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
# for admin vs non-admin. Thats handled in the project query below.
......@@ -116,17 +141,26 @@ if ($isadmin) {
#
$total_projects = mysql_num_rows($allproj_result);
$active_projects = 0;
$recently_active = 0;
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) {
$active_projects++;
}
if (time() - $last_activity < (24 * 3600 * 90)) {
$recently_active++;
}
}
$never_active = $total_projects - $active_projects;
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>
<td align=right><b>Been Active:</b></td>
<td align=left>$active_projects</td>
......@@ -144,7 +178,7 @@ if ($isadmin) {
function GENPLIST ($query_result)
{
global $isadmin, $splitview, $ecounts, $ncounts, $pcounts;
global $isadmin, $ecounts, $ncounts, $pcounts, $showtype;
$tablename = "SPL" . rand();
......@@ -155,18 +189,20 @@ function GENPLIST ($query_result)
echo "<th>PID</th>\n";
echo "<th>(Approved?) Description</th>\n";
echo "<th>Leader</th>\n";
echo "<th>Affil</th>\n";
if ($showtype != "ProtoGENI") {
echo "<th>Leader</th>\n";
echo "<th>Affil</th>\n";
}
echo "<th>Days<br>Idle</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>PCs</th>\n";
#
# Admin users get other fields.
#
if ($isadmin) {
if ($isadmin && $showtype != "ProtoGENI") {
echo "<th align=center>Pub?</th>\n";
}
echo "</tr>\n";
......@@ -200,17 +236,18 @@ function GENPLIST ($query_result)
else {
echo " <img alt='N' src='redball.gif'>\n";
}
echo " $Pname</td>
<td><A href='$showuser_url'>$headuid</A></td>\n";
echo "<td>$affil</td>\n";
echo " $Pname</td>";
if ($showtype != "ProtoGENI") {
echo "<td><A href='$showuser_url'>$headuid</A></td>\n";
echo "<td>$affil</td>\n";
}
echo "<td>$idle</td>\n";
echo "<td>$expt_count</td>\n";
echo "<td>$ecount</td>\n";
echo "<td>$ncount</td>\n";
echo "<td>$pcount</td>\n";
if ($isadmin) {
if ($isadmin && $showtype != "ProtoGENI") {
if ($public) {
echo "<td align=center><img alt='Y' src='greenball.gif'></td>";
}
......@@ -251,7 +288,7 @@ if (! $isadmin) {
GENPLIST($query_result);
}
else {
if ($splitview) {
if ($showtype == "Splitview") {
$query_result =
DBQueryFatal("SELECT p.*, ".
"IF(p.expt_last, ".
......@@ -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 {
$query_result =
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