[ARVADOS] created: 6c01579495dd6a26ee9b05aa0accd136094d453e

Git user git at public.curoverse.com
Sat Mar 26 04:16:10 EDT 2016


        at  6c01579495dd6a26ee9b05aa0accd136094d453e (commit)


commit 6c01579495dd6a26ee9b05aa0accd136094d453e
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Mar 25 15:59:34 2016 -0400

    8800: Drop queue_position support.

diff --git a/apps/workbench/app/views/pipeline_instances/_running_component.html.erb b/apps/workbench/app/views/pipeline_instances/_running_component.html.erb
index d4e0944..ded535e 100644
--- a/apps/workbench/app/views/pipeline_instances/_running_component.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/_running_component.html.erb
@@ -61,16 +61,6 @@
             <div class="col-md-6">
               <% queuetime = Time.now - Time.parse(current_job[:created_at].to_s) %>
               Queued for <%= render_runtime(queuetime, false) %>.
-              <% begin %>
-                <% if current_job[:queue_position] == 0 %>
-                  This job is next in the queue to run.
-                <% elsif current_job[:queue_position] == 1 %>
-                  There is 1 job in the queue ahead of this one.
-                <% elsif current_job[:queue_position] %>
-                  There are <%= current_job[:queue_position] %> jobs in the queue ahead of this one.
-                <% end %>
-              <% rescue %>
-              <% end %>
             </div>
           <% elsif current_job[:state] == "Running" %>
             <%# column offset 8 %>
diff --git a/services/api/app/controllers/arvados/v1/jobs_controller.rb b/services/api/app/controllers/arvados/v1/jobs_controller.rb
index f1ef2d8..0190537 100644
--- a/services/api/app/controllers/arvados/v1/jobs_controller.rb
+++ b/services/api/app/controllers/arvados/v1/jobs_controller.rb
@@ -143,7 +143,7 @@ class Arvados::V1::JobsController < ApplicationController
               end
             end
           end
-          job_queue = Job.queue
+          job_queue = Job.queue.select(:uuid)
           n_queued_before_me = 0
           job_queue.each do |j|
             break if j.uuid == @job.uuid
@@ -152,7 +152,7 @@ class Arvados::V1::JobsController < ApplicationController
           yield "#{db_current_time}" \
             " job #{@job.uuid}" \
             " queue_position #{n_queued_before_me}" \
-            " queue_size #{job_queue.size}" \
+            " queue_size #{job_queue.count}" \
             " nodes_idle #{nodes_in_state[:idle]}" \
             " nodes_alloc #{nodes_in_state[:alloc]}\n"
           last_ack_at = db_current_time
diff --git a/services/api/app/models/job.rb b/services/api/app/models/job.rb
index 6c24293..b7f1d9f 100644
--- a/services/api/app/models/job.rb
+++ b/services/api/app/models/job.rb
@@ -78,12 +78,7 @@ class Job < ArvadosModel
   end
 
   def queue_position
-    Job::queue.each_with_index do |job, index|
-      if job[:uuid] == self.uuid
-        return index
-      end
-    end
-    nil
+    state == Queued ? 0 : nil
   end
 
   def self.running
diff --git a/services/api/test/unit/job_test.rb b/services/api/test/unit/job_test.rb
index f16c8b2..832338a 100644
--- a/services/api/test/unit/job_test.rb
+++ b/services/api/test/unit/job_test.rb
@@ -316,7 +316,6 @@ class JobTest < ActiveSupport::TestCase
 
     assert_not_nil job1.queue_position, "Expected non-nil queue position for job1"
     assert_not_nil job2.queue_position, "Expected non-nil queue position for job2"
-    assert_not_equal job1.queue_position, job2.queue_position
   end
 
   SDK_MASTER = "ca68b24e51992e790f29df5cc4bc54ce1da4a1c2"

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list