Commit e8653ab5 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Forgot to cleanup experiment record after an immediate experiment startup

fails. In batch mode, the daemon takes care of this, but in immediate mode
the parent script has exited, so it has to be done here.
parent 0e0653a8
......@@ -328,6 +328,12 @@ sub fatal()
exit($errorstat);
}
#
# Otherwise, we have to cleanup since we are disconnected from the
# wrapper script.
#
ExptCleanup();
#
# Send a message to the testbed list.
#
......@@ -360,3 +366,33 @@ sub tbendit()
print "tbend failed!\n";
}
}
sub ExptCleanup()
{
#
# Try to remove experiment directory. We allow for it not being there
# cause we often run the tb programs directly. We also allow for not
# having permission, in the case that an admin type is running this,
# in which case it won't be allowed cause of directory permissions. Thats
# okay since admin types should rarely end experiments in other projects.
#
print STDOUT "Removing experiment directory: $expt_path ... \n";
if (system("rm -rf $expt_path")) {
print "*** WARNING: Not able to remove experiment directory.\n";
print " Someone will need to do this by hand.\n";
}
#
# Remove all trace from the DB.
#
DBQueryWarn("DELETE from nsfiles ".
"WHERE eid='$eid' and pid='$pid'");
DBQueryWarn("DELETE from exppid_access ".
"WHERE exp_eid='$eid' and exp_pid='$pid'");
DBQueryWarn("DELETE from experiments ".
"WHERE eid='$eid' and pid='$pid'");
}
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