8784: Fix test for latest firefox.
[arvados.git] / apps / workbench / app / views / pipeline_instances / _show_components_running.html.erb
1 <%# Summary %>
2
3 <div class="pull-right" style="padding-left: 1em">
4   Current state: <span class="badge badge-info" data-pipeline-state="<%= @object.state %>">
5     <% if @object.state == "RunningOnServer" %>
6       Active
7     <% else %>
8       <%= @object.state %>
9     <% end %>
10   </span>&nbsp;
11 </div>
12
13 <% pipeline_jobs = render_pipeline_jobs %>
14 <% job_uuids = pipeline_jobs.map { |j| j[:job].andand[:uuid] }.compact %>
15
16 <% if @object.state == 'Paused' %>
17   <p>
18     This pipeline is paused.  Jobs that are
19     already running will continue to run, but no new jobs will be submitted.
20   </p>
21 <% end %>
22
23 <% runningtime = determine_wallclock_runtime(pipeline_jobs.map {|j| j[:job]}.compact) %>
24
25 <p>
26   <% if @object.started_at %>
27     This pipeline started at <%= render_localized_date(@object.started_at) %>.
28     It
29     <% if @object.state == 'Complete' %>
30       completed in
31     <% elsif @object.state == 'Failed' %>
32       failed after
33     <% else %>
34       has been active for
35     <% end %>
36
37     <% walltime = if @object.finished_at then
38                     @object.finished_at - @object.started_at
39                   else
40                     Time.now - @object.started_at
41                   end %>
42
43     <%= if walltime > runningtime
44           render_runtime(walltime, false)
45         else
46           render_runtime(runningtime, false)
47         end %><% if @object.finished_at %> at <%= render_localized_date(@object.finished_at) %><% end %>.
48     <% else %>
49       This pipeline is <%= if @object.state.start_with? 'Running' then 'active' else @object.state.downcase end %>.
50         <% walltime = 0%>
51     <% end %>
52
53   <% if @object.state == 'Failed' %>
54     Check the Log tab for more detail about why this pipeline failed.
55   <% end %>
56 </p>
57
58 <p>
59     This pipeline
60     <% if @object.state.start_with? 'Running' %>
61       has run
62     <% else %>
63       ran
64     <% end %>
65     for
66     <%
67         cputime = pipeline_jobs.map { |j|
68         if j[:job][:started_at]
69           (j[:job][:runtime_constraints].andand[:min_nodes] || 1).to_i * ((j[:job][:finished_at] || Time.now()) - j[:job][:started_at])
70         else
71           0
72         end
73        }.reduce(:+) || 0 %>
74     <%= render_runtime(runningtime, false) %><% if (walltime - runningtime) > 0 %>
75       (<%= render_runtime(walltime - runningtime, false) %> queued)<% end %><% if cputime == 0 %>.<% else %>
76       and used
77     <%= render_runtime(cputime, false) %>
78     of node allocation time (<%= (cputime/runningtime).round(1) %>&Cross; scaling).
79     <% end %>
80 </p>
81
82 <%# Components %>
83
84 <%
85   job_uuids = pipeline_jobs.collect {|j| j[:job][:uuid]}.compact
86   if job_uuids.any?
87     resource_class = resource_class_for_uuid(job_uuids.first, friendly_name: true)
88     preload_objects_for_dataclass resource_class, job_uuids
89   end
90
91   job_collections = pipeline_jobs.collect {|j| j[:job][:output]}.compact
92   job_collections.concat pipeline_jobs.collect {|j| j[:job][:docker_image_locator]}.uniq.compact
93   job_collections_pdhs = job_collections.select {|x| !(m = CollectionsHelper.match(x)).nil?}.uniq.compact
94   job_collections_uuids = job_collections - job_collections_pdhs
95   preload_collections_for_objects job_collections_uuids if job_collections_uuids.any?
96   preload_for_pdhs job_collections_pdhs if job_collections_pdhs.any?
97 %>
98
99 <% pipeline_jobs.each_with_index do |pj, i| %>
100   <%= render partial: 'running_component', locals: {pj: pj, i: i, expanded: false, pipeline_display: true} %>
101 <% end %>