Commit b987ddc8 authored by Mac Newbold's avatar Mac Newbold

Add a magical "edit mode" to the showexp page. Lets you change the expt

name, your idleswap time, and your unswappable/noidleswap reasons if
applicable. Also, make toggle send mail if people try to go unswappable or
turn off their idleswap bit.
parent c9f17226
......@@ -95,6 +95,9 @@ if ($expstate) {
WRITESUBMENUBUTTON("Terminate this Experiment",
"endexp.php3?pid=$exp_pid&eid=$exp_eid");
WRITESUBMENUBUTTON("Edit Experiment Meta-Data",
"showexp.php3?pid=$exp_pid&eid=$exp_eid&edit=1");
#
# Admin and project/experiment leader get this option.
#
......@@ -146,10 +149,25 @@ echo "<br>
SUBMENUEND_2B();
#
# Dump experiment record.
#
SHOWEXP($exp_pid, $exp_eid);
# if we got a submission of changes, update the db now...
if ($submit) {
# exp name is always sent...
$str = "expt_name=\"$exp_name\"";
if (isset($noswap) && $noswap !="") {
$str .= ",noswap_reason=\"$noswap\"";
}
if (isset($noidleswap) && $noidleswap !="") {
$str .= ",noidleswap_reason=\"$noidleswap\"";
}
if (isset($autoswap) && $autoswap !="" && $autoswap>0) {
$str .= ",autoswap_timeout=\"".(60*$autoswap)."\"";
}
DBQueryWarn("update experiments set $str where pid='$pid' and eid='$eid'");
}
# Dump (possibly updated) experiment record.
if (!isset($edit)) { $edit=0; }
SHOWEXP($exp_pid, $exp_eid, $edit);
SUBPAGEEND();
......
......@@ -520,7 +520,7 @@ function SHOWUSER($uid) {
#
# Show an experiment.
#
function SHOWEXP($pid, $eid) {
function SHOWEXP($pid, $eid, $edit=0) {
global $TBDBNAME, $TBDOCBASE;
$nodecounts = array();
......@@ -575,6 +575,24 @@ function SHOWEXP($pid, $eid) {
$lastswapreq = $exprow[last_swap_req];
$minnodes = $exprow["min_nodes"];
$autoswap_hrs= ($autoswap_timeout/60.0);
$idleswap_hrs= ($idleswap_timeout/60.0);
$idleswap_str= $idleswap_hrs." hour".($idleswap_hrs==1 ? "" : "s");
if ($edit) {
# make this a form too
echo "<form action=\"showexp.php3?pid=$pid&eid=$eid\" method=POST>\n";
$noswap = "Why: <input type=text ".
"name=noswap value=\"$noswap_reason\" size=30>";
$noidleswap = "Why: <input type=text ".
"name=noidleswap value=\"$noidleswap_reason\" size=30>";
$autoswap_str= "<input type=text size=2 name=autoswap ".
"value=\"$autoswap_hrs\"> hour".($autoswap_hrs==1 ? "" : "s");
} else {
$noswap = "(\"$noswap_reason\")";
$noidleswap = "(\"$noidleswap_reason\")";
$autoswap_str= $autoswap_hrs." hour".($autoswap_hrs==1 ? "" : "s");
}
if ($swappable)
$swappable = "Yes
<a href=\"toggle.php?type=swappable&value=0&pid=$pid&eid=$eid\">
......@@ -582,10 +600,8 @@ function SHOWEXP($pid, $eid) {
else
$swappable = "No
<a href=\"toggle.php?type=swappable&value=1&pid=$pid&eid=$eid\">
<img src=\"redball.gif\" border=0 alt=\"Toggle\"></a> (\"$noswap_reason\")";
<img src=\"redball.gif\" border=0 alt=\"Toggle\"></a> $noswap";
$idleswap_hrs= ($idleswap_timeout/60.0);
$idleswap_str= $idleswap_hrs." hour".($idleswap_hrs==1 ? "" : "s");
if ($idleswap)
$idleswap = "Yes
<a href=\"toggle.php?type=idleswap&value=0&pid=$pid&eid=$eid\">
......@@ -593,11 +609,8 @@ function SHOWEXP($pid, $eid) {
else
$idleswap = "No
<a href=\"toggle.php?type=idleswap&value=1&pid=$pid&eid=$eid\">
<img src=\"redball.gif\" border=0 alt=\"Toggle\"></a> ".
"(\"$noidleswap_reason\")";
<img src=\"redball.gif\" border=0 alt=\"Toggle\"></a> $noidleswap";
$autoswap_hrs= ($autoswap_timeout/60.0);
$autoswap_str= $autoswap_hrs." hour".($autoswap_hrs==1 ? "" : "s");
if ($autoswap)
$autoswap = "Yes
<a href=\"toggle.php?type=autoswap&value=0&pid=$pid&eid=$eid\">
......@@ -626,9 +639,14 @@ function SHOWEXP($pid, $eid) {
<td class=left>$eid</td>
</tr>\n";
if ($edit) {
$exp_name_str = "<input type=text name=exp_name value=\"$exp_name\">";
} else {
$exp_name_str = $exp_name;
}
echo "<tr>
<td>Long Name: </td>
<td class=\"left\">$exp_name</td>
<td class=\"left\">$exp_name_str</td>
</tr>\n";
echo "<tr>
......@@ -785,7 +803,16 @@ function SHOWEXP($pid, $eid) {
</tr>\n";
}
if ($edit) {
echo "<tr><td colspan=2 align=center>
<input type=submit name=submit value=\"Submit Changes\">
<input type=submit name=reset value=\"Reset\">
</td></tr>\n";
}
echo "</table>\n";
if ($edit) { echo "</form>\n"; }
}
#
......
......@@ -74,6 +74,20 @@ if ($type=="adminoff") {
DBQueryFatal("update experiments set $type=$value ".
"where pid='$pid' and eid='$eid'");
# Send mail on these changes...
if ($type!="autoswap" && $value=="0") {
TBMAIL($TBMAIL_OPS,"$pid/$eid swap settings changed",
"\nThe swap settings for $pid/$eid have changed.\n".
"\nThe $type bit has been cleared.\n".
"\nPlease check the reason they give, and change it ".
"if needed, by going to:\n\n".
"$TBBASE/showexp.php3?pid=$pid&eid=$eid\n\n".
"Thanks,\nTestbed WWW\n",
"From: $TBMAIL_OPS\n".
"Errors-To: $TBMAIL_WWW");
}
} elseif ($type=="idle_ignore") {
# must be admin
if (! ($CHECKLOGIN_STATUS & CHECKLOGIN_ISADMIN)) {
......
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