[ARVADOS] updated: d585a31fb1a2b2c4964ff2c8928a42358e8a060f

git at public.curoverse.com git at public.curoverse.com
Fri Sep 19 08:50:13 EDT 2014


Summary of changes:
 .../javascripts/{selection.js => selection.js.erb} |  12 +-
 apps/workbench/app/models/arvados_base.rb          |   6 +
 apps/workbench/app/models/group.rb                 |   4 +
 apps/workbench/app/views/application/show.html.erb |  39 ++++++
 apps/workbench/app/views/collections/show.html.erb |  18 ---
 .../app/views/pipeline_templates/show.html.erb     |   2 +-
 apps/workbench/app/views/projects/show.html.erb    |  18 ---
 .../workbench/test/integration/collections_test.rb |  19 ++-
 apps/workbench/test/integration/projects_test.rb   |   2 +-
 apps/workbench/test/integration_helper.rb          |   6 +-
 sdk/cli/bin/crunch-job                             |  22 ++-
 sdk/python/arvados/collection.py                   | 150 +++++++++++++--------
 sdk/python/arvados/commands/_util.py               |  12 ++
 sdk/python/arvados/commands/keepdocker.py          |  55 +++++---
 sdk/python/arvados/commands/put.py                 |  45 ++++---
 sdk/python/arvados/keep.py                         |  30 +++--
 sdk/python/arvados/retry.py                        |  18 +++
 sdk/python/arvados/stream.py                       |  68 ++++++----
 sdk/python/arvados/util.py                         |   4 +-
 sdk/python/bin/arv-get                             |  46 +++----
 sdk/python/bin/arv-ls                              |  21 +--
 sdk/python/setup.py                                |   2 +-
 sdk/python/tests/arvados_testutil.py               |  11 ++
 sdk/python/tests/test_arv_put.py                   |   8 +-
 sdk/python/tests/test_collections.py               | 143 +++++++++++++++++++-
 sdk/python/tests/test_keep_client.py               |  69 +++++-----
 sdk/python/tests/test_retry.py                     |  27 ++++
 sdk/python/tests/test_stream.py                    | 117 ++++++++++++++++
 services/api/app/models/job.rb                     |  21 ++-
 services/api/script/crunch-dispatch.rb             |  22 ++-
 services/api/test/unit/job_test.rb                 |  56 ++++++++
 services/fuse/arvados_fuse/__init__.py             | 108 +++++++++------
 services/fuse/bin/arv-mount                        |  66 ++++-----
 services/fuse/setup.py                             |   2 +-
 services/fuse/tests/test_mount.py                  |  12 +-
 35 files changed, 899 insertions(+), 362 deletions(-)
 rename apps/workbench/app/assets/javascripts/{selection.js => selection.js.erb} (96%)
 create mode 100644 sdk/python/tests/test_stream.py

       via  d585a31fb1a2b2c4964ff2c8928a42358e8a060f (commit)
       via  6d6ee07abb8892fb1e3f606c1347d18abc321ced (commit)
       via  9d724d2028cc942b02f5a3846fc25d46761ce136 (commit)
       via  67182ab96a8dda99ffa897a2fb04d361cd73777d (commit)
       via  96f5b2d78c60d1a16f51a269270d180b3f9a60a3 (commit)
       via  3b10b48b8a76203f75bee5233e3ab8a258803cb9 (commit)
       via  c23de360ed9e7950d8587a3ddae3c35874e61b50 (commit)
       via  84e9ab15e2068b0e0384e05d3839d16b6a71dc51 (commit)
       via  4ac75eb713fcd03b45eb1b4929e21897b4aa871b (commit)
       via  a4ab52b4305023d8c679cc7c3b09361050d167b6 (commit)
       via  1da127f1e63485ac225cb16511013094fd7e84f6 (commit)
       via  876d1f80e0344989f8b68799918c467fa5a52e19 (commit)
       via  eb3c3c9eeb73529353ee385385865d6d3dc99913 (commit)
       via  8ba7f9450ce51aa4ec8b0944991abe5a692ab4d1 (commit)
       via  1f45f7666edec7b10cee415f238931744247b762 (commit)
       via  cf9b56161704477075cda297b44dae4d9342c24a (commit)
       via  1f354e0ba1b5b23c2d36c0cb60451260b29e1d3f (commit)
       via  80c57e3536f41d8419f580b577776d85209f6111 (commit)
       via  5a9aaf3f32fc0414ae16aed17a77388cf4af9f90 (commit)
       via  af2c75821456e28875dc8006efb03f38ec1a74b8 (commit)
       via  9facc2aeba6770ee80730001ca66bdaec8bde738 (commit)
       via  8d554a2734be8bbe015d38a48494f7699f2de439 (commit)
       via  f51c721f97c6e5ef4fda47e6d0fc45cdd2c2b77d (commit)
       via  4154420cdd2a2ac6cdb2cc57357f42513fb287cc (commit)
       via  6f2433691034b6e223445c5a047554ee7c6f92c1 (commit)
       via  700fcdd3594713fc2f692d5c3c31474f0c8e14ff (commit)
       via  454e8fd7bbe6afdfd5fe9905cd0376741bf5f9a0 (commit)
       via  aff3c1ad491cf4ce7fe7912eaf17c1109d35faf6 (commit)
       via  ec48719c7de0d18772b811645956fab87ce14bff (commit)
       via  c2a7a5a0e1a89d10d286e060374ad9e1b83a24c7 (commit)
       via  9126da70d57cdd32938c4b3814fedf2bd1f1db93 (commit)
      from  6137770472ef5b55fd604f87d303d6e07c7e3f2f (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 d585a31fb1a2b2c4964ff2c8928a42358e8a060f
Merge: 6d6ee07 9d724d2
Author: radhika <radhika at curoverse.com>
Date:   Fri Sep 19 08:50:05 2014 -0400

    Merge branch 'master' into 3898-job-state-attr


commit 6d6ee07abb8892fb1e3f606c1347d18abc321ced
Author: radhika <radhika at curoverse.com>
Date:   Fri Sep 19 08:49:12 2014 -0400

    3898: add unit test for job state attribute

diff --git a/services/api/app/models/job.rb b/services/api/app/models/job.rb
index a831dd6..fd46a6f 100644
--- a/services/api/app/models/job.rb
+++ b/services/api/app/models/job.rb
@@ -263,7 +263,7 @@ class Job < ArvadosModel
           self.cancelled_at = Time.now
         end
         self.running = false
-        self.success = false
+        self.success = nil
       when Failed
         if !self.finished_at
           self.finished_at = Time.now
@@ -278,16 +278,24 @@ class Job < ArvadosModel
         self.success = true
       end
     elsif 'running'.in? changed_attributes
-      self.state = Running
+      if self.running
+        self.state = Running
+        if !self.started_at
+          self.started_at = Time.now
+        end
+      end
     elsif 'success'.in? changed_attributes
-      if success
+      if self.success
         self.state = Complete
       else
         self.state = Failed
       end
+      self.running = false
     elsif 'cancelled_at'.in? changed_attributes
       self.state = Cancelled
+      self.running = false
     end
+    true
   end
 
   def set_state_before_save
@@ -298,13 +306,14 @@ class Job < ArvadosModel
         self.state = Complete
       elsif (!self.success.nil? && !self.success)
         self.state = Failed
-      elsif (self.running && self.success.nil? && !self.cencelled_at)
+      elsif (self.running && self.success.nil? && !self.cancelled_at)
         self.state = Running
-      elsif !self.started_at && !self.cancelled_at && !self.is_locked_by_uuid && self.success.nil?
+      elsif !self.started_at && !self.cancelled_at && !self.is_locked_by_uuid &&
+            self.success.nil? && self.running.nil?
         self.state = Queued
       end
     end
-
+ 
     if self.state.in?(States)
       true
     else
diff --git a/services/api/test/unit/job_test.rb b/services/api/test/unit/job_test.rb
index 730eb06..e924cdd 100644
--- a/services/api/test/unit/job_test.rb
+++ b/services/api/test/unit/job_test.rb
@@ -154,4 +154,60 @@ class JobTest < ActiveSupport::TestCase
       assert_not_empty job.errors, "validation failure did not provide errors"
     end
   end
+
+  [
+    # Each test case is of the following format
+    # 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']]]],
+    [['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]]]],
+    # potential migration cases
+    [['state', nil, [['state', 'Queued']]]],
+    [['state', nil, [['state', 'Queued']]], ['cancelled_at', Time.now, [['state', 'Cancelled']]]],
+    [['running', true, [['state', 'Running'], ['started_at', 'not_nil']]], ['state', nil, [['state', 'Running']]]],
+    # bogus initial status (started_at but not running), to produce error while setting state
+    [['started_at', Time.now, [['state', 'Queued']]], ['state', nil, 'error']],
+  ].each do |parameters|
+    test "verify job status #{parameters}" do
+      job = Job.create! job_attrs
+      assert job.valid?, job.errors.full_messages.to_s
+      assert_equal job.state, 'Queued'
+
+      parameters.each do |parameter|
+        expectations = parameter[2]
+        if expectations.instance_of? Array
+          job[parameter[0]] = parameter[1]
+          job.save!
+          expectations.each do |expectation|
+            if expectation[1] == 'not_nil'
+              assert_not_nil job[expectation[0]]
+            elsif expectation[1] == 'nil'
+              assert_nil job[expectation[0]]
+            else
+              assert_equal expectation[1], job[expectation[0]]
+            end
+          end
+        else # String expectation, looking for error
+          if expectations == 'error'
+            rescued = false
+            begin
+              job[parameter[0]] = parameter[1]
+              job.save!
+            rescue
+              rescued = true
+            end
+            assert rescued, 'Expected error'
+          end
+        end
+      end
+    end
+  end
+
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list