Bugfix extra space in display in render_runtime and queued time for pipeline.
[arvados.git] / apps / workbench / app / views / pipeline_instances / _show_components_running.html.erb
1 <%# Summary %>
2
3 <% if @object.state == 'Paused' %>
4   <p>
5     This pipeline is paused.  Jobs that are
6     already running will continue to run, but no new jobs will be submitted.
7   </p>
8 <% end %>
9
10 <% tasks = JobTask.filter([['job_uuid', 'in', render_pipeline_jobs.map { |j| j[:job].andand[:uuid] }]]).results %>
11 <% runningtime = determine_wallclock_runtime(render_pipeline_jobs.map {|j| j[:job]}) %>
12
13 <p>
14   <% if @object.started_at %>
15     This pipeline started at <%= render_localized_date(@object.started_at) %>.
16     It 
17     <% if @object.state == 'Complete' %>
18       completed in
19     <% elsif @object.state == 'Failed' %>
20       failed after
21     <% else %>
22       has been active for
23     <% end %>
24
25     <% walltime = if @object.finished_at then
26                     @object.finished_at - @object.started_at
27                   else
28                     Time.now - @object.started_at
29                   end %>
30     
31     <%= if walltime > runningtime 
32           render_runtime(walltime, true) 
33         else 
34           render_runtime(runningtime, true) 
35         end %><% if @object.finished_at %> at <%= render_localized_date(@object.finished_at) %><% end %>.
36     <% else %>
37       This pipeline is <%= if @object.state.start_with? 'Running' then 'active' else @object.state.downcase end %>.
38         <% walltime = 0%>
39     <% end %>
40
41   <% if @object.state == 'Failed' %>
42     Check the Log tab for more detail about why this pipeline failed.
43   <% end %>
44 </p>
45
46 <p>
47     This pipeline
48     <% if @object.state.start_with? 'Running' %>
49       has run
50     <% else %>
51       ran
52     <% end %>
53     for
54     <% cputime = tasks.map { |task|
55          if task.started_at
56            (if task.finished_at then task.finished_at else Time.now() end) - task.started_at
57            else
58          0
59        end
60        }.reduce(:+) || 0 %>
61     <%= render_runtime(runningtime, true, false) %><% if (walltime - runningtime) > 0 %>
62       (<%= render_runtime(walltime - runningtime, true, false) %> queued)<% end %><% if cputime == 0 %>.<% else %>
63       and used
64     <%= render_runtime(cputime, true) %>
65     of CPU time (<%= (cputime/runningtime).round(1) %>&Cross; scaling).
66     <% end %>
67 </p>
68
69 <%# Components %>
70
71 <% render_pipeline_jobs.each_with_index do |pj, i| %>
72   <%= render partial: 'running_component', locals: {tasks: tasks, pj: pj, i: i, expanded: false} %>
73 <% end %>