[ARVADOS] created: ed8493bae19f584ef04952a81db195b57320189f

git at public.curoverse.com git at public.curoverse.com
Mon Mar 17 13:49:12 EDT 2014


        at  ed8493bae19f584ef04952a81db195b57320189f (commit)


commit ed8493bae19f584ef04952a81db195b57320189f
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Mon Mar 17 13:49:06 2014 -0400

    * Allow the system user to update job columns, even if the job is "locked"
    * Once the job process completes, automatically mark "job.running = false" and set "job.finished_at" if not set
    * Exclude jobs from the queue where the "success" field is already set
    * Consider a pipeline to be failed if any of the component jobs are marked as failed

diff --git a/sdk/cli/bin/arv-run-pipeline-instance b/sdk/cli/bin/arv-run-pipeline-instance
index 91d7192..67fdd5f 100755
--- a/sdk/cli/bin/arv-run-pipeline-instance
+++ b/sdk/cli/bin/arv-run-pipeline-instance
@@ -559,11 +559,14 @@ class WhRunPipelineInstance
           if c[:job][:success] == true
             succeeded += 1
           end
+          if c[:job][:success] == false
+            failed += 1
+          end
         end
       end
     end
     
-    if ended == @components.length
+    if ended == @components.length or failed > 0
       @instance[:active] = false
       @instance[:success] = (succeeded == @components.length)
     end
diff --git a/services/api/app/controllers/arvados/v1/jobs_controller.rb b/services/api/app/controllers/arvados/v1/jobs_controller.rb
index a715d0e..b7b0e67 100644
--- a/services/api/app/controllers/arvados/v1/jobs_controller.rb
+++ b/services/api/app/controllers/arvados/v1/jobs_controller.rb
@@ -145,7 +145,8 @@ class Arvados::V1::JobsController < ApplicationController
     @where.merge!({
                     started_at: nil,
                     is_locked_by_uuid: nil,
-                    cancelled_at: nil
+                    cancelled_at: nil,
+                    success: nil
                   })
     params[:order] ||= 'priority desc, created_at'
     find_objects_for_index
diff --git a/services/api/app/models/job.rb b/services/api/app/models/job.rb
index 9c8f724..1f0ef75 100644
--- a/services/api/app/models/job.rb
+++ b/services/api/app/models/job.rb
@@ -51,8 +51,8 @@ class Job < ArvadosModel
   end
 
   def self.queue
-    self.where('started_at is ? and is_locked_by_uuid is ? and cancelled_at is ?',
-               nil, nil, nil).
+    self.where('started_at is ? and is_locked_by_uuid is ? and cancelled_at is ? and success is ?',
+               nil, nil, nil, nil).
       order('priority desc, created_at')
   end
 
@@ -108,7 +108,8 @@ class Job < ArvadosModel
 
   def permission_to_update
     if is_locked_by_uuid_was and !(current_user and
-                                   current_user.uuid == is_locked_by_uuid_was)
+                                   (current_user.uuid == is_locked_by_uuid_was or
+                                    current_user.uuid == system_user.uuid))
       if script_changed? or
           script_parameters_changed? or
           script_version_changed? or
diff --git a/services/api/script/crunch-dispatch.rb b/services/api/script/crunch-dispatch.rb
index 693dfbd..a54e8ac 100755
--- a/services/api/script/crunch-dispatch.rb
+++ b/services/api/script/crunch-dispatch.rb
@@ -298,7 +298,6 @@ class Dispatcher
     job_done = j_done[:job]
     $stderr.puts "dispatch: child #{pid_done} exit"
     $stderr.puts "dispatch: job #{job_done.uuid} end"
-    $redis.publish job_done.uuid, "end"
 
     # Ensure every last drop of stdout and stderr is consumed
     read_pipes
@@ -309,9 +308,18 @@ class Dispatcher
     # Wait the thread
     j_done[:wait_thr].value
 
+    jobrecord = Job.find_by_uuid(job_done.uuid)
+    jobrecord.running = false
+    if jobrecord.finished_at == nil
+      jobrecord.finished_at = Time.now
+    end
+    jobrecord.save!
+    
     # Invalidate the per-job auth token
     j_done[:job_auth].update_attributes expires_at: Time.now
 
+    $redis.publish job_done.uuid, "end"
+
     @running.delete job_done.uuid
   end
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list