13773: Containers & CRs show "Failing" when a child job failed.
authorLucas Di Pentima <ldipentima@veritasgenetics.com>
Wed, 5 Sep 2018 19:41:29 +0000 (16:41 -0300)
committerLucas Di Pentima <ldipentima@veritasgenetics.com>
Wed, 5 Sep 2018 19:41:29 +0000 (16:41 -0300)
Also, at the detailed view an error panel is displayed with the error message
and detail, if any.

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima@veritasgenetics.com>

apps/workbench/app/models/container_work_unit.rb
apps/workbench/app/models/proxy_work_unit.rb
apps/workbench/app/models/work_unit.rb
apps/workbench/app/views/work_units/_show_component.html.erb

index 7f1052ebcd6d279a0d6afec10ce78af3a4fd5902..94b41617390bff090cfebee0870802d275cd9cf1 100644 (file)
@@ -117,12 +117,31 @@ class ContainerWorkUnit < ProxyWorkUnit
       else
         'Failed'
       end
+    when 'Running'
+      if runtime_status[:error]
+        'Failing'
+      else
+        state
+      end
     else
-      # Cancelled, Running, or Uncommitted (no container assigned)
+      # Cancelled, or Uncommitted (no container assigned)
       state
     end
   end
 
+  def runtime_status
+    return get(:runtime_status, @container) || get(:runtime_status, @proxied)
+  end
+
+  def state_bootstrap_class
+    case state_label
+    when 'Failing'
+      'danger'
+    else
+      super
+    end
+  end
+
   def exit_code
     get_combined(:exit_code)
   end
index 02f6b42fd926eb432bec264c87b8def198a06151..adf0bd7d671db15203b1ba26e2a6188c71cd5815 100644 (file)
@@ -278,7 +278,11 @@ class ProxyWorkUnit < WorkUnit
     end
 
     if is_failed?
-      resp << " Check the Log tab for more detail about why it failed."
+      if runtime_status.andand[:error]
+        resp << " Check the error information below."
+      else
+        resp << " Check the Log tab for more detail about why it failed."
+      end
     end
     resp << "</p>"
 
index f0c4230f2ad0893786bbb83d0b628ec34bd566a6..493dd2f578a213afcd348fb0a2a1cca035592c03 100644 (file)
@@ -211,4 +211,8 @@ class WorkUnit
   def template_uuid
     # return the uuid of this work unit's template, if one exists
   end
+
+  def runtime_status
+    # Returns this work unit's runtime_status, if any
+  end
 end
index 3bba31f78268792a8c35607fb2ffa235baee0bf6..d853295767633b10c64d6449a023eacf98359d83 100644 (file)
@@ -37,6 +37,28 @@ SPDX-License-Identifier: AGPL-3.0 %>
   <% end %>
 </div>
 
+<%# Display runtime error information %>
+<% if wu.runtime_status.andand[:error] %>
+<div class="container">
+  <div class="col-md-12">
+    <div class="panel panel-danger">
+      <div class="panel-heading">Error Information</div>
+      <div class="panel-body">
+        <%= wu.runtime_status[:error] %>
+        <%# Show collapsable detailed error information, if any %>
+        <% if wu.runtime_status[:errorDetail] %>
+        <a class="btn btn-sm btn-primary pull-right" data-toggle="collapse" data-target="#errorDetail">Toggle details</a>
+        <div class="clearfix"></div>
+        <div id="errorDetail" class="collapse">
+          <pre><%= wu.runtime_status[:errorDetail] %></pre>
+        </div>
+        <% end %>
+      </div>
+    </div>
+  </div>
+</div>
+<% end %>
+
 <p>
   <%= render(partial: 'work_units/component_detail', locals: {current_obj: wu}) %>
 </p>