Add 'apps/arv-web/' from commit 'f9732ad8460d013c2f28363655d0d1b91894dca5'
[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 <% tasks = JobTask.filter([['job_uuid', 'in', job_uuids]]).results %>
24 <% runningtime = determine_wallclock_runtime(pipeline_jobs.map {|j| j[:job]}.compact) %>
25
26 <p>
27   <% if @object.started_at %>
28     This pipeline started at <%= render_localized_date(@object.started_at) %>.
29     It
30     <% if @object.state == 'Complete' %>
31       completed in
32     <% elsif @object.state == 'Failed' %>
33       failed after
34     <% else %>
35       has been active for
36     <% end %>
37
38     <% walltime = if @object.finished_at then
39                     @object.finished_at - @object.started_at
40                   else
41                     Time.now - @object.started_at
42                   end %>
43
44     <%= if walltime > runningtime
45           render_runtime(walltime, true, false)
46         else
47           render_runtime(runningtime, true, false)
48         end %><% if @object.finished_at %> at <%= render_localized_date(@object.finished_at) %><% end %>.
49     <% else %>
50       This pipeline is <%= if @object.state.start_with? 'Running' then 'active' else @object.state.downcase end %>.
51         <% walltime = 0%>
52     <% end %>
53
54   <% if @object.state == 'Failed' %>
55     Check the Log tab for more detail about why this pipeline failed.
56   <% end %>
57 </p>
58
59 <p>
60     This pipeline
61     <% if @object.state.start_with? 'Running' %>
62       has run
63     <% else %>
64       ran
65     <% end %>
66     for
67     <% cputime = tasks.map { |task|
68          if task.started_at
69            (if task.finished_at then task.finished_at else Time.now() end) - task.started_at
70            else
71          0
72        end
73        }.reduce(:+) || 0 %>
74     <%= render_runtime(runningtime, true, false) %><% if (walltime - runningtime) > 0 %>
75       (<%= render_runtime(walltime - runningtime, true, false) %> queued)<% end %><% if cputime == 0 %>.<% else %>
76       and used
77     <%= render_runtime(cputime, true, false) %>
78     of CPU time (<%= (cputime/runningtime).round(1) %>&Cross; scaling).
79     <% end %>
80 </p>
81
82 <%# Components %>
83
84 <% pipeline_jobs.each_with_index do |pj, i| %>
85   <%= render partial: 'running_component', locals: {tasks: tasks, pj: pj, i: i, expanded: false} %>
86 <% end %>