[ARVADOS] updated: 2099a0a3f0ef3371ba30ed0955bbc75ffa332701

git at public.curoverse.com git at public.curoverse.com
Thu May 22 18:38:40 EDT 2014


Summary of changes:
 .../app/controllers/arvados/v1/jobs_controller.rb    |  4 +++-
 services/api/test/fixtures/jobs.yml                  | 20 ++++++++++++++++++++
 .../functional/arvados/v1/jobs_controller_test.rb    | 15 +++++++++++++++
 3 files changed, 38 insertions(+), 1 deletion(-)

       via  2099a0a3f0ef3371ba30ed0955bbc75ffa332701 (commit)
      from  d5823126a51b7c31915e01fee100abe9468014e5 (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 2099a0a3f0ef3371ba30ed0955bbc75ffa332701
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu May 22 18:23:02 2014 -0400

    Fix crash in jobs.queue API. Add test case.

diff --git a/services/api/app/controllers/arvados/v1/jobs_controller.rb b/services/api/app/controllers/arvados/v1/jobs_controller.rb
index b0d93a4..ee56301 100644
--- a/services/api/app/controllers/arvados/v1/jobs_controller.rb
+++ b/services/api/app/controllers/arvados/v1/jobs_controller.rb
@@ -166,6 +166,8 @@ class Arvados::V1::JobsController < ApplicationController
   end
 
   def queue
+    params[:order] ||= ['priority desc', 'created_at']
+    load_limit_offset_order_params
     load_where_param
     @where.merge!({
                     started_at: nil,
@@ -173,7 +175,7 @@ class Arvados::V1::JobsController < ApplicationController
                     cancelled_at: nil,
                     success: nil
                   })
-    params[:order] ||= ['priority desc', 'created_at']
+    load_filters_param
     find_objects_for_index
     index
   end
diff --git a/services/api/test/fixtures/jobs.yml b/services/api/test/fixtures/jobs.yml
index fe0b094..3ad7746 100644
--- a/services/api/test/fixtures/jobs.yml
+++ b/services/api/test/fixtures/jobs.yml
@@ -165,3 +165,23 @@ nearly_finished_job:
     running: 1
     done: 0
   runtime_constraints: {}
+
+queued:
+  uuid: zzzzz-8i9sb-grx15v5mjnsyxk7
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  cancelled_at: ~
+  cancelled_by_user_uuid: ~
+  cancelled_by_client_uuid: ~
+  started_at: ~
+  finished_at: ~
+  script: foo
+  script_version: 1de84a854e2b440dc53bf42f8548afa4c17da332
+  script_parameters: {}
+  running: ~
+  success: ~
+  output: ~
+  priority: ~
+  log: ~
+  is_locked_by_uuid: ~
+  tasks_summary: {}
+  runtime_constraints: {}
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 0d1f71f..0188bd4 100644
--- a/services/api/test/functional/arvados/v1/jobs_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/jobs_controller_test.rb
@@ -285,4 +285,19 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
     assert_response :success
   end
 
+  [:active, :admin].each do |which_token|
+    test "get job queue as #{which_token} user" do
+      authorize_with which_token
+      get :queue
+      assert_response :success
+      assert_operator 1, :<=, assigns(:objects).count
+    end
+    test "get job queue as #{which_token} user, with a filter" do
+      authorize_with which_token
+      get :queue, { filters: [['script','=','foo']] }
+      assert_response :success
+      assert_equal ['foo'], assigns(:objects).collect(&:script).uniq
+    end
+  end
+
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list