[ARVADOS] updated: 3294cfcae73fe5b2cff051298b26076103251ca9

git at public.curoverse.com git at public.curoverse.com
Fri Sep 19 09:34:45 EDT 2014


Summary of changes:
 services/api/app/models/job.rb     | 3 +++
 services/api/test/unit/job_test.rb | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

       via  3294cfcae73fe5b2cff051298b26076103251ca9 (commit)
      from  a4fc0448d97894d438fc770d7e5a890be8d8a01d (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 3294cfcae73fe5b2cff051298b26076103251ca9
Author: radhika <radhika at curoverse.com>
Date:   Fri Sep 19 09:33:57 2014 -0400

    3898: if state is changed to Running and is_locked_by_uuid is nil, return validation error.

diff --git a/services/api/app/models/job.rb b/services/api/app/models/job.rb
index 649cb7c..e55308a 100644
--- a/services/api/app/models/job.rb
+++ b/services/api/app/models/job.rb
@@ -253,6 +253,9 @@ class Job < ArvadosModel
         self.running = false
         self.success = nil
       when Running
+        if !self.is_locked_by_uuid
+          return false
+        end
         if !self.started_at
           self.started_at = Time.now
         end
diff --git a/services/api/test/unit/job_test.rb b/services/api/test/unit/job_test.rb
index 3731e04..0563bc4 100644
--- a/services/api/test/unit/job_test.rb
+++ b/services/api/test/unit/job_test.rb
@@ -160,7 +160,8 @@ class JobTest < ActiveSupport::TestCase
     # Array of parameters where each parameter is of the format:
     #     attr name to be changed, attr value, (array of array of expectations OR the string "error")
     [['running', false, [['state', 'Queued']]]],
-    [['state', 'Running', [['running', true], ['started_at', 'not_nil'], ['success', 'nil']]]],
+    [['state', 'Running', 'error']],  # is_locked_by_uuid is not set
+    [['is_locked_by_uuid', 'use_current_user_uuid', [['state', 'Queued']]], ['state', 'Running', [['running', true], ['started_at', 'not_nil'], ['success', 'nil']]]],
     [['running', false, [['state', 'Queued']]], ['state', 'Complete', [['success', true]]]],
     [['running', true, [['state', 'Running']]], ['cancelled_at', Time.now, [['state', 'Cancelled'],['running', false]]]],
     [['running', true, [['state', 'Running']]], ['state', 'Cancelled', [['running', false],['cancelled_at', 'not_nil']]]],
@@ -182,6 +183,10 @@ class JobTest < ActiveSupport::TestCase
 
       parameters.each do |parameter|
         expectations = parameter[2]
+        if parameter[1] == 'use_current_user_uuid'
+          parameter[1] = Thread.current[:user].uuid
+        end
+
         if expectations.instance_of? Array
           job[parameter[0]] = parameter[1]
           job.save!

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list