Merge branch '2290-user-activity'
[arvados.git] / services / api / script / crunch-dispatch.rb
index a54e8acf726c55e91d98f54874674988f02d80a4..6df9a19d299a5a8a440a99866be774e0bbad9d4c 100755 (executable)
@@ -310,11 +310,11 @@ class Dispatcher
 
     jobrecord = Job.find_by_uuid(job_done.uuid)
     jobrecord.running = false
-    if jobrecord.finished_at == nil
-      jobrecord.finished_at = Time.now
-    end
+    jobrecord.finished_at ||= Time.now
+    # Don't set 'jobrecord.success = false' because if the job failed to run due to an
+    # issue with crunch-job or slurm, we want the job to stay in the queue.
     jobrecord.save!
-    
+
     # Invalidate the per-job auth token
     j_done[:job_auth].update_attributes expires_at: Time.now
 
@@ -368,8 +368,6 @@ class Dispatcher
     end
   end
 
-
-
   protected
 
   def did_recently(thing, min_interval)