Commit 7473dadb authored by Mac Newbold's avatar Mac Newbold
Browse files

Add toggle for idle_ignore (admins only).

parent 14ed7b52
...@@ -544,6 +544,7 @@ function SHOWEXP($pid, $eid) { ...@@ -544,6 +544,7 @@ function SHOWEXP($pid, $eid) {
$batchstate = $exprow[batchstate]; $batchstate = $exprow[batchstate];
$priority = $exprow[priority]; $priority = $exprow[priority];
$swappable = $exprow[swappable]; $swappable = $exprow[swappable];
$idle_ignore = $exprow[idle_ignore];
$swapreqs = $exprow[swap_requests]; $swapreqs = $exprow[swap_requests];
$lastswapreq = $exprow[last_swap_req]; $lastswapreq = $exprow[last_swap_req];
$nodes = $exprow["count(r.node_id)"]; $nodes = $exprow["count(r.node_id)"];
...@@ -555,6 +556,15 @@ function SHOWEXP($pid, $eid) { ...@@ -555,6 +556,15 @@ function SHOWEXP($pid, $eid) {
else else
$swappable = "No $swappable = "No
<a href=\"toggle.php?type=swappable&value=1&pid=$pid&eid=$eid\"> <a href=\"toggle.php?type=swappable&value=1&pid=$pid&eid=$eid\">
<img src=\"redball.gif\" border=0 alt=\"Toggle\"></a>";
if ($idle_ignore)
$idle_ignore = "Yes
<a href=\"toggle.php?type=idle_ignore&value=0&pid=$pid&eid=$eid\">
<img src=\"greenball.gif\" border=0 alt=\"Toggle\"></a>";
else
$idle_ignore = "No
<a href=\"toggle.php?type=idle_ignore&value=1&pid=$pid&eid=$eid\">
<img src=\"redball.gif\" border=0 alt=\"Toggle\"></a>"; <img src=\"redball.gif\" border=0 alt=\"Toggle\"></a>";
# #
...@@ -615,6 +625,15 @@ function SHOWEXP($pid, $eid) { ...@@ -615,6 +625,15 @@ function SHOWEXP($pid, $eid) {
<td class=\"left\">$swappable</td> <td class=\"left\">$swappable</td>
</tr>\n"; </tr>\n";
# XXX: isadmin doesn't use the uid you give it, and we don't have a real
# uid to send here. so just make something up to match the prototype.
if (isadmin(123)) {
echo "<tr>
<td>Idle Ignore:</td>
<td class=\"left\">$idle_ignore</td>
</tr>\n";
}
echo "<tr> echo "<tr>
<td>Priority: (0 is highest) </td> <td>Priority: (0 is highest) </td>
<td class=\"left\">$priority</td> <td class=\"left\">$priority</td>
......
...@@ -29,11 +29,12 @@ LOGGEDINORDIE($uid); ...@@ -29,11 +29,12 @@ LOGGEDINORDIE($uid);
# (type & value are required, others are optional and vary by type) # (type & value are required, others are optional and vary by type)
# List of valid toggles # List of valid toggles
$toggles = array("adminoff", "swappable"); $toggles = array("adminoff", "swappable", "idle_ignore");
# list of valid values for each toggle # list of valid values for each toggle
$values = array("adminoff" => array(0,1), $values = array("adminoff" => array(0,1),
"swappable" => array(0,1) ); "swappable" => array(0,1),
"idle_ignore" => array(0,1) );
if (! in_array($type, $toggles)) { if (! in_array($type, $toggles)) {
USERERROR("There is no toggle for $type!", 1); USERERROR("There is no toggle for $type!", 1);
...@@ -70,6 +71,20 @@ if ($type=="adminoff") { ...@@ -70,6 +71,20 @@ if ($type=="adminoff") {
DBQueryFatal("update experiments set swappable=$value ". DBQueryFatal("update experiments set swappable=$value ".
"where pid='$pid' and eid='$eid'"); "where pid='$pid' and eid='$eid'");
} elseif ($type=="idle_ignore") {
# must be admin
if (! ($CHECKLOGIN_STATUS & CHECKLOGIN_ISADMIN)) {
USERERROR("You do not have permission to toggle $type!", 1);
}
# require pid/eid
if (!isset($pid) || !isset($eid) ||
!TBValidExperiment($pid, $eid)) {
USERERROR("Experiment '$pid/$eid' is not valid!", 1);
}
DBQueryFatal("update experiments set idle_ignore=$value ".
"where pid='$pid' and eid='$eid'");
#} elseif ($type=="foo") { #} elseif ($type=="foo") {
# Add more here... # Add more here...
# #
......
Supports Markdown
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