9318: Compute node summary pane includes queued and locked containers.
authorradhika <radhika@curoverse.com>
Fri, 3 Jun 2016 14:36:14 +0000 (10:36 -0400)
committerradhika <radhika@curoverse.com>
Fri, 3 Jun 2016 14:36:14 +0000 (10:36 -0400)
apps/workbench/app/controllers/application_controller.rb
apps/workbench/app/views/projects/_compute_node_status.html.erb
apps/workbench/app/views/projects/_show_dashboard.html.erb
apps/workbench/test/integration/application_layout_test.rb
apps/workbench/test/unit/work_unit_test.rb
services/api/test/fixtures/containers.yml

index 3e5afbdc2e718d334c5e3d7fec646c9354faf409..63c75bcbbb13a7fbd04ba51987f3510b225d3345 100644 (file)
@@ -867,6 +867,18 @@ class ApplicationController < ActionController::Base
     Hash[procs.sort_by {|key, value| value}].keys.reverse.first(lim)
   end
 
+  helper_method :queued_processes
+  def queued_processes
+    procs = {}
+    queued_jobs = Job.queue
+    queued_jobs.each { |j| procs[j] = j.priority }
+
+    queued_containers = Container.order(["priority desc", "created_at desc"]).filter([["state", "in", ["Queued", "Locked"]]])
+    queued_containers.results.each { |c| procs[c] = c.priority }
+
+    Hash[procs.sort_by {|key, value| value}].keys.reverse
+  end
+
   helper_method :recent_collections
   def recent_collections lim
     c = Collection.limit(lim).order(["modified_at desc"]).filter([["owner_uuid", "is_a", "arvados#group"]])
index cd9243d68f76003a77f65c7197477aa213d60e38..8fb0b14a5122ee09571e780dabe34baa4a248f86 100644 (file)
@@ -1,26 +1,27 @@
 <h4>Queue</h4>
-<% queue = Job.queue %>
+<% queue = queued_processes %>
 <% if queue.any? %>
 
-<% queue.each do |j| %>
+<% queue.each do |p| %>
+  <% wu = p.work_unit %>
   <div class="row">
     <div class="col-md-3 text-overflow-ellipsis">
-      <%= link_to_if_arvados_object j, friendly_name: true %>
+      <%= link_to_if_arvados_object p, friendly_name: true %>
     </div>
     <div class="col-md-4">
-      <%= render_localized_date(j[:created_at]) %>
+      <%= render_localized_date(p.created_at) %>
     </div>
     <div class="col-md-3">
-      <%= render_runtime(Time.now - j[:created_at], false) %>
+      <%= render_runtime(Time.now - p.created_at, false) %>
     </div>
     <div class="col-md-2">
-      <%= j[:priority] %>
+      <%= p.priority %>
     </div>
   </div>
 <% end %>
   <div class="row">
     <div class="col-md-3">
-      <b>Job</b>
+      <b>Process</b>
     </div>
     <div class="col-md-4">
       <b>Submitted</b>
@@ -38,7 +39,7 @@
   <div>
   </div>
 <% else %>
-  There are currently no jobs in your queue.
+  There are currently no processes in your queue.
 <% end %>
 
 <h4>Node status</h4>
index ef436689ae0db854e6baf7c21ba22ca24b9bc69e..f81325862d6d0a5a7fc29483a9f435dd6ba86624 100644 (file)
             <% end %>
           </span>
         </div>
-        <div class="panel-body">
+        <div class="panel-body compute-node-summary-pane">
           <div>
             <%= render partial: 'compute_node_summary', locals: {nodes: nodes} %>
             <div style="text-align: center">
index d00eb88df360c90826714af708c483e44f2032ae..4685b0cec918bd374aa9ac175c967143442ee29f 100644 (file)
@@ -180,22 +180,6 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
         first('button', text: 'x').click
       end
       assert_text 'Active processes' # seeing dashboard now
-      if token == 'active'
-        within('.active-processes') do
-          assert_text 'zzzzz-dz642-runningcontainr'
-          assert_text 'zzzzz-dz642-runningcontain2'
-          assert_text 'zzzzz-d1hrv-partdonepipelin'
-          assert_no_text 'zzzzz-d1hrv-twodonepipeline'
-          assert_no_text 'zzzzz-xvhdp-cr4queuedcontnr'
-        end
-        within('.finished-processes') do
-          assert_text 'zzzzz-d1hrv-twodonepipeline'
-          assert_text 'zzzzz-dz642-compltcontainer'
-          assert_text 'zzzzz-dz642-compltcontainr2'
-          assert_no_text 'zzzzz-d1hrv-partdonepipelin'
-          assert_no_text 'zzzzz-dz642-runningcontainr'
-        end
-      end
     end
   end
 
@@ -257,4 +241,31 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
       assert_text look_for
     end
   end
+
+  test "dashboard panes" do
+    visit page_with_token('active')
+
+    assert_text 'Active processes' # seeing dashboard now
+    within('.active-processes') do
+      assert_text 'zzzzz-dz642-runningcontainr'
+      assert_text 'zzzzz-dz642-runningcontain2'
+      assert_text 'zzzzz-d1hrv-partdonepipelin'
+      assert_no_text 'zzzzz-d1hrv-twodonepipeline'
+      assert_no_text 'zzzzz-xvhdp-cr4queuedcontnr'
+    end
+    within('.finished-processes') do
+      assert_text 'zzzzz-d1hrv-twodonepipeline'
+      assert_text 'zzzzz-dz642-compltcontainer'
+      assert_text 'zzzzz-dz642-compltcontainr2'
+      assert_no_text 'zzzzz-d1hrv-partdonepipelin'
+      assert_no_text 'zzzzz-dz642-runningcontainr'
+    end
+
+    within('.compute-node-summary-pane') do
+      click_link 'Details'
+      assert_text 'zzzzz-dz642-lockedcontainer'
+      assert_text 'zzzzz-dz642-queuedcontainer'
+      assert_text '"foo" job submitted'
+    end
+  end
 end
index 6d31b74be213daf86da5173ed2a9669c8044009f..974002c8029050d8ebc8dae6a5a1453e32ee0a49 100644 (file)
@@ -6,7 +6,7 @@ class WorkUnitTest < ActiveSupport::TestCase
     [PipelineInstance, 'pipeline_in_running_state', nil, 1, "Running", nil, 0.0],
     [PipelineInstance, 'has_component_with_completed_jobs', nil, 3, "Complete", true, 1.0],
     [PipelineInstance, 'pipeline_with_tagged_collection_input', "pwu", 1, "Ready", nil, 0.0],
-    [Container, 'requester', 'cwu', 3, "Complete", true, 1.0],
+    [Container, 'requester', 'cwu', 5, "Complete", true, 1.0],
   ].each do |type, name, label, num_children, state, success, progress|
     test "children of #{name}" do
       use_token 'admin'
index 6fc3fd1544eac9685d334a5fc6eedc36a7ae08bd..febd3df305a05343f3d27f338a7dffb9c8ee63b7 100644 (file)
@@ -48,6 +48,22 @@ running-older:
     ram: 12000000000
     vcpus: 4
 
+locked:
+  uuid: zzzzz-dz642-lockedcontainer
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  state: Locked
+  priority: 2
+  created_at: 2016-01-01 11:11:11.111111111 Z
+  updated_at: 2016-01-01 11:11:11.111111111 Z
+  container_image: test
+  cwd: test
+  output: test
+  output_path: test
+  command: ["echo", "hello"]
+  runtime_constraints:
+    ram: 12000000000
+    vcpus: 4
+
 completed:
   uuid: zzzzz-dz642-compltcontainer
   owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz