[ARVADOS] updated: 4e8745c2a744a2c3e6b44ee6100fb1a26749cebf

git at public.curoverse.com git at public.curoverse.com
Thu Sep 25 20:41:47 EDT 2014


Summary of changes:
 .../app/helpers/pipeline_instances_helper.rb       | 13 ++++++++++++
 apps/workbench/app/models/job.rb                   | 23 ----------------------
 .../views/application/_job_status_label.html.erb   |  3 +--
 .../pipeline_instances/_running_component.html.erb |  6 +++---
 .../app/views/projects/_show_dashboard.html.erb    |  8 ++++----
 5 files changed, 21 insertions(+), 32 deletions(-)

       via  4e8745c2a744a2c3e6b44ee6100fb1a26749cebf (commit)
      from  1d135e43d06148b100fbc8534144b405e4824af9 (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 4e8745c2a744a2c3e6b44ee6100fb1a26749cebf
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Sep 25 20:41:41 2014 -0400

    3899: Set :state in pipeline_instance_helper.rb and remove Job::state.

diff --git a/apps/workbench/app/helpers/pipeline_instances_helper.rb b/apps/workbench/app/helpers/pipeline_instances_helper.rb
index ca48306..78f491a 100644
--- a/apps/workbench/app/helpers/pipeline_instances_helper.rb
+++ b/apps/workbench/app/helpers/pipeline_instances_helper.rb
@@ -104,6 +104,19 @@ module PipelineInstancesHelper
         pj[:job] = job[c[:job][:uuid]]
       else
         pj[:job] = c[:job].is_a?(Hash) ? c[:job] : {}
+
+        # Figure out the state based on the other fields.
+        pj[:job][:state] = if pj[:job][:cancelled_at]
+          "Cancelled"
+        elsif pj[:job][:success] == false
+          "Failed"
+        elsif pj[:job][:success] == true
+          "Complete"
+        elsif pj[:job][:running] == true
+          "Running"
+        else
+          "Queued"
+        end
       end
       pj[:percent_done] = 0
       pj[:percent_running] = 0
diff --git a/apps/workbench/app/models/job.rb b/apps/workbench/app/models/job.rb
index f933c07..977eef9 100644
--- a/apps/workbench/app/models/job.rb
+++ b/apps/workbench/app/models/job.rb
@@ -46,29 +46,6 @@ class Job < ArvadosBase
     arvados_api_client.unpack_api_response arvados_api_client.api("jobs/", "queue", {"_method"=> "GET"})
   end
 
-  # The 'job' parameter can be either a Job model object, or a hash containing
-  # the same fields as a Job object (such as the :job entry of a pipeline
-  # component).
-  def self.state job
-    # This has a valid state method on it so call that
-    if job.respond_to? :state and job.state
-      return job.state
-    end
-
-    # Figure out the state based on the other fields.
-    if job[:cancelled_at]
-      "Cancelled"
-    elsif job[:success] == false
-      "Failed"
-    elsif job[:success] == true
-      "Complete"
-    elsif job[:running] == true
-      "Running"
-    else
-      "Queued"
-    end
-  end
-
   def textile_attributes
     [ 'description' ]
   end
diff --git a/apps/workbench/app/views/application/_job_status_label.html.erb b/apps/workbench/app/views/application/_job_status_label.html.erb
index 0d012db..17073fe 100644
--- a/apps/workbench/app/views/application/_job_status_label.html.erb
+++ b/apps/workbench/app/views/application/_job_status_label.html.erb
@@ -1,4 +1,3 @@
-<% status = Job::state j %>
 <% to_label = {
      "Cancelled" => "danger",
      "Complete" => "success",
@@ -8,4 +7,4 @@
      nil => "default"
    } %>
 
-  <span class="label label-<%= to_label[status] %>"><%= if defined? title then title else status.downcase end %></span>
+  <span class="label label-<%= to_label[j[:state]] %>"><%= if defined? title then title else j[:state].downcase end %></span>
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 be3aba8..8613d54 100644
--- a/apps/workbench/app/views/pipeline_instances/_running_component.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/_running_component.html.erb
@@ -31,7 +31,7 @@
               <% end %>
             </div>
 
-            <% if Job::state(current_job).in? ["Complete", "Failed", "Cancelled"] %>
+            <% if current_job[:state].in? ["Complete", "Failed", "Cancelled"] %>
               <div class="col-md-5 text-overflow-ellipsis">
                 <% if pj[:output_uuid] %>
                   <%= link_to_if_arvados_object pj[:output_uuid], friendly_name: true %>
@@ -41,7 +41,7 @@
                   No output.
                 <% end %>
               </div>
-            <% elsif Job::state(current_job) == "Running" %>
+            <% elsif current_job[:state] == "Running" %>
               <div class="col-md-3 pipeline-instance-spacing">
                 <%= pj[:progress_bar] %>
               </div>
@@ -51,7 +51,7 @@
                 <%= button_tag "Cancel", {class: 'btn btn-xs btn-danger', id: "cancel-job-button"} %>
             </div>
             <% end %>
-          <% elsif Job::state(current_job) == "Queued" %>
+          <% elsif current_job[:state] == "Queued" %>
             <div class="col-md-5">
               <% queuetime = Time.now - current_job[:created_at] %>
               Queued for <%= render_runtime(queuetime, true) %>.
diff --git a/apps/workbench/app/views/projects/_show_dashboard.html.erb b/apps/workbench/app/views/projects/_show_dashboard.html.erb
index 2841637..d802825 100644
--- a/apps/workbench/app/views/projects/_show_dashboard.html.erb
+++ b/apps/workbench/app/views/projects/_show_dashboard.html.erb
@@ -34,13 +34,13 @@
                     <% queued = [] %>
                     <% p.components.each do |k, v| %>
                       <% if v.is_a? Hash and v[:job] %>
-                        <% if Job::state(v[:job]) == "Running" %>
+                        <% if v[:job][:state] == "Running" %>
                           <% running << k %>
-                        <% elsif Job::state(v[:job]) == "Failed" or Job::state(v[:job]) == "Cancelled" %>
+                        <% elsif v[:job][:state] == "Failed" or v[:job][:state] == "Cancelled" %>
                           <% failed << k %>
-                        <% elsif Job::state(v[:job]) == "Complete" %>
+                        <% elsif v[:job][:state] == "Complete" %>
                           <% completed << k %>
-                        <% elsif Job::state(v[:job]) == "Queued" %>
+                        <% elsif v[:job][:state] == "Queued" %>
                           <% queued << k %>
                         <% end %>
                       <% end %>

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list