Commit f72b31aa authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Add experiment lock/unlock (expt_locked) routines.

parent 88b42cc0
......@@ -70,7 +70,7 @@ use Exporter;
DBQuoteSpecial UNIX2DBUID ExpState SetExpState ProjLeader
ExpNodes DBDateTime DefaultImageID GroupLeader TBGroupUnixInfo
TBValidNodeLogType TBValidNodeName TBSetNodeLogEntry
TBSetSchedReload MapNodeOSID
TBSetSchedReload MapNodeOSID TBLockExp TBUnLockExp
);
# Must come after package declaration!
......@@ -749,6 +749,50 @@ sub SetExpState($$$)
return 1;
}
#
# Lock Experiment.
#
# usage: TBLockExp(char *pid, char *eid)
# returns 1 if okay.
# returns 0 if an invalid pid/eid or if an error.
#
sub TBLockExp($$)
{
my($pid, $eid) = @_;
my $query_result =
DBQueryWarn("update experiments set expt_locked=now() ".
"where eid='$eid' and pid='$pid'");
if (! $query_result ||
$query_result->numrows == 0) {
return 0;
}
return 1;
}
#
# UnLock Experiment.
#
# usage: TBUnLockExp(char *pid, char *eid)
# returns 1 if okay.
# returns 0 if an invalid pid/eid or if an error.
#
sub TBUnLockExp($$)
{
my($pid, $eid) = @_;
my $query_result =
DBQueryWarn("update experiments set expt_locked=NULL ".
"where eid='$eid' and pid='$pid'");
if (! $query_result ||
$query_result->numrows == 0) {
return 0;
}
return 1;
}
#
# Return BatchMode state.
#
......
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