[ARVADOS] updated: bbbf60994bf4fc2733d3395b870359b5a96df227

Git user git at public.curoverse.com
Fri May 27 16:58:24 EDT 2016


Summary of changes:
 apps/workbench/app/models/job_work_unit.rb         | 14 ++++-------
 apps/workbench/app/models/proxy_work_unit.rb       | 26 +++++++++------------
 apps/workbench/app/models/work_unit.rb             | 21 +++++++++--------
 .../app/views/work_unit/_component_detail.html.erb |  4 ++--
 .../app/views/work_unit/_progress.html.erb         | 13 +++++++----
 .../app/views/work_unit/_show_child.html.erb       | 27 ++++++++++++++--------
 .../app/views/work_unit/_show_component.html.erb   |  8 +++----
 7 files changed, 59 insertions(+), 54 deletions(-)

       via  bbbf60994bf4fc2733d3395b870359b5a96df227 (commit)
      from  9122f814b4c22828f64d82c48409dd4cc6cacc3f (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 bbbf60994bf4fc2733d3395b870359b5a96df227
Author: radhika <radhika at curoverse.com>
Date:   Fri May 27 16:57:31 2016 -0400

    8876: remove some job specific bits and make them generic

diff --git a/apps/workbench/app/models/job_work_unit.rb b/apps/workbench/app/models/job_work_unit.rb
index 7f1c73f..8fc3285 100644
--- a/apps/workbench/app/models/job_work_unit.rb
+++ b/apps/workbench/app/models/job_work_unit.rb
@@ -3,12 +3,6 @@ class JobWorkUnit < ProxyWorkUnit
     uuid = get(:uuid)
     items = []
 
-    # Job tasks - for now do not include job tasks
-    # tasks = JobTask.filter([['job_uuid', '=', uuid]]).results
-    # tasks.each do |t|
-    #   items << t.work_unit("task #{items.size}")
-    # end
-
     # Jobs components
     components = get(:components)
     uuids = components.andand.collect {|_, v| v}
@@ -67,6 +61,10 @@ class JobWorkUnit < ProxyWorkUnit
     get(:output)
   end
 
+  def child_summary
+    get(:tasks_summary)
+  end
+
   def can_cancel?
     true
   end
@@ -76,10 +74,6 @@ class JobWorkUnit < ProxyWorkUnit
     "/jobs/#{uuid}"
   end
 
-  def child_summary
-    get(:tasks_summary)
-  end
-
   def title
     "job"
   end
diff --git a/apps/workbench/app/models/proxy_work_unit.rb b/apps/workbench/app/models/proxy_work_unit.rb
index 52c8447..9798361 100644
--- a/apps/workbench/app/models/proxy_work_unit.rb
+++ b/apps/workbench/app/models/proxy_work_unit.rb
@@ -24,29 +24,20 @@ class ProxyWorkUnit < WorkUnit
 
   def created_at
     t = get(:created_at)
-    if t.andand.class == String
-      Time.parse t
-    else
-      t
-    end
+    t = Time.parse(t) if (t.andand.class == String)
+    t
   end
 
   def started_at
     t = get(:started_at)
-    if t.andand.class == String
-      Time.parse t
-    else
-      t
-    end
+    t = Time.parse(t) if (t.andand.class == String)
+    t
   end
 
   def finished_at
     t = get(:finished_at)
-    if t.andand.class == String
-      Time.parse t
-    else
-      t
-    end
+    t = Time.parse(t) if (t.andand.class == String)
+    t
   end
 
   def state_label
@@ -119,6 +110,11 @@ class ProxyWorkUnit < WorkUnit
     self.unreadable_children
   end
 
+  def readable?
+    resource_class = ArvadosBase::resource_class_for_uuid(uuid)
+    resource_class.where(uuid: [uuid]).first rescue nil
+  end
+
   protected
 
   def get key
diff --git a/apps/workbench/app/models/work_unit.rb b/apps/workbench/app/models/work_unit.rb
index aea0f12..7439128 100644
--- a/apps/workbench/app/models/work_unit.rb
+++ b/apps/workbench/app/models/work_unit.rb
@@ -1,6 +1,5 @@
 class WorkUnit
-  # This is just an abstract class that documents the WorkUnit interface; a
-  # class can implement the interface without being a subclass of WorkUnit.
+  # This is an abstract class that documents the WorkUnit interface
 
   def label
     # returns the label that was assigned when creating the work unit
@@ -39,12 +38,12 @@ class WorkUnit
   end
 
   def success?
-    # returnis true if the work unit finished successfully,
+    # returns true if the work unit finished successfully,
     # false if it has a permanent failure,
     # and nil if the final state is not determined.
   end
 
-  def progress 
+  def progress
     # returns a number between 0 and 1
   end
 
@@ -92,16 +91,20 @@ class WorkUnit
     # returns uuid or pdh of output data, if any
   end
 
+  def child_summary
+    # summary status of any children of this work unit
+  end
+
   def can_cancel?
-    # returns if this work unit is cancelable
+    # returns true if this work unit can be canceled
   end
 
-  def uri
-    # returns the uri for this work unit
+  def readable?
+    # is the proxied object readable by current user?
   end
 
-  def child_summary
-    # summary status of any children of this work unit
+  def uri
+    # returns the uri for this work unit
   end
 
   def title
diff --git a/apps/workbench/app/views/work_unit/_component_detail.html.erb b/apps/workbench/app/views/work_unit/_component_detail.html.erb
index eeb78f9..d68273a 100644
--- a/apps/workbench/app/views/work_unit/_component_detail.html.erb
+++ b/apps/workbench/app/views/work_unit/_component_detail.html.erb
@@ -4,7 +4,7 @@
             <table>
               <% [:uuid, :modified_by_user_uuid, :created_at, :started_at, :finished_at, :output, :priority].each do |k| %>
                 <% val = current_obj.send(k) if current_obj.respond_to?(k) %>
-                <% unless val.nil? %>
+                <% if val %>
                 <tr>
                   <td style="padding-right: 1em">
                     <%= k.to_s %>:
@@ -40,7 +40,7 @@
                  %>
               <% [:script, :repository, :script_version, :supplied_script_version, :nondeterministic].each do |k| %>
                 <% val = current_obj.send(k) if current_obj.respond_to?(k) %>
-                <% unless val.nil? %>
+                <% if val %>
                 <tr>
                   <td style="padding-right: 1em">
                     <%= k.to_s %>:
diff --git a/apps/workbench/app/views/work_unit/_progress.html.erb b/apps/workbench/app/views/work_unit/_progress.html.erb
index caee251..ef7dcd9 100644
--- a/apps/workbench/app/views/work_unit/_progress.html.erb
+++ b/apps/workbench/app/views/work_unit/_progress.html.erb
@@ -1,7 +1,12 @@
 <% if wu.state_label == 'Running' %>
-  <div class="progress" style="margin-bottom: 0px">
-    <span class="progress-bar progress-bar-<%= wu.state_bootstrap_class %>" style="width: <%= wu.progress*100 %>%;"></span>
-  </div>
+  <% if @object.uuid == wu.uuid and wu.progress == 0.0 %>
+    <span class="label label-<%= wu.state_bootstrap_class %>"> Active </span>
+  <% else%>
+    <div class="progress" style="margin-bottom: 0px">
+      <span class="progress-bar progress-bar-<%= wu.state_bootstrap_class %>" style="width: <%= wu.progress*100 %>%;">
+      </span>
+    </div>
+  <% end %>
 <% else %>
-  <span class="label label-<%= wu.state_bootstrap_class %>"><%= wu.state_label%></span>
+  <span class="label label-<%= wu.state_bootstrap_class %>"><%= wu.state_label %></span>
 <% end %>
diff --git a/apps/workbench/app/views/work_unit/_show_child.html.erb b/apps/workbench/app/views/work_unit/_show_child.html.erb
index a93895b..0824871 100644
--- a/apps/workbench/app/views/work_unit/_show_child.html.erb
+++ b/apps/workbench/app/views/work_unit/_show_child.html.erb
@@ -25,15 +25,14 @@
                 <% if current_obj.log_collection %>
                   <% logCollection = Collection.find? current_obj.log_collection %>
                   <% if logCollection %>
-                    <%= link_to "Log", job_path(current_obj.uuid, anchor: "Log") %>
+                    <%= link_to "Log", "#{current_obj.uri}#Log" %>
                   <% else %>
                     Log unavailable
                   <% end %>
                 <% end %>
               <% elsif current_obj.state_label == "Running" %>
-                <% job = Job.find? current_obj.uuid %>
-                <% if job %>
-                  <%= link_to "Log", job_path(current_obj.uuid, anchor: "Log") %>
+                <% if current_obj.readable? %>
+                  <%= link_to "Log", "#{current_obj.uri}#Log" %>
                 <% else %>
                   Log unavailable
                 <% end %>
@@ -64,10 +63,18 @@
               <%# column offset 8 %>
               <div class="col-md-3">
                 <span class="task-summary-status">
-                  <%= current_obj.child_summary[:done] %> <%= "task".pluralize(current_obj.child_summary[:done]) %> done,
-                  <%= current_obj.child_summary[:failed] %> failed,
-                  <%= current_obj.child_summary[:running] %> running,
-                  <%= current_obj.child_summary[:todo] %> pending
+                  <% if current_obj.child_summary[:done] %>
+                    <%= current_obj.child_summary[:done] %> <%= "child".pluralize(current_obj.child_summary[:done]) %> done,
+                  <% end %>
+                  <% if current_obj.child_summary[:failed] %>
+                    <%= current_obj.child_summary[:failed] %> failed,
+                  <% end %>
+                  <% if current_obj.child_summary[:running] %>
+                    <%= current_obj.child_summary[:running] %> running,
+                  <% end %>
+                  <% if current_obj.child_summary[:todo] %>
+                    <%= current_obj.child_summary[:todo] %> pending
+                  <% end %>
                 </span>
               </div>
             <% end %>
@@ -84,12 +91,12 @@
             </div>
           <% end %>
 
-          <% if current_obj.state_label.in? ["Queued", "Running"] and @object.work_unit.can_cancel? and @object.editable? %>
+          <% if current_obj.state_label.in? ["Queued", "Running"] and current_obj.can_cancel? and @object.editable? %>
             <%# column offset 11 %>
             <div class="col-md-1 pipeline-instance-spacing">
               <%= form_tag "#{current_obj.uri}/cancel", remote: true, 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"} %>
+                <%= button_tag "Cancel", {class: 'btn btn-xs btn-danger', id: "cancel-child-button"} %>
               <% end %>
             </div>
           <% end %>
diff --git a/apps/workbench/app/views/work_unit/_show_component.html.erb b/apps/workbench/app/views/work_unit/_show_component.html.erb
index a42c3c0..23ac3d3 100644
--- a/apps/workbench/app/views/work_unit/_show_component.html.erb
+++ b/apps/workbench/app/views/work_unit/_show_component.html.erb
@@ -12,7 +12,7 @@
                 <div class="col-md-1">
                   <%= form_tag "#{wu.uri}/cancel", remote: true, 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"} %>
+                    <%= button_tag "Cancel", {class: 'btn btn-xs btn-danger', id: "cancel-obj-button"} %>
                   <% end %>
                 </div>
             <% end %>
@@ -29,7 +29,7 @@
       <% if wu.state_label == 'Paused' %>
         <p>
           This <%= wu.title %> is paused. Children that are
-          already running will continue to run, but no new work units will be submitted.
+          already running will continue to run, but no new work will be submitted.
         </p>
       <% end %>
 
@@ -60,7 +60,7 @@
               end %><% if wu.finished_at %> at <%= render_localized_date(wu.finished_at) %><% end %>.
         <% else %>
           <% if wu.state_label %> This <%= wu.title %> is <%= if wu.state_label == 'Running' then 'active' else wu.state_label.downcase end %>. <% end %>
-            <% walltime = 0%>
+            <% walltime = 0 %>
         <% end %>
 
         <% if wu.state_label == 'Failed' %>
@@ -122,7 +122,7 @@
              locals: {error_name: "Unreadable components", backtrace: nil, wu: wu}) %>
 <% else %>
   <% @descendent_count = 0 if !@descendent_count %>
-  <% wu.children.each_with_index do |c, i| %>
+  <% wu.children.each do |c| %>
     <% @descendent_count += 1 %>
     <%= render(partial: 'work_unit/show_child', locals: {current_obj: c, i: @descendent_count, expanded: false}) %>
   <% end %>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list