[ARVADOS] updated: 38dc6b9ddabb0e0e76128bfc4ff372f597d8e25e

git at public.curoverse.com git at public.curoverse.com
Thu Aug 28 10:37:55 EDT 2014


Summary of changes:
 services/api/app/models/job.rb                               |  8 ++++++++
 services/api/test/fixtures/jobs.yml                          | 12 ++++++------
 .../api/test/functional/arvados/v1/jobs_controller_test.rb   |  1 +
 3 files changed, 15 insertions(+), 6 deletions(-)

       via  38dc6b9ddabb0e0e76128bfc4ff372f597d8e25e (commit)
      from  bf1f3980c2ec62969b663c1665cb0818e118dfba (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 38dc6b9ddabb0e0e76128bfc4ff372f597d8e25e
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Aug 28 10:37:52 2014 -0400

    3586: Set priority to "0" if nil.  Fix test fixtures.

diff --git a/services/api/app/models/job.rb b/services/api/app/models/job.rb
index 9fc58a6..4aeadcf 100644
--- a/services/api/app/models/job.rb
+++ b/services/api/app/models/job.rb
@@ -8,6 +8,7 @@ class Job < ArvadosModel
   serialize :tasks_summary, Hash
   before_create :ensure_unique_submit_id
   after_commit :trigger_crunch_dispatch_if_cancelled, :on => :update
+  before_validation :set_priority
   validate :ensure_script_version_is_commit
   validate :find_docker_image_locator
 
@@ -72,6 +73,13 @@ class Job < ArvadosModel
     super + %w(output log)
   end
 
+  def set_priority
+    if self.priority.nil?
+      self.priority = "0"
+    end
+    true
+  end
+
   def ensure_script_version_is_commit
     if self.is_locked_by_uuid and self.started_at
       # Apparently client has already decided to go for it. This is
diff --git a/services/api/test/fixtures/jobs.yml b/services/api/test/fixtures/jobs.yml
index 3274381..6c13be8 100644
--- a/services/api/test/fixtures/jobs.yml
+++ b/services/api/test/fixtures/jobs.yml
@@ -11,7 +11,7 @@ running:
   running: true
   success: ~
   output: ~
-  priority: ~
+  priority: "0"
   log: ~
   is_locked_by_uuid: zzzzz-tpzed-xurymjxw79nv3jz
   tasks_summary:
@@ -34,7 +34,7 @@ running_cancelled:
   running: true
   success: ~
   output: ~
-  priority: ~
+  priority: "0"
   log: ~
   is_locked_by_uuid: zzzzz-tpzed-xurymjxw79nv3jz
   tasks_summary:
@@ -57,7 +57,7 @@ uses_nonexistent_script_version:
   running: false
   success: true
   output: d41d8cd98f00b204e9800998ecf8427e+0
-  priority: ~
+  priority: "0"
   log: d41d8cd98f00b204e9800998ecf8427e+0
   is_locked_by_uuid: ~
   tasks_summary:
@@ -82,7 +82,7 @@ foobar:
   running: false
   success: true
   output: fa7aeb5140e2848d39b416daeef4ffc5+45
-  priority: ~
+  priority: "0"
   log: ea10d51bcf88862dbcc36eb292017dfd+45
   is_locked_by_uuid: ~
   tasks_summary:
@@ -109,7 +109,7 @@ barbaz:
   success: true
   repository: foo
   output: ea10d51bcf88862dbcc36eb292017dfd+45
-  priority: ~
+  priority: "0"
   log: d41d8cd98f00b204e9800998ecf8427e+0
   is_locked_by_uuid: ~
   tasks_summary:
@@ -207,7 +207,7 @@ queued:
   running: ~
   success: ~
   output: ~
-  priority: ~
+  priority: "0"
   log: ~
   is_locked_by_uuid: ~
   tasks_summary: {}
diff --git a/services/api/test/functional/arvados/v1/jobs_controller_test.rb b/services/api/test/functional/arvados/v1/jobs_controller_test.rb
index c33b5a6..f8657b8 100644
--- a/services/api/test/functional/arvados/v1/jobs_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/jobs_controller_test.rb
@@ -18,6 +18,7 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
     new_job = JSON.parse(@response.body)
     assert_not_nil new_job['uuid']
     assert_not_nil new_job['script_version'].match(/^[0-9a-f]{40}$/)
+    assert_equal '0', new_job['priority']
   end
 
   test "normalize output and log uuids when creating job" do

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list