1 <%# Copyright (C) The Arvados Authors. All rights reserved.
3 SPDX-License-Identifier: AGPL-3.0 %>
5 <% current_job = pj[:job] if pj[:job] != {} and pj[:job][:uuid] %>
6 <div class="panel panel-default">
7 <div class="panel-heading">
8 <div class="container-fluid">
9 <div class="row-fluid">
10 <%# column offset 0 %>
11 <div class="col-md-2" style="word-break:break-all;">
12 <h4 class="panel-title">
13 <a data-toggle="collapse" href="#collapse<%= i %>">
14 <%= pj[:name] %> <span class="caret"></span>
19 <%# column offset 2 %>
20 <div class="col-md-2 pipeline-instance-spacing">
21 <%= pj[:progress_bar] %>
24 <%# column offset 4 %>
25 <% if not current_job %>
26 <div class="col-md-8"></div>
28 <div class="col-md-1">
29 <% if (pipeline_display rescue nil) %>
30 <% if current_job[:state].in? ["Complete", "Failed", "Cancelled"] %>
31 <% if current_job[:log] %>
32 <% logCollection = Collection.find? current_job[:log] %>
33 <% if logCollection %>
34 <%= link_to "Log", job_path(current_job[:uuid], anchor: "Log") %>
39 <% elsif current_job[:state] == "Running" %>
40 <% job = Job.find? current_job[:uuid] %>
42 <%= link_to "Log", job_path(current_job[:uuid], anchor: "Log") %>
50 <%# column offset 5 %>
51 <% if current_job[:state] != "Queued" %>
52 <div class="col-md-3">
53 <% if current_job[:started_at] %>
54 <% walltime = ((if current_job[:finished_at] then current_job[:finished_at] else Time.now() end) - current_job[:started_at]) %>
55 <% cputime = (current_job[:runtime_constraints].andand[:min_nodes] || 1).to_i *
56 ((current_job[:finished_at] || Time.now()) - current_job[:started_at]) %>
57 <%= render_runtime(walltime, false) %>
58 <% if cputime > 0 %> / <%= render_runtime(cputime, false) %> (<%= (cputime/walltime).round(1) %>⨯)<% end %>
63 <% if current_job[:state] == "Queued" %>
64 <%# column offset 5 %>
65 <div class="col-md-6">
66 <% queuetime = Time.now - Time.parse(current_job[:created_at].to_s) %>
67 Queued for <%= render_runtime(queuetime, false) %>.
69 <% elsif current_job[:state] == "Running" %>
70 <%# column offset 8 %>
71 <div class="col-md-3">
72 <span class="task-summary-status">
73 <%= current_job[:tasks_summary][:done] %> <%= "task".pluralize(current_job[:tasks_summary][:done]) %> done,
74 <%= current_job[:tasks_summary][:failed] %> failed,
75 <%= current_job[:tasks_summary][:running] %> running,
76 <%= current_job[:tasks_summary][:todo] %> pending
79 <% elsif current_job[:state].in? ["Complete", "Failed", "Cancelled"] %>
80 <%# column offset 8 %>
81 <div class="col-md-4 text-overflow-ellipsis">
82 <% if pj[:output_uuid] %>
83 <%= link_to_arvados_object_if_readable(pj[:output_uuid], "#{pj[:output_uuid]} (Unavailable)", friendly_name: true) %>
84 <% elsif current_job[:output] %>
85 <%= link_to_arvados_object_if_readable(current_job[:output], "#{current_job[:output]} (Unavailable)", link_text: "Output of #{pj[:name]}") %>
92 <% if current_job[:state].in? ["Queued", "Running"] and @object.editable? %>
93 <%# column offset 11 %>
94 <div class="col-md-1 pipeline-instance-spacing">
95 <%= form_tag "/jobs/#{current_job[:uuid]}/cancel", remote: true, style: "display:inline; padding-left: 1em" do |f| %>
96 <%= hidden_field_tag :return_to, url_for(@object) %>
97 <%= button_tag "Cancel", {class: 'btn btn-xs btn-danger', id: "cancel-job-button"} %>
106 <div id="collapse<%= i %>" class="panel-collapse collapse <%= if expanded then 'in' end %>">
107 <div class="panel-body">
108 <div class="container">
109 <% current_component = (if current_job then current_job else pj end) %>
111 <div class="col-md-6">
113 <% # link to repo tree/file only if the repo is readable
114 # and the commit is a sha1...
116 (/^[0-9a-f]{40}$/ =~ current_component[:script_version] and
117 Repository.where(name: current_component[:repository]).first)
119 # ...and the api server provides an http:// or https:// url
120 repo = nil unless repo.andand.http_fetch_url
122 <% [:script, :repository, :script_version, :supplied_script_version, :nondeterministic].each do |k| %>
124 <td style="padding-right: 1em">
128 <% if current_component[k].nil? %>
130 <% elsif repo and k == :repository %>
131 <%= link_to current_component[k], show_repository_tree_path(id: repo.uuid, commit: current_component[:script_version], path: '/') %>
132 <% elsif repo and k == :script %>
133 <%= link_to current_component[k], show_repository_blob_path(id: repo.uuid, commit: current_component[:script_version], path: 'crunch_scripts/'+current_component[:script]) %>
134 <% elsif repo and k == :script_version %>
135 <%= link_to current_component[k], show_repository_commit_path(id: repo.uuid, commit: current_component[:script_version]) %>
137 <%= current_component[k] %>
142 <% if current_component[:runtime_constraints].andand[:docker_image] and current_component[:docker_image_locator] %>
144 <td style="padding-right: 1em">
148 <%= current_component[:runtime_constraints][:docker_image] %>
152 <td style="padding-right: 1em">
153 docker_image_locator:
156 <%= link_to_arvados_object_if_readable(current_component[:docker_image_locator],
157 current_component[:docker_image_locator], friendly_name: true) %>
162 <td style="padding-right: 1em">
172 <div class="col-md-5">
174 <% [:uuid, :modified_by_user_uuid, :priority, :created_at, :started_at, :finished_at].each do |k| %>
176 <td style="padding-right: 1em">
181 <%= link_to_arvados_object_if_readable(current_component[k], current_component[k], link_text: current_component[k]) %>
182 <% elsif k.to_s.end_with? 'uuid' %>
183 <%= link_to_arvados_object_if_readable(current_component[k], current_component[k], friendly_name: true) %>
184 <% elsif k.to_s.end_with? '_at' %>
185 <%= render_localized_date(current_component[k]) %>
187 <%= current_component[k] %>
196 <div class="col-md-12">
197 <p>script_parameters:</p>
198 <pre><%= JSON.pretty_generate(current_component[:script_parameters]) rescue nil %></pre>