[ARVADOS] updated: 46ef0003a8dacf38a68646e3e6af03e6f6127e0e

git at public.curoverse.com git at public.curoverse.com
Wed Oct 8 11:37:26 EDT 2014


Summary of changes:
 .../app/helpers/pipeline_instances_helper.rb       |   8 +-
 .../pipeline_instances/_running_component.html.erb | 150 +++++++++++----------
 .../_show_components_running.html.erb              |  16 +--
 .../app/views/projects/_show_dashboard.html.erb    |   8 +-
 4 files changed, 93 insertions(+), 89 deletions(-)

       via  46ef0003a8dacf38a68646e3e6af03e6f6127e0e (commit)
      from  2c7b72059f8390d56f7031206772dc3d4e4ad5da (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 46ef0003a8dacf38a68646e3e6af03e6f6127e0e
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Wed Oct 8 10:45:35 2014 -0400

    3381: Reorganize _running_components to be clearer.  Fixing workbench.

diff --git a/apps/workbench/app/helpers/pipeline_instances_helper.rb b/apps/workbench/app/helpers/pipeline_instances_helper.rb
index 06d61e0..b0d5216 100644
--- a/apps/workbench/app/helpers/pipeline_instances_helper.rb
+++ b/apps/workbench/app/helpers/pipeline_instances_helper.rb
@@ -18,12 +18,12 @@ module PipelineInstancesHelper
   def render_pipeline_job pj
     pj[:progress_bar] = render partial: 'job_progress', locals: {:j => pj[:job]}
     pj[:output_link] = link_to_if_arvados_object pj[:output]
-    pj[:job_link] = link_to_if_arvados_object pj[:job][:uuid]
+    pj[:job_link] = link_to_if_arvados_object pj[:job][:uuid] if pj[:job]
     pj
   end
 
   # Merge (started_at, finished_at) time range into the list of time ranges in
-  # timestamps (timestamps must be sorted and non-overlapping).  
+  # timestamps (timestamps must be sorted and non-overlapping).
   # return the updated timestamps list.
   def merge_range timestamps, started_at, finished_at
     # in the comments below, 'i' is the entry in the timestamps array and 'j'
@@ -62,7 +62,7 @@ module PipelineInstancesHelper
 
     timestamps << [started_at, finished_at]
   end
-  
+
   # Accept a list of objects with [:started_at] and [:finshed_at] keys and
   # merge overlapping ranges to compute the time spent running after periods of
   # overlapping execution are factored out.
@@ -269,7 +269,7 @@ module PipelineInstancesHelper
 
     if round_to_min and seconds >= 30
       minutes += 1
-    end    
+    end
 
     if use_words
       s = []
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 3cdac9b..6738b11 100644
--- a/apps/workbench/app/views/pipeline_instances/_running_component.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/_running_component.html.erb
@@ -1,95 +1,97 @@
-  <% current_job = pj[:job] if pj[:job] != {} and pj[:job][:uuid] %>
-  <div class="panel panel-default">
-    <div class="panel-heading">
-      <div class="container-fluid">
-        <div class="row-fluid">
-          <%# column offset 3 %>
-          <div class="col-md-3">
-            <h4 class="panel-title">
-              <a data-toggle="collapse" href="#collapse<%= i %>" style="white-space: nowrap;">
-                <%= pj[:name] %> <span class="caret"></span>
-              </a>
-            </h4>
-          </div>
+<% current_job = pj[:job] if pj[:job] != {} and pj[:job][:uuid] %>
+<div class="panel panel-default">
+  <div class="panel-heading">
+    <div class="container-fluid">
+      <div class="row-fluid">
+        <%# column offset 0 %>
+        <div class="col-md-3">
+          <h4 class="panel-title">
+            <a data-toggle="collapse" href="#collapse<%= i %>" style="white-space: nowrap;">
+              <%= pj[:name] %> <span class="caret"></span>
+            </a>
+          </h4>
+        </div>
 
-          <%# column offset 3 %>
-          <div class="col-md-2 pipeline-instance-spacing">
-            <%= pj[:progress_bar] %>
-          </div>
+        <%# column offset 3 %>
+        <div class="col-md-2 pipeline-instance-spacing">
+          <%= pj[:progress_bar] %>
+        </div>
 
-          <% if current_job %>
-            <%# column offset 5 %>
-            <div class="col-md-3">
-              <% if current_job[:started_at] %>
-                <% walltime = ((if current_job[:finished_at] then current_job[:finished_at] else Time.now() end) - current_job[:started_at]) %>
-                <% cputime = tasks.map { |task|
-                     if task.started_at and task.job_uuid == current_job[:uuid]
-                       (if task.finished_at then task.finished_at else Time.now() end) - task.started_at
-                     else
-                       0
-                     end
-                   }.reduce(:+) || 0 %>
-                <%= render_runtime(walltime, false, false) %>
-                <% if cputime > 0 %> / <%= render_runtime(cputime, false, false) %> (<%= (cputime/walltime).round(1) %>⨯)<% end %>
-              <% end %>
-            </div>
+        <% if current_job %>
+          <%# column offset 5 %>
+          <% if current_job[:state] != "Queued" %>
+          <div class="col-md-3">
+            <% if current_job[:started_at] %>
+              <% walltime = ((if current_job[:finished_at] then current_job[:finished_at] else Time.now() end) - current_job[:started_at]) %>
+              <% cputime = tasks.map { |task|
+                   if task.started_at and task.job_uuid == current_job[:uuid]
+                     (if task.finished_at then task.finished_at else Time.now() end) - task.started_at
+                   else
+                     0
+                   end
+                 }.reduce(:+) || 0 %>
+              <%= render_runtime(walltime, false, false) %>
+              <% if cputime > 0 %> / <%= render_runtime(cputime, false, false) %> (<%= (cputime/walltime).round(1) %>⨯)<% end %>
+            <% end %>
+          </div>
+          <% end %>
 
-            <% if current_job[:state].in? ["Complete", "Failed", "Cancelled"] %>
-              <%# column offset 8 %>
-              <div class="col-md-4 text-overflow-ellipsis">
-                <% if pj[:output_uuid] %>
-                  <%= link_to_if_arvados_object pj[:output_uuid], friendly_name: true %>
-                <% elsif current_job[:output] %>
-                  <%= link_to_if_arvados_object current_job[:output], link_text: "Output of #{pj[:name]}" %>
+          <% if current_job[:state] == "Queued" %>
+            <%# column offset 3 %>
+            <div class="col-md-6">
+              <% queuetime = Time.now - current_job[:created_at] %>
+              Queued for <%= render_runtime(queuetime, true) %>.
+              <% 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.
                 <% else %>
-                  No output.
+                  There are <%= current_job[:queue_position] %> jobs in the queue ahead of this one.
                 <% end %>
-              </div>
-            <% elsif current_job[:state].in? ["Queued", "Running"] %>
-              <%# column offset 8 %>
+              <% rescue %>
+              <% end %>
+            </div>
+          <% elsif current_job[:state] == "Running" %>
+            <%# column offset 8 %>
             <div class="col-md-3">
-              <% if current_job[:state].in? ["Running"] %>
-                <span class="task-summary-status">
-                <%= current_job[:tasks_summary][:done] %> task<%= if current_job[:tasks_summary][:done] > 1 then 's' else '' end %> done,
+              <span class="task-summary-status">
+                <%= current_job[:tasks_summary][:done] %> <%= "task".pluralize(current_job[:tasks_summary][:done]) %> done,
                 <%= current_job[:tasks_summary][:failed] %> failed,
                 <%= current_job[:tasks_summary][:running] %> running,
                 <%= current_job[:tasks_summary][:todo] %> pending
-                </span>
+              </span>
+            </div>
+          <% elsif current_job[:state].in? ["Complete", "Failed", "Cancelled"] %>
+            <%# column offset 8 %>
+            <div class="col-md-4 text-overflow-ellipsis">
+              <% if pj[:output_uuid] %>
+                <%= link_to_if_arvados_object pj[:output_uuid], friendly_name: true %>
+              <% elsif current_job[:output] %>
+                <%= link_to_if_arvados_object current_job[:output], link_text: "Output of #{pj[:name]}" %>
+              <% else %>
+                No output.
               <% end %>
             </div>
+          <% end %>
+
+          <% if current_job[:state].in? ["Queued", "Running"] %>
             <%# column offset 11 %>
             <div class="col-md-1 pipeline-instance-spacing">
-                <%= form_tag "/jobs/#{current_job[:uuid]}/cancel", style: "display:inline; padding-left: 1em" do |f| %>
+              <%= form_tag "/jobs/#{current_job[:uuid]}/cancel", style: "display:inline; padding-left: 1em" do |f| %>
                 <%= hidden_field_tag :return_to, url_for(@object) %>
                 <%= button_tag "Cancel", {class: 'btn btn-xs btn-danger', id: "cancel-job-button"} %>
-            </div>
-            <% end %>
-
-          <% elsif current_job[:state] == "Queued" %>
-            <%# column offset 8 %>
-            <div class="col-md-4">
-              <% queuetime = Time.now - current_job[:created_at] %>
-              Queued for <%= render_runtime(queuetime, true) %>.
-              <% 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.
-              <% else  %>
-                There are <%= current_job[:queue_position] %> jobs in the queue ahead of this one.
               <% end %>
-              <% rescue %>
-          <% end %>
             </div>
           <% end %>
-<% end %>
-</div>
-</div>
-</div>
+        <% end %>
+      </div>
+    </div>
+  </div>
 
-<div id="collapse<%= i %>" class="panel-collapse collapse <%= if expanded then 'in' end %>">
-  <div class="panel-body">
-    <div class="container">
+  <div id="collapse<%= i %>" class="panel-collapse collapse <%= if expanded then 'in' end %>">
+    <div class="panel-body">
+      <div class="container">
         <% current_component = (if current_job then current_job else pj end) %>
         <div class="row">
           <div class="col-md-6">
@@ -166,7 +168,7 @@
             <pre><%= JSON.pretty_generate(current_component[:script_parameters]) rescue nil %></pre>
           </div>
         </div>
+      </div>
     </div>
   </div>
 </div>
-</div>
diff --git a/apps/workbench/app/views/pipeline_instances/_show_components_running.html.erb b/apps/workbench/app/views/pipeline_instances/_show_components_running.html.erb
index acaf9d3..165a694 100644
--- a/apps/workbench/app/views/pipeline_instances/_show_components_running.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/_show_components_running.html.erb
@@ -7,13 +7,13 @@
   </p>
 <% end %>
 
-<% tasks = JobTask.filter([['job_uuid', 'in', render_pipeline_jobs.map { |j| j[:job].andand[:uuid] }]]).results %>
-<% runningtime = determine_wallclock_runtime(render_pipeline_jobs.map {|j| j[:job]}) %>
+<% tasks = JobTask.filter([['job_uuid', 'in', render_pipeline_jobs.map { |j| j[:job].andand[:uuid] }.compact]]).results %>
+<% runningtime = determine_wallclock_runtime(render_pipeline_jobs.map {|j| j[:job]}.compact) %>
 
 <p>
   <% if @object.started_at %>
     This pipeline started at <%= render_localized_date(@object.started_at) %>.
-    It 
+    It
     <% if @object.state == 'Complete' %>
       completed in
     <% elsif @object.state == 'Failed' %>
@@ -27,11 +27,11 @@
                   else
                     Time.now - @object.started_at
                   end %>
-    
-    <%= if walltime > runningtime 
-          render_runtime(walltime, true, false) 
-        else 
-          render_runtime(runningtime, true, false) 
+
+    <%= if walltime > runningtime
+          render_runtime(walltime, true, false)
+        else
+          render_runtime(runningtime, true, false)
         end %><% if @object.finished_at %> at <%= render_localized_date(@object.finished_at) %><% end %>.
     <% else %>
       This pipeline is <%= if @object.state.start_with? 'Running' then 'active' else @object.state.downcase end %>.
diff --git a/apps/workbench/app/views/projects/_show_dashboard.html.erb b/apps/workbench/app/views/projects/_show_dashboard.html.erb
index e384e42..0d71f94 100644
--- a/apps/workbench/app/views/projects/_show_dashboard.html.erb
+++ b/apps/workbench/app/views/projects/_show_dashboard.html.erb
@@ -33,15 +33,17 @@
                 <div class="pull-right" style="width: 40%">
                   <div class="progress" style="margin-bottom: 0px">
                     <% p.components.each do |k, v| %>
-                      <%= render partial: 'job_progress', locals: {:j => v[:job], :scaleby => (1.0/p.components.size)} %>
+                      <% if v.is_a? Hash and v[:job] %>
+                        <%= render partial: 'job_progress', locals: {:j => v[:job], :scaleby => (1.0/p.components.size)} %>
+                      <% end %>
                     <% end %>
                   </div>
                 </div>
               </div>
 
               <%
-                running = p.components.select { |k, c| c.andand[:job].andand[:state] == "Running" }
-                queued = p.components.select { |k, c| c.andand[:job].andand[:state] == "Queued" }
+                running = p.components.select { |k, c| c.is_a? Hash and c[:job].andand[:state] == "Running" }
+                queued = p.components.select { |k, c| c.is_a? Hash and c[:job].andand[:state] == "Queued" }
                 %>
 
               <div class="clearfix">

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list