Commit fa3d78b7 authored by Leigh Stoller's avatar Leigh Stoller

More work on issue #422, almost ready for prime time.

parent 8d1d2ee7
...@@ -147,16 +147,7 @@ sub Lookup($$) ...@@ -147,16 +147,7 @@ sub Lookup($$)
# #
# Lookup existing aggregates. # Lookup existing aggregates.
# #
my $aggregates = APT_Instance::Aggregate->LookupForInstance($self); $self->{'AGGREGATES'} = APT_Instance::Aggregate->LookupForInstance($self);
if (!keys(%{$aggregates}) && defined($self->aggregate_urn())) {
#
# Make up a fake one; eventually the old ones will die or
# I will create entries for them. Not worrying about it now.
#
$aggregates = {$self->aggregate_urn() =>
APT_Instance::Aggregate->GenTemp($self)};
}
$self->{'AGGREGATES'} = $aggregates;
# Add to cache. # Add to cache.
$instances{$self->uuid()} = $self; $instances{$self->uuid()} = $self;
......
...@@ -877,8 +877,7 @@ foreach my $aggregate_urn (@aggregate_urns) { ...@@ -877,8 +877,7 @@ foreach my $aggregate_urn (@aggregate_urns) {
# We do not do this if the experiment start is deferred. # We do not do this if the experiment start is deferred.
if (!defined($start_at)) { if (!defined($start_at)) {
if ($aptaggregate->CheckStatus(\$errmsg)) { if ($aptaggregate->CheckStatus(\$errmsg)) {
if ($usestitcher || scalar(@aggregate_urns) == 1 || if ($usestitcher || !$aptaggregate->deferrable()) {
!$aptaggregate->deferrable()) {
$slice->Delete(); $slice->Delete();
$instance->Delete(); $instance->Delete();
UserError($errmsg); UserError($errmsg);
......
...@@ -150,6 +150,8 @@ my $instance = APT_Instance->Lookup($ARGV[0]); ...@@ -150,6 +150,8 @@ my $instance = APT_Instance->Lookup($ARGV[0]);
if (!defined($instance)) { if (!defined($instance)) {
fatal("No such instance"); fatal("No such instance");
} }
my $webtask = $instance->webtask();
my $webtask_id = $webtask->task_id();
my $genislice = $instance->GetGeniSlice(); my $genislice = $instance->GetGeniSlice();
if (!defined($genislice)) { if (!defined($genislice)) {
fatal("Could not get genislice for $instance\n"); fatal("Could not get genislice for $instance\n");
...@@ -169,28 +171,56 @@ else { ...@@ -169,28 +171,56 @@ else {
# that is already being worked on. # that is already being worked on.
# #
foreach my $agg ($instance->AggregateList()) { foreach my $agg ($instance->AggregateList()) {
my $aptagg = $agg->GetAptAggregate();
next next
if (! ($agg->status() eq "created" || $agg->status() eq "deferred")); if (! ($agg->status() eq "created" || $agg->status() eq "deferred"));
# Coming from create_instance.
if ($agg->status() eq "created") {
push(@aggregate_list, $agg);
next;
}
# #
# See if the aggregate is back online, lets not go to a ton of # See if the aggregate is online, lets not go to a ton of trouble
# trouble if the aggregate is still dead. # if the aggregate is dead.
# #
if ($agg->GetAptAggregate()->CheckStatus(\$errmsg)) { if ($aptagg->CheckStatus(\$errmsg)) {
print STDERR "$errmsg\n"; print STDERR "$errmsg\n";
#
# If the cluster is not deferrable, then its an error and the
# instance has failed.
#
if (!$aptagg->deferrable()) {
$instance->SetStatus("failed");
if (defined($webtask)) {
$webtask->output($errmsg);
$webtask->Exited(1);
}
$instance->RecordError(1, $errmsg);
exit(1);
}
# Mark as deferred (it might still be "created" if not scheduled).
$agg->SetStatus("deferred")
if ($agg->status() eq "created");
next; next;
} }
push(@aggregate_list, $agg); push(@aggregate_list, $agg);
# We send email when all deferred aggregates are started. #
$sendemail = 1; # We send email when all deferred aggregates are started. Note
# that if the status is still "created", we are coming from
# create_instance() (not a scheduled experiment), so do not send
# email, no need to since the user is looking at the web interface.
#
$sendemail = 1
if ($instance->status() ne "created");
} }
if (!@aggregate_list) { if (!@aggregate_list) {
print "No uncreated aggregates to process.\n"; print "No uncreated aggregates to process.\n";
#
# If not a scheduled experiment, we need to set the instance status
# to something that makes sense for the web interface since we were
# not able to start anything at all. Later, if we get some started,
#
if ($instance->status() eq "created") {
$instance->SetStatus("pending");
}
$genislice->UnLock(); $genislice->UnLock();
exit(0); exit(0);
} }
...@@ -204,8 +234,6 @@ my $slice_urn = $genislice->urn(); ...@@ -204,8 +234,6 @@ my $slice_urn = $genislice->urn();
my $uuid = $instance->uuid(); my $uuid = $instance->uuid();
my $project = $instance->GetProject(); my $project = $instance->GetProject();
my $rspecstr = $instance->rspec(); my $rspecstr = $instance->rspec();
my $webtask = $instance->webtask();
my $webtask_id = $webtask->task_id();
$webtask->AutoStore(1); $webtask->AutoStore(1);
# #
......
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