Commit 45eeacd6 authored by Leigh Stoller's avatar Leigh Stoller

Minor bug fixes.

parent 8631118c
......@@ -209,14 +209,18 @@ $SIG{TERM} = \&sighandler;
#
# Use the logonly option to audit so that we get a record mailed.
#
if (! ($foreground || $experiment->batchmode())) {
if (! $foreground) {
# Cleanup
$experiment->CleanLogFiles() == 0
or fatal(-1, "Could not clean up logfiles!");
$logname = TBExptCreateLogFile($pid, $eid, "swapin");
TBExptSetLogFile($pid, $eid, $logname);
TBExptOpenLogFile($pid, $eid);
# The batch daemon is going to set the current log file, so do not do it.
if (! $experiment->batchmode()) {
TBExptSetLogFile($pid, $eid, $logname);
TBExptOpenLogFile($pid, $eid);
}
if (my $childpid = AuditStart(LIBAUDIT_DAEMON, $logname,
LIBAUDIT_LOGONLY|LIBAUDIT_NODELETE|LIBAUDIT_FANCY)) {
......@@ -360,8 +364,6 @@ if ($experiment->batchmode()) {
if (! @ExptStates);
foreach my $state (@ExptStates) {
print "$state\n";
if ($state eq EXPTSTATE_ACTIVATING()) {
print "Experiment is starting a swapin attempt ...\n";
}
......@@ -383,10 +385,13 @@ if ($experiment->batchmode()) {
# Dumped out of the batch system for some reason.
print "Experiment has been removed from the batch queue.\n";
$instance->DeleteCurrentRun() == 0
or exit(-1);
#
# We are done; remove record of this attempt and exit.
# We are done. User has to requeue batched instance.
#
fatal(1, "Experiment has been removed from the batch queue");
exit(0);
}
}
}
......
......@@ -164,13 +164,18 @@ if (!defined($experiment)) {
fatal(-1, "Experiment $pid/$eid object could not be found!");
}
# Check for cancel.
# Check for cancel and dequeue.
if (! $batchmode) {
if ($experiment->state() eq EXPTSTATE_ACTIVATING) {
system("$swapexp -x -s out $pid $eid");
exit($? >> 8);
}
# Check for a pre-loaded instance (never active).
elsif ($experiment->batchmode() &&
$experiment->state() eq EXPTSTATE_QUEUED) {
# User wants to dequeue a batch experiment that is waiting to go.
system("$swapexp -x -s pause $pid $eid");
exit($? >> 8);
}
}
#
......
......@@ -90,9 +90,6 @@ $lockdown = $experiment->lockdown();
# Template Instance Experiments get special treatment in this page.
$instance = TemplateInstance::LookupByExptidx($exptidx);
if ($instance && ($inout != "out" && $inout != "in")) {
PAGEARGERROR("Invalid action for template instance");
}
# Convert inout to informative text.
if (!strcmp($inout, "in")) {
......@@ -119,6 +116,8 @@ elseif (!strcmp($inout, "pause")) {
$action = "dequeue";
}
elseif (!strcmp($inout, "restart")) {
if ($instance)
PAGEARGERROR("Invalid action for template instance");
$action = "restart";
}
......@@ -219,8 +218,9 @@ if ($instance) {
$guid = $instance->guid();
$version = $instance->vers();
STARTBUSY(($inout == "out" ? "Terminating" : "Starting") .
" template instance!");
STARTBUSY("Template Instance is");
if ($inout == "pause")
$inout = "out";
}
#
......@@ -269,10 +269,7 @@ if ($retval) {
echo "<blockquote><pre>$suexec_output<pre></blockquote>";
}
else {
if ($instance) {
STARTLOG($experiment);
}
elseif ($isbatch) {
if ($isbatch) {
if (strcmp($inout, "in") == 0) {
echo "Batch Mode experiments will be run when enough resources
become available. This might happen immediately, or it
......@@ -293,11 +290,14 @@ else {
please contact $TBMAILADDR.\n";
}
elseif (strcmp($inout, "pause") == 0) {
echo "Your experiment has been dequeued. You may requeue your
echo "Your experiment has been dequeued.
experiment at any time.\n";
}
STARTWATCHER($experiment);
}
elseif ($instance) {
STARTLOG($experiment);
}
else {
echo "<div>";
if (strcmp($inout, "out") == 0 &&
......
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