[ARVADOS] updated: aecc7109edd37aee2388c06a36d5c8ba853b3267

git at public.curoverse.com git at public.curoverse.com
Mon Sep 22 15:23:48 EDT 2014


Summary of changes:
 apps/workbench/app/assets/javascripts/dates.js     |  3 +
 .../app/assets/stylesheets/application.css.scss    |  5 ++
 .../app/assets/stylesheets/projects.css.scss       | 10 ++-
 .../app/helpers/pipeline_instances_helper.rb       | 74 ++++++++++++++++-----
 .../app/views/application/_show_advanced.html.erb  |  2 +-
 .../_show_components_running.html.erb              | 75 ++++++++++++----------
 .../app/views/projects/_show_dashboard.html.erb    | 14 ++--
 7 files changed, 119 insertions(+), 64 deletions(-)

       via  aecc7109edd37aee2388c06a36d5c8ba853b3267 (commit)
       via  4eaf39dbe947beaaa87e656b470d7f21880ba607 (commit)
      from  15409c5e2b7946ff7f5fd104a6757a4d874448d4 (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 aecc7109edd37aee2388c06a36d5c8ba853b3267
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Mon Sep 22 15:23:41 2014 -0400

    3605: More improvements to overflow rendering.  More fixes to rendering when
    started_at and finished_at are missing.

diff --git a/apps/workbench/app/assets/stylesheets/application.css.scss b/apps/workbench/app/assets/stylesheets/application.css.scss
index bfb57e9..2624115 100644
--- a/apps/workbench/app/assets/stylesheets/application.css.scss
+++ b/apps/workbench/app/assets/stylesheets/application.css.scss
@@ -252,3 +252,8 @@ span.editable-textile {
   overflow: hidden;
   text-overflow: ellipsis;
 }
+.time-label-divider {
+  font-size: 80%;
+  min-width: 1em;
+  padding: 0px 2px 0px 0px;
+}
\ No newline at end of file
diff --git a/apps/workbench/app/assets/stylesheets/projects.css.scss b/apps/workbench/app/assets/stylesheets/projects.css.scss
index 2349892..cf1d15e 100644
--- a/apps/workbench/app/assets/stylesheets/projects.css.scss
+++ b/apps/workbench/app/assets/stylesheets/projects.css.scss
@@ -58,12 +58,6 @@ div.scroll-20em {
   border-radius: .3em;
 }
 
-.x-ellip {
-  overflow-x: hidden;
-  text-overflow: ellipsis;
-  white-space: nowrap;
-}
-
 .dashboard-panel-info-row:hover {
   background-color: #D9EDF7;
 }
diff --git a/apps/workbench/app/helpers/pipeline_instances_helper.rb b/apps/workbench/app/helpers/pipeline_instances_helper.rb
index 9d1a0c3..f0c4eb7 100644
--- a/apps/workbench/app/helpers/pipeline_instances_helper.rb
+++ b/apps/workbench/app/helpers/pipeline_instances_helper.rb
@@ -218,7 +218,6 @@ module PipelineInstancesHelper
   HOUR = 60 * MINUTE
   DAY = 24 * HOUR
 
-
   def render_runtime duration, use_words, round_to_min=true
     days = 0
     hours = 0
@@ -244,12 +243,12 @@ module PipelineInstancesHelper
 
     if round_to_min and seconds >= 30
       minutes += 1
-    end
+    end    
 
     if use_words
       s = ""
       if days > 0 then
-        s += "#{day} day#{'s' if days != 1}"
+        s += "#{days} day#{'s' if days != 1}"
       end
       if hours > 0 then
         s += " #{hours} hour#{'s' if hours != 1}"
@@ -263,22 +262,21 @@ module PipelineInstancesHelper
     else
       s = ""
       if days > 0
-        s += "#{days}d#{hours.to_s.rjust(2, '0')}h"
-      elsif (hours > 0)
-        s += "#{hours}h"
+        s += "#{days}<span class='time-label-divider'>d</span> "
       end
 
       if (hours > 0)
-        s += "#{minutes.to_s.rjust(2, '0')}m"
-      else
-        s += "#{minutes}m"
+        s += "#{hours}<span class='time-label-divider'>h</span>"
       end
+
+      s += "#{minutes}<span class='time-label-divider'>m</span>"
+
       if not round_to_min
-        s += "#{seconds.to_s.rjust(2, '0')}s"
+        s += "#{seconds}<span class='time-label-divider'>s</span>"
       end
     end
 
-    s
+    raw(s)
   end
 
 end
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 8e2c292..0b1bec8 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]}) %>
+
 <p>
   <% if @object.started_at %>
     This pipeline started at <span data-utc-date="<%= @object.started_at %>"><%= @object.started_at %></span>.
-  <% end %>
-
-  <% if @object.started_at %>
-    This pipeline
+    It 
     <% if @object.state == 'Complete' %>
       completed in
     <% elsif @object.state == 'Failed' %>
@@ -28,11 +28,15 @@
                     Time.now - @object.started_at
                   end %>
     
-    <%= runtime(walltime, true) %><% if @object.finished_at %> at <span data-utc-date="<%= @object.finished_at %>"><%= @object.finished_at %></span><% end %>.
-  <% else %>
-    This pipeline is <%= if @object.state.start_with? 'Running' then 'active' else @object.state.downcase end %>.
-    <% walltime = 0%>
-  <% end %>
+    <%= if walltime > runningtime 
+          render_runtime(walltime, true) 
+        else 
+          render_runtime(runningtime, true) 
+        end %><% if @object.finished_at %> at <span data-utc-date="<%= @object.finished_at %>"><%= @object.finished_at %></span><% end %>.
+    <% else %>
+      This pipeline is <%= if @object.state.start_with? 'Running' then 'active' else @object.state.downcase end %>.
+        <% walltime = 0%>
+    <% end %>
 
   <% if @object.state == 'Failed' %>
     Check the Log tab for more detail about why this pipeline failed.
@@ -40,9 +44,7 @@
 </p>
 
 <p>
-    <% 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]}) %>
-    It
+    This pipeline
     <% if @object.state.start_with? 'Running' %>
       has run
     <% else %>
@@ -74,7 +76,7 @@
         <div class="row">
           <div class="col-md-3">
             <h4 class="panel-title">
-              <a data-toggle="collapse" href="#collapse<%= i %>">
+              <a data-toggle="collapse" href="#collapse<%= i %>" style="white-space: nowrap;">
                 <%= pj[:name] %> <span class="caret"></span>
               </a>
             </h4>
@@ -101,7 +103,7 @@
             </div>
 
             <% if Job::state(current_job).in? ["Completed", "Failed", "Canceled"] %>
-              <div class="col-md-3">
+              <div class="col-md-5 text-overflow-ellipsis">
                 <% if pj[:output_uuid] %>
                   <%= link_to_if_arvados_object pj[:output_uuid], friendly_name: true %>
                 <% elsif current_job.andand[:output] %>
diff --git a/apps/workbench/app/views/projects/_show_dashboard.html.erb b/apps/workbench/app/views/projects/_show_dashboard.html.erb
index 6fb18db..e836889 100644
--- a/apps/workbench/app/views/projects/_show_dashboard.html.erb
+++ b/apps/workbench/app/views/projects/_show_dashboard.html.erb
@@ -92,7 +92,7 @@
           <% finished_pipelines(8).each do |p| %>
             <div class="dashboard-panel-info-row">
               <div class="row">
-                <div class="col-md-6 x-ellip">
+                <div class="col-md-6 text-overflow-ellipsis">
                   <%= link_to_if_arvados_object p, friendly_name: true %>
                 </div>
                 <div class="col-md-2">
@@ -110,7 +110,7 @@
                     Active for <%= render_runtime(pipeline_time, false) %>
                   <% end %>
 
-                  <span class="pull-right x-ellip" style="max-width: 100%">
+                  <span class="pull-right text-overflow-ellipsis" style="max-width: 100%">
                     <% outputs = [] %>
                     <% p.components.each do |k, c| %>
                       <% outputs << c[:output_uuid] if c[:output_uuid] %>
@@ -130,7 +130,7 @@
                 <div class="col-md-12">
                   <div class="pull-right" style="max-width: 100%">
                     <% outputs.each do |out| %>
-                      <div class="x-ellip">
+                      <div class="text-overflow-ellipsis">
                         <i class="fa fa-fw fa-archive"></i> <%= link_to_if_arvados_object out, friendly_name: true %>
                       </div>
                     <% end %>
@@ -168,7 +168,7 @@
                                              data-utc-date="<%= p[:modified_at] %>"
                                              data-utc-date-opts="noseconds"><%= p[:modified_at]%></span></span>
             </div>
-            <div class="x-ellip" style="margin-left: 1em; width: 100%"><%= link_to_if_arvados_object p, friendly_name: true %>
+            <div class="text-overflow-ellipsis" style="margin-left: 1em; width: 100%"><%= link_to_if_arvados_object p, friendly_name: true %>
             </div>
             </div>
           <% end %>

commit 4eaf39dbe947beaaa87e656b470d7f21880ba607
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Mon Sep 22 14:56:22 2014 -0400

    3605: Change runtime() to render_runtime().  Improve rendering when started_at
    and finished_at are missing from pipelines and tasks.  Include count of days
    when rendering run times.  Add comments.

diff --git a/apps/workbench/app/assets/javascripts/dates.js b/apps/workbench/app/assets/javascripts/dates.js
index b6eff83..903fb01 100644
--- a/apps/workbench/app/assets/javascripts/dates.js
+++ b/apps/workbench/app/assets/javascripts/dates.js
@@ -1,12 +1,15 @@
 jQuery(function($){
 $(document).on('ajax:complete arv:pane:loaded ready', function() {
     $('[data-utc-date]').each(function(i, elm) {
+        // Try matching the date using a couple of different formats.
         var v = $(elm).attr('data-utc-date').match(/(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d) UTC/);
         if (!v) {
             v = $(elm).attr('data-utc-date').match(/(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)Z/);
         }
 
         if (v) {
+            // Create a new date object from the timestamp so the browser can
+            // render the date based on the locale/timezone.
             var ts = new Date(Date.UTC(v[1], v[2]-1, v[3], v[4], v[5], v[6]));
             if ($(elm).attr('data-utc-date-opts') && $(elm).attr('data-utc-date-opts').match(/noseconds/)) {
                 $(elm).text((ts.getHours() > 12 ? (ts.getHours()-12) : ts.getHours())
diff --git a/apps/workbench/app/assets/stylesheets/projects.css.scss b/apps/workbench/app/assets/stylesheets/projects.css.scss
index 28cde66..2349892 100644
--- a/apps/workbench/app/assets/stylesheets/projects.css.scss
+++ b/apps/workbench/app/assets/stylesheets/projects.css.scss
@@ -66,4 +66,8 @@ div.scroll-20em {
 
 .dashboard-panel-info-row:hover {
   background-color: #D9EDF7;
+}
+
+.progress-bar.progress-bar-default {
+  background-color: #999;
 }
\ No newline at end of file
diff --git a/apps/workbench/app/helpers/pipeline_instances_helper.rb b/apps/workbench/app/helpers/pipeline_instances_helper.rb
index b8b6125..9d1a0c3 100644
--- a/apps/workbench/app/helpers/pipeline_instances_helper.rb
+++ b/apps/workbench/app/helpers/pipeline_instances_helper.rb
@@ -22,7 +22,12 @@ module PipelineInstancesHelper
     pj
   end
 
+  # Merge (started_at, finished_at) time range into the list of time ranges in
+  # 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'
+    # is the started_at, finished_at range which is passed in.
     timestamps.each_index do |i|
       if started_at
         if started_at >= timestamps[i][0] and finished_at <= timestamps[i][1]
@@ -57,7 +62,10 @@ 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.
   def determine_wallclock_runtime jobs
     timestamps = []
     jobs.each do |j|
@@ -206,32 +214,70 @@ module PipelineInstancesHelper
     ret
   end
 
-  def runtime duration, long
+  MINUTE = 60
+  HOUR = 60 * MINUTE
+  DAY = 24 * HOUR
+
+
+  def render_runtime duration, use_words, round_to_min=true
+    days = 0
     hours = 0
     minutes = 0
     seconds = 0
-    if duration >= 3600
-      hours = (duration / 3600).floor
-      duration -= hours * 3600
+
+    if duration >= DAY
+      days = (duration / DAY).floor
+      duration -= days * DAY
+    end
+
+    if duration >= HOUR
+      hours = (duration / HOUR).floor
+      duration -= hours * HOUR
+    end
+
+    if duration >= MINUTE
+      minutes = (duration / MINUTE).floor
+      duration -= minutes * MINUTE
     end
-    if duration >= 60
-      minutes = (duration / 60).floor
-      duration -= minutes * 60
+
+    seconds = duration.floor
+
+    if round_to_min and seconds >= 30
+      minutes += 1
     end
-    duration = duration.floor
 
-    if long
+    if use_words
       s = ""
+      if days > 0 then
+        s += "#{day} day#{'s' if days != 1}"
+      end
       if hours > 0 then
-        s += "#{hours} hour#{'s' if hours != 1} "
+        s += " #{hours} hour#{'s' if hours != 1}"
       end
       if minutes > 0 then
-        s += "#{minutes} minute#{'s' if minutes != 1} "
+        s += " #{minutes} minute#{'s' if minutes != 1}"
+      end
+      if seconds > 0 and not round_to_min 
+        s += " #{seconds} second#{'s' if seconds != 1}"
       end
-      s += "#{duration} second#{'s' if duration != 1}"
     else
-      s = "#{hours}:#{minutes.to_s.rjust(2, '0')}:#{duration.to_s.rjust(2, '0')}"
+      s = ""
+      if days > 0
+        s += "#{days}d#{hours.to_s.rjust(2, '0')}h"
+      elsif (hours > 0)
+        s += "#{hours}h"
+      end
+
+      if (hours > 0)
+        s += "#{minutes.to_s.rjust(2, '0')}m"
+      else
+        s += "#{minutes}m"
+      end
+      if not round_to_min
+        s += "#{seconds.to_s.rjust(2, '0')}s"
+      end
     end
+
     s
   end
 
diff --git a/apps/workbench/app/views/application/_show_advanced.html.erb b/apps/workbench/app/views/application/_show_advanced.html.erb
index 70dd96b..1cde5c8 100644
--- a/apps/workbench/app/views/application/_show_advanced.html.erb
+++ b/apps/workbench/app/views/application/_show_advanced.html.erb
@@ -3,7 +3,7 @@
       'Metadata',
       'Python example',
       'CLI example',
-      'curl example'].each do |section| %>
+      'Curl example'].each do |section| %>
     <% section_id = section.gsub(" ","_").downcase %>
     <div class="panel panel-default">
       <div class="panel-heading">
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 2c95c92..8e2c292 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
@@ -9,16 +9,17 @@
 
 <p>
   <% if @object.started_at %>
-    Started at <span data-utc-date="<%= @object.started_at %>"><%= @object.started_at %></span>.
+    This pipeline started at <span data-utc-date="<%= @object.started_at %>"><%= @object.started_at %></span>.
   <% end %>
 
   <% if @object.started_at %>
+    This pipeline
     <% if @object.state == 'Complete' %>
-      Completed in
+      completed in
     <% elsif @object.state == 'Failed' %>
-      Failed after
+      failed after
     <% else %>
-      Has been active for
+      has been active for
     <% end %>
 
     <% walltime = if @object.finished_at then
@@ -29,7 +30,7 @@
     
     <%= runtime(walltime, true) %><% if @object.finished_at %> at <span data-utc-date="<%= @object.finished_at %>"><%= @object.finished_at %></span><% end %>.
   <% else %>
-    Pipeline is <%= @object.state.downcase %>.
+    This pipeline is <%= if @object.state.start_with? 'Running' then 'active' else @object.state.downcase end %>.
     <% walltime = 0%>
   <% end %>
 
@@ -41,26 +42,23 @@
 <p>
     <% 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]}) %>
-
+    It
     <% if @object.state.start_with? 'Running' %>
-      Has run
-      <% else %>
-      Ran
+      has run
+    <% else %>
+      ran
     <% end %>
     for
-    <%= runtime(runningtime, true) %> 
-    <% if walltime - runningtime > 0 %>
-      (<%= runtime(walltime - runningtime, true) %> queued)<% end %><% if tasks.size == 0 %>.<% else %>
-      and used
-      <% cputime = tasks.map { |task|
-           puts "started at #{task.started_at}"
+    <%= render_runtime(runningtime, true, false) %><% cputime = tasks.map { |task|
                   if task.started_at
                     (if task.finished_at then task.finished_at else Time.now() end) - task.started_at
                   else
                     0
                   end
-                }.reduce(:+) %>
-    <%= runtime(cputime, true) %>
+                }.reduce(:+) %><% if walltime - runningtime > 0 %>
+      (<%= render_runtime(walltime - runningtime, true) %> queued)<% end %><% if cputime == 0 %>.<% else %>
+      and used
+    <%= render_runtime(cputime, true) %>
     of CPU time (<%= (cputime/runningtime).round(1) %>⨯ scaling).
     <% end %>
 </p>
@@ -82,8 +80,6 @@
             </h4>
           </div>
 
-          <% puts current_job.inspect %>
-
           <% if current_job %>
             <div class="col-md-1">
               <%= render(partial: 'job_status_label', locals: { j: current_job }) %>
@@ -99,7 +95,8 @@
                        0
                      end
                    }.reduce(:+) %>
-                <%= runtime(walltime, false) %> / <%= runtime(cputime, false) %> (<%= (cputime/walltime).round(1) %>⨯)
+                <%= render_runtime(walltime, false, false) %>
+                <% if cputime > 0 %> / <%= render_runtime(cputime, false, false) %> (<%= (cputime/walltime).round(1) %>⨯)<% end %>
               <% end %>
             </div>
 
@@ -126,7 +123,7 @@
           <% elsif Job::state(current_job) == "Queued" %>
             <div class="col-md-5">
               <% queuetime = Time.now - current_job[:created_at] %>
-              Queued for <%= runtime(queuetime, true) %>.
+              Queued for <%= render_runtime(queuetime, true) %>.
               <% begin %>
               <% if current_job.queue_position == 0 %>
                 This job is next in the queue to run.
@@ -161,7 +158,11 @@
                     <%= k.to_s %>:
                   </td>
                   <td>
-                    <%= current_component[k] %>
+                    <% if current_component[k].nil? %>
+                      (none)
+                    <% else %>
+                      <%= current_component[k] %>
+                    <% end %>
                   </td>
                 </tr>
               <% end %>
@@ -179,7 +180,7 @@
                     docker_image_locator:
                   </td>
                   <td>
-                    <%= link_to_if_arvados_object current_component[:docker_image_locator] %>
+                    <%= link_to_if_arvados_object current_component[:docker_image_locator], friendly_name: true %>
                   </td>
                 </tr>
               <% else %>
@@ -202,7 +203,9 @@
                     <%= k.to_s %>:
                   </td>
                   <td>
-                    <% if k.to_s.end_with? 'uuid' %>
+                    <% if k == :uuid %>
+                      <%= link_to_if_arvados_object current_component[k], link_text: current_component[k] %>
+                    <% elsif k.to_s.end_with? 'uuid' %>
                       <%= link_to_if_arvados_object current_component[k], friendly_name: true %>
                     <% elsif k.to_s.end_with? '_at' %>
                       <span data-utc-date="<%= current_component[k] %>"><%= current_component[k] %></span>
diff --git a/apps/workbench/app/views/projects/_show_dashboard.html.erb b/apps/workbench/app/views/projects/_show_dashboard.html.erb
index 3a70562..6fb18db 100644
--- a/apps/workbench/app/views/projects/_show_dashboard.html.erb
+++ b/apps/workbench/app/views/projects/_show_dashboard.html.erb
@@ -36,7 +36,7 @@
                       <% if v.is_a? Hash and v[:job] %>
                         <% if Job::state(v[:job]) == "Running" %>
                           <% running << k %>
-                        <% elsif Job::state(v[:job]) == "Failed" or Job::state(v[:job]) == "Canceled" %>
+                        <% elsif Job::state(v[:job]) == "Failed" or Job::state(v[:job]) == "Cancelled" %>
                           <% failed << k %>
                         <% elsif Job::state(v[:job]) == "Completed" %>
                           <% completed << k %>
@@ -70,7 +70,7 @@
                 Started at <span class="utc-date" data-utc-date="<%= p[:started_at] || p[:created_at] %>"
                                  data-utc-date-opts="noseconds"><%= p[:created_at] %></span>.
                 <% pipeline_time = Time.now - (p[:started_at] || p[:created_at]) %>
-                Active for <%= runtime(pipeline_time, false) %>.
+                Active for <%= render_runtime(pipeline_time, false) %>.
 
                 <div class="pull-right">
                   <% running.each do |k| %>
@@ -107,7 +107,7 @@
                 <div class="col-md-12">
                   <% if p[:started_at] and p[:finished_at] %>
                     <% pipeline_time = p[:finished_at] - p[:started_at] %>
-                    Active for <%= runtime(pipeline_time, false) %>
+                    Active for <%= render_runtime(pipeline_time, false) %>
                   <% end %>
 
                   <span class="pull-right x-ellip" style="max-width: 100%">

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list