[ARVADOS] created: 3e1ef3ebc922bd386566b6e75adf01003a2c3c96

git at public.curoverse.com git at public.curoverse.com
Fri Nov 7 08:54:13 EST 2014


        at  3e1ef3ebc922bd386566b6e75adf01003a2c3c96 (commit)


commit 3e1ef3ebc922bd386566b6e75adf01003a2c3c96
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Nov 7 08:53:55 2014 -0500

    4310: Lock job before changing its state to failed.

diff --git a/services/api/script/crunch-dispatch.rb b/services/api/script/crunch-dispatch.rb
index 5d9323a..2be89c5 100755
--- a/services/api/script/crunch-dispatch.rb
+++ b/services/api/script/crunch-dispatch.rb
@@ -202,9 +202,15 @@ class Dispatcher
     rescue
       $stderr.puts "dispatch: log.create failed"
     end
-    job.state = "Failed"
-    if not job.save
-      $stderr.puts "dispatch: job.save failed"
+
+    begin
+      job.lock @authorizations[job.uuid].user.uuid
+      job.state = "Failed"
+      if not job.save
+        $stderr.puts "dispatch: save failed setting job #{job.uuid} to failed"
+      end
+    rescue AlreadyLockedError
+      $stderr.puts "dispatch: tried to mark job #{job.uuid} as failed but it was already locked by someone else"
     end
   end
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list