[ARVADOS] updated: a4fc0448d97894d438fc770d7e5a890be8d8a01d

git at public.curoverse.com git at public.curoverse.com
Fri Sep 19 09:13:36 EDT 2014


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

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

    3898: set finished_at if nil when success is changed.

diff --git a/services/api/app/models/job.rb b/services/api/app/models/job.rb
index fd46a6f..649cb7c 100644
--- a/services/api/app/models/job.rb
+++ b/services/api/app/models/job.rb
@@ -290,6 +290,9 @@ class Job < ArvadosModel
       else
         self.state = Failed
       end
+      if !self.finished_at
+        self.finished_at = Time.now
+      end
       self.running = false
     elsif 'cancelled_at'.in? changed_attributes
       self.state = Cancelled
diff --git a/services/api/test/unit/job_test.rb b/services/api/test/unit/job_test.rb
index e924cdd..3731e04 100644
--- a/services/api/test/unit/job_test.rb
+++ b/services/api/test/unit/job_test.rb
@@ -164,10 +164,10 @@ class JobTest < ActiveSupport::TestCase
     [['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']]]],
-    [['running', true, [['state', 'Running']]], ['success', true, [['state', 'Complete'],['running', false]]]],
-    [['running', true, [['state', 'Running']]], ['success', 'false', [['state', 'Failed'],['running', false]]]],
-    [['running', true, [['state', 'Running']]], ['state', 'Complete', [['success', true],['running', false]]]],
-    [['running', true, [['state', 'Running']]], ['state', 'Failed', [['success', false],['running', false]]]],
+    [['running', true, [['state', 'Running']]], ['success', true, [['state', 'Complete'],['running', false],['finished_at', 'not_nil']]]],
+    [['running', true, [['state', 'Running']]], ['success', 'false', [['state', 'Failed'],['running', false],['finished_at', 'not_nil']]]],
+    [['running', true, [['state', 'Running']]], ['state', 'Complete', [['success', true],['running', false],['finished_at', 'not_nil']]]],
+    [['running', true, [['state', 'Running']]], ['state', 'Failed', [['success', false],['running', false],['finished_at', 'not_nil']]]],
     # potential migration cases
     [['state', nil, [['state', 'Queued']]]],
     [['state', nil, [['state', 'Queued']]], ['cancelled_at', Time.now, [['state', 'Cancelled']]]],

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list