[ARVADOS] created: 89537fa2b54a22b657705894227b8bd58aeabda4
git at public.curoverse.com
git at public.curoverse.com
Thu Dec 3 16:02:00 EST 2015
at 89537fa2b54a22b657705894227b8bd58aeabda4 (commit)
commit 89537fa2b54a22b657705894227b8bd58aeabda4
Author: radhika <radhika at curoverse.com>
Date: Thu Dec 3 16:00:52 2015 -0500
7753: Add a Log link to pipeline_instance component panel
diff --git a/apps/workbench/app/models/pipeline_instance.rb b/apps/workbench/app/models/pipeline_instance.rb
index 03d70b2..6e556d5 100644
--- a/apps/workbench/app/models/pipeline_instance.rb
+++ b/apps/workbench/app/models/pipeline_instance.rb
@@ -92,6 +92,10 @@ class PipelineInstance < ArvadosBase
components_map { |cspec| cspec[:job][:log] rescue nil }
end
+ def job_ids
+ components_map { |cspec| cspec[:job][:uuid] rescue nil }
+ end
+
def stderr_log_object_uuids
result = job_uuids.values.compact
result << uuid
diff --git a/apps/workbench/app/views/pipeline_instances/_running_component.html.erb b/apps/workbench/app/views/pipeline_instances/_running_component.html.erb
index 63a2371..d4a87b3 100644
--- a/apps/workbench/app/views/pipeline_instances/_running_component.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/_running_component.html.erb
@@ -4,7 +4,7 @@
<div class="container-fluid">
<div class="row-fluid">
<%# column offset 0 %>
- <div class="col-md-3" style="word-break:break-all;">
+ <div class="col-md-2" style="word-break:break-all;">
<h4 class="panel-title">
<a data-toggle="collapse" href="#collapse<%= i %>">
<%= pj[:name] %> <span class="caret"></span>
@@ -12,12 +12,26 @@
</h4>
</div>
- <%# column offset 3 %>
+ <%# column offset 2 %>
<div class="col-md-2 pipeline-instance-spacing">
<%= pj[:progress_bar] %>
</div>
<% if current_job %>
+ <%# column offset 4 %>
+ <% if current_job[:state].in? ["Running", "Complete", "Failed", "Cancelled"] %>
+ <div class="col-md-1">
+ <% if current_job[:log] %>
+ <% logCollection = Collection.find? current_job[:log] %>
+ <% if logCollection %>
+ <%= link_to "Job log", job_path(current_job[:uuid], anchor: "Log") %>
+ <% else %>
+ Log unavailable
+ <% end %>
+ <% end %>
+ </div>
+ <% end %>
+
<%# column offset 5 %>
<% if current_job[:state] != "Queued" %>
<div class="col-md-3">
diff --git a/apps/workbench/app/views/pipeline_instances/_show_log.html.erb b/apps/workbench/app/views/pipeline_instances/_show_log.html.erb
index 187dce7..3a4ec4e 100644
--- a/apps/workbench/app/views/pipeline_instances/_show_log.html.erb
+++ b/apps/workbench/app/views/pipeline_instances/_show_log.html.erb
@@ -1,4 +1,5 @@
<% log_ids = @object.job_log_ids
+ job_ids = @object.job_ids
still_logging, done_logging = log_ids.keys.partition { |k| log_ids[k].nil? }
%>
@@ -19,7 +20,7 @@
<tr>
<td><%= cname %></td>
<td><%= link_to("Log for #{cname}",
- {controller: "collections", action: "show", id: log_ids[cname]})
+ job_path(job_ids[cname], anchor: "Log"))
%></td>
</tr>
<% end %>
diff --git a/apps/workbench/test/integration/anonymous_access_test.rb b/apps/workbench/test/integration/anonymous_access_test.rb
index aabbf00..be9799c 100644
--- a/apps/workbench/test/integration/anonymous_access_test.rb
+++ b/apps/workbench/test/integration/anonymous_access_test.rb
@@ -218,18 +218,18 @@ class AnonymousAccessTest < ActionDispatch::IntegrationTest
if pipeline_page
object = api_fixture('pipeline_instances')[fixture]
- page = "/pipeline_instances/#{object['uuid']}"
+ page_link = "/pipeline_instances/#{object['uuid']}"
expect_log_text = "Log for foo"
else # job
object = api_fixture('jobs')[fixture]
- page = "/jobs/#{object['uuid']}"
+ page_link = "/jobs/#{object['uuid']}"
expect_log_text = "stderr crunchstat"
end
if user
- visit page_with_token user, page
+ visit page_with_token user, page_link
else
- visit page
+ visit page_link
end
# click job link, if in pipeline page
@@ -241,7 +241,12 @@ class AnonymousAccessTest < ActionDispatch::IntegrationTest
assert_no_text 'Output data not available'
if pipeline_page
assert_text 'This pipeline was created from'
- assert_selector 'a', text: object['components']['foo']['job']['uuid']
+ job_id = object['components']['foo']['job']['uuid']
+ assert_selector 'a', text: job_id
+ if object['components']['foo']['job']['log']
+ assert_selector "a[href=\"/jobs/#{job_id}#Log\"]", text: 'Job log'
+ end
+
# We'd like to test the Log tab on job pages too, but we can't right
# now because Poltergeist 1.x doesn't support JavaScript's
# Function.prototype.bind, which is used by job_log_graph.js.
@@ -250,6 +255,7 @@ class AnonymousAccessTest < ActionDispatch::IntegrationTest
end
else
assert_selector 'a[data-toggle="disabled"]', text: 'Log'
+ assert_text 'Log unavailable'
assert_text 'Output data not available'
assert_text object['job']
if pipeline_page
diff --git a/apps/workbench/test/integration/pipeline_instances_test.rb b/apps/workbench/test/integration/pipeline_instances_test.rb
index 8617c37..612493a 100644
--- a/apps/workbench/test/integration/pipeline_instances_test.rb
+++ b/apps/workbench/test/integration/pipeline_instances_test.rb
@@ -550,7 +550,7 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest
assert_text "Log for previous"
log_link = find("a", text: "Log for previous")
assert_includes(log_link[:href],
- pi["components"]["previous"]["job"]["log"])
+ "/jobs/#{pi["components"]["previous"]["job"]["uuid"]}#Log")
assert_selector "#event_log_div"
end
end
@@ -563,7 +563,7 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest
assert_text "Log for previous"
pi["components"].each do |cname, cspec|
log_link = find("a", text: "Log for #{cname}")
- assert_includes(log_link[:href], cspec["job"]["log"])
+ assert_includes(log_link[:href], "/jobs/#{cspec["job"]["uuid"]}#Log")
end
assert_no_selector "#event_log_div"
end
@@ -577,7 +577,7 @@ class PipelineInstancesTest < ActionDispatch::IntegrationTest
assert_text "Log for previous"
pi["components"].each do |cname, cspec|
log_link = find("a", text: "Log for #{cname}")
- assert_includes(log_link[:href], cspec["job"]["log"])
+ assert_includes(log_link[:href], "/jobs/#{cspec["job"]["uuid"]}#Log")
end
assert_no_selector "#event_log_div"
end
diff --git a/services/api/test/fixtures/jobs.yml b/services/api/test/fixtures/jobs.yml
index 8a4c345..12493e3 100644
--- a/services/api/test/fixtures/jobs.yml
+++ b/services/api/test/fixtures/jobs.yml
@@ -482,7 +482,7 @@ completed_job_in_publicly_accessible_project:
script_parameters:
input: fa7aeb5140e2848d39b416daeef4ffc5+45
input2: "stuff2"
- log: ~
+ log: zzzzz-4zz18-4en62shvi99lxd4
output: b519d9cb706a29fc7ea24dbea2f05851+93
job_in_publicly_accessible_project_but_other_objects_elsewhere:
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list