3775: Fix crunch-job exit status: exit non-zero after "freeze"
authorTom Clegg <tom@curoverse.com>
Wed, 1 Oct 2014 03:49:11 +0000 (23:49 -0400)
committerTom Clegg <tom@curoverse.com>
Wed, 1 Oct 2014 03:49:11 +0000 (23:49 -0400)
path (which includes task failure, INT, TERM, etc.)

Also fix wrong todo list (and therefore todo count in progress stats)
after permanent task failure.

sdk/cli/bin/crunch-job

index f56099d1ad36d34024977ac0e4a8b9c1529c6a74..9c32d8e15a7929876d5f1b6f60d7ffc9dacb7615 100755 (executable)
@@ -877,15 +877,15 @@ Log (undef, "finish");
 
 save_meta();
 
-if ($job_has_uuid) {
-  if ($collated_output && $main::success) {
-    $Job->update_attributes('state' => 'Complete')
-  } else {
-    $Job->update_attributes('state' => 'Failed')
-  }
+my $final_state;
+if ($collated_output && $main::success) {
+  $final_state = 'Complete';
+} else {
+  $final_state = 'Failed';
 }
+$Job->update_attributes('state' => $final_state)
 
-exit ($Job->{'state'} != 'Complete' ? 1 : 0);
+exit (($final_state eq 'Complete') ? 0 : 1);
 
 
 
@@ -972,10 +972,8 @@ sub reapchildren
       $main::success = 0;
       $main::please_freeze = 1;
     }
-    else {
-      # Put this task back on the todo queue
-      push @jobstep_todo, $jobstepid;
-    }
+    # Put this task back on the todo queue
+    push @jobstep_todo, $jobstepid;
     $Job->{'tasks_summary'}->{'failed'}++;
   }
   else
@@ -1396,7 +1394,7 @@ sub freeze_if_want_freeze
     collate_output();
     cleanup();
     save_meta();
-    exit 0;
+    exit 1;
   }
 }