update running and finished_at attributes at completion
authorTom Clegg <tom@clinicalfuture.com>
Fri, 28 Jun 2013 14:29:41 +0000 (10:29 -0400)
committerTom Clegg <tom@clinicalfuture.com>
Fri, 28 Jun 2013 14:29:41 +0000 (10:29 -0400)
services/crunch/crunch-job

index 710fc0b0c8caa404eaa19dc865270f6ef6bd3e74..8c50ba6eaf5ab710537db8f5496077f0f90ec245 100755 (executable)
@@ -706,8 +706,11 @@ goto ONELEVEL if !defined $success;
 
 release_allocation();
 freeze();
+$Job->reload;
 $Job->{'output'} = &collate_output();
+$Job->{'running'} = 0;
 $Job->{'success'} = $Job->{'output'} && $success;
+$Job->{'finished_at'} = gmtime;
 $Job->save if $job_has_uuid;
 
 if ($Job->{'output'})
@@ -1108,11 +1111,11 @@ sub croak
 sub cleanup
 {
   return if !$job_has_uuid;
-  $Job->reload if $job_has_uuid;
+  $Job->reload;
   $Job->{'running'} = 0;
   $Job->{'success'} = 0;
   $Job->{'finished_at'} = gmtime;
-  $Job->save if $job_has_uuid;
+  $Job->save;
 }