6356: crunch-job doesn't create new tasks after job success is set.
authorBrett Smith <brett@curoverse.com>
Mon, 9 Nov 2015 13:30:14 +0000 (08:30 -0500)
committerBrett Smith <brett@curoverse.com>
Thu, 12 Nov 2015 20:30:51 +0000 (15:30 -0500)
#6356 reported that a permanently failed task was retried.  Note 3
discusses why this happened and suggests two fixes:

* Only put tempfailed task back on the todo list.
* Run `last THISROUND if $main::please_freeze || defined($main::success);`
  after we call reapchildren(), since it's the main place where the
  value of $main::success can change.

The first change would revert part of
75be7487c2bbd83aa5116aa5f8ade5ddf31501da, which intentionally puts
these tasks back on the todo list to get a correct tasks count.

The current `last if…` line was added in
b306eb48ab12676ffb365ede8197e4f2d7e92011, with the rationale "Don't
create new tasks if $main::success is defined."  This change corrects
the code to implement the desired functionality, by checking and
stopping just before we create a new task (functionally, at least).

sdk/cli/bin/crunch-job

index e2a4e264c3697e916ca8c88f98cf3a88d80e0e9a..f78824bf2f14c468a946160335537b4fd66b7702 100755 (executable)
@@ -820,6 +820,9 @@ update_progress_stats();
 THISROUND:
 for (my $todo_ptr = 0; $todo_ptr <= $#jobstep_todo; $todo_ptr ++)
 {
+  # Don't create new tasks if we already know the job's final result.
+  last if defined($main::success);
+
   my $id = $jobstep_todo[$todo_ptr];
   my $Jobstep = $jobstep[$id];
   if ($Jobstep->{level} != $level)
@@ -1018,7 +1021,7 @@ for (my $todo_ptr = 0; $todo_ptr <= $#jobstep_todo; $todo_ptr ++)
         ||
         ($round_num_freeslots > @freeslot && $todo_ptr+1 > $#jobstep_todo))
   {
-    last THISROUND if $main::please_freeze || defined($main::success);
+    last THISROUND if $main::please_freeze;
     if ($main::please_info)
     {
       $main::please_info = 0;