Commit 4528e30c authored by Leigh B. Stoller's avatar Leigh B. Stoller

Small bug fixes.

parent a17b24d0
......@@ -98,6 +98,7 @@ sub Lookup($$$)
}
# accessors
sub field($$) { return ((! ref($_[0])) ? -1 : $_[0]->{'EXPT'}->{$_[1]}); }
sub stats($$) { return ((! ref($_[0])) ? -1 : $_[0]->{'STATS'}->{$_[1]}); }
sub pid($) { return field($_[0], 'pid'); }
sub gid($) { return field($_[0], 'gid'); }
......@@ -107,7 +108,7 @@ sub path($) { return field($_[0], 'path'); }
sub state($) { return field($_[0], 'state'); }
sub batchstate($) { return field($_[0], 'batchstate'); }
sub batchmode($) { return field($_[0], 'batchmode'); }
sub rsrcidx($) { return field($_[0], 'rsrcidx'); }
sub rsrcidx($) { return stats($_[0], 'rsrcidx'); }
sub creator($) { return field($_[0], 'expt_head_uid');}
sub canceled($) { return field($_[0], 'canceled'); }
sub locked($) { return field($_[0], 'expt_locked'); }
......@@ -125,6 +126,7 @@ sub autoswap_timeout($) { return field($_[0], 'autoswap_timeout');}
sub prerender_pid($) { return field($_[0], 'prerender_pid');}
sub dpdb($) { return field($_[0], 'dpdb');}
sub dpdbname($) { return field($_[0], 'dpdbname');}
sub instance_idx($) { return field($_[0], 'instance_idx'); }
#
# Lookup an experiment given an experiment index.
......@@ -188,6 +190,7 @@ sub Create($$$$)
{
my ($class, $pid, $eid, $argref) = @_;
my $exptidx;
my $now = time();
return undef
if (ref($class));
......@@ -303,7 +306,8 @@ sub Create($$$$)
join(",", map("$_='" . $argref->{$_} . "'", keys(%{$argref})));
# Append the rest
$query .= ",expt_created=now(),expt_locked=now(),pid='$pid',eid='$eid'";
$query .= ",expt_created=FROM_UNIXTIME('$now')";
$query .= ",expt_locked=now(),pid='$pid',eid='$eid'";
$query .= ",expt_name=$description";
$query .= ",noswap_reason=$noswap_reason";
$query .= ",noidleswap_reason=$noidleswap_reason";
......@@ -320,7 +324,7 @@ sub Create($$$$)
#
$query_result =
DBQueryWarn("insert into experiment_resources (tstamp, exptidx) ".
"values (now(), $exptidx)");
"values (FROM_UNIXTIME('$now'), $exptidx)");
if (!$query_result) {
DBQueryWarn("delete from experiments where pid='$pid' and eid='$eid'");
......@@ -339,7 +343,8 @@ sub Create($$$$)
if (! DBQueryWarn("insert into experiment_stats ".
"(eid, pid, creator, gid, created, ".
" batch, exptidx, rsrcidx) ".
"values('$eid', '$pid', '$creator', '$gid', now(), ".
"values('$eid', '$pid', '$creator', '$gid', ".
"FROM_UNIXTIME('$now'), ".
"$batchmode, $exptidx, $rsrcidx)")) {
DBQueryWarn("delete from experiments where pid='$pid' and eid='$eid'");
DBQueryWarn("delete from experiment_resources where idx=$rsrcidx");
......
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