[ARVADOS] updated: d592a37f987ed90e017bc9d2d962a2f620e27095

git at public.curoverse.com git at public.curoverse.com
Fri Sep 26 09:49:04 EDT 2014


Summary of changes:
 services/api/script/crunch-dispatch.rb | 26 ++++++++------------------
 1 file changed, 8 insertions(+), 18 deletions(-)

       via  d592a37f987ed90e017bc9d2d962a2f620e27095 (commit)
       via  22c3f131e929bef5574ef71a98bc48290c36dfb3 (commit)
      from  1d8f975be8d35444aca0f21a0b6c91bc4a277662 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit d592a37f987ed90e017bc9d2d962a2f620e27095
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Sep 26 09:48:58 2014 -0400

    Remove useless take() and untake() methods.

diff --git a/services/api/script/crunch-dispatch.rb b/services/api/script/crunch-dispatch.rb
index bab9f4e..30fcd9d 100755
--- a/services/api/script/crunch-dispatch.rb
+++ b/services/api/script/crunch-dispatch.rb
@@ -222,8 +222,6 @@ class Dispatcher
         raise "Unknown crunch_job_wrapper: #{Server::Application.config.crunch_job_wrapper}"
       end
 
-      next if !take(job)
-
       if Server::Application.config.crunch_job_user
         cmd_args.unshift("sudo", "-E", "-u",
                          Server::Application.config.crunch_job_user,
@@ -239,7 +237,6 @@ class Dispatcher
             api_client_id: 0)
       if not job_auth.save
         $stderr.puts "dispatch: job_auth.save failed"
-        untake job
         next
       end
 
@@ -262,7 +259,6 @@ class Dispatcher
         if not File.exists? src_repo
           $stderr.puts "dispatch: No #{job.repository}.git or #{job.repository}/.git at #{repo_root}"
           sleep 1
-          untake job
           next
         end
       end
@@ -279,7 +275,6 @@ class Dispatcher
         unless $? == 0
           $stderr.puts "dispatch: git fetch-pack failed"
           sleep 1
-          untake job
           next
         end        
       end
@@ -294,7 +289,6 @@ class Dispatcher
         unless $? == 0
           $stderr.puts "dispatch: git tag failed"
           sleep 1
-          untake job
           next
         end
       else
@@ -306,7 +300,6 @@ class Dispatcher
           job.state = "Failed"
           if not job.save
             $stderr.puts "dispatch: job.save failed"
-            untake job
             next
           end
           next
@@ -328,7 +321,6 @@ class Dispatcher
       rescue
         $stderr.puts "dispatch: popen3: #{$!}"
         sleep 1
-        untake(job)
         next
       end
 
@@ -357,16 +349,6 @@ class Dispatcher
     end
   end
 
-  def take(job)
-    # no-op -- let crunch-job take care of locking.
-    true
-  end
-
-  def untake(job)
-    # no-op -- let crunch-job take care of locking.
-    true
-  end
-
   def read_pipes
     @running.each do |job_uuid, j|
       job = j[:job]

commit 22c3f131e929bef5574ef71a98bc48290c36dfb3
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Fri Sep 26 09:47:52 2014 -0400

    3168: Instead of crashing using save! log an error and go to the next job.

diff --git a/services/api/script/crunch-dispatch.rb b/services/api/script/crunch-dispatch.rb
index 53979f2..bab9f4e 100755
--- a/services/api/script/crunch-dispatch.rb
+++ b/services/api/script/crunch-dispatch.rb
@@ -237,7 +237,11 @@ class Dispatcher
       job_auth = ApiClientAuthorization.
         new(user: User.where('uuid=?', job.modified_by_user_uuid).first,
             api_client_id: 0)
-      job_auth.save!
+      if not job_auth.save
+        $stderr.puts "dispatch: job_auth.save failed"
+        untake job
+        next
+      end
 
       crunch_job_bin = (ENV['CRUNCH_JOB_BIN'] || `which arv-crunch-job`.strip)
       if crunch_job_bin == ''
@@ -300,7 +304,11 @@ class Dispatcher
           # Someone has been monkeying with the job record and/or git.
           $stderr.puts "dispatch: Already a tag #{job.script_version} pointing to commit #{tag_rev} but expected commit #{job.script_version}"
           job.state = "Failed"
-          job.save!
+          if not job.save
+            $stderr.puts "dispatch: job.save failed"
+            untake job
+            next
+          end
           next
         end
       end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list