[ARVADOS] updated: d980abb3bdde99007f1ebb39c1e6855c72bba833
Git user
git at public.curoverse.com
Tue Aug 30 16:36:49 EDT 2016
Summary of changes:
apps/workbench/app/models/container_work_unit.rb | 7 ---
apps/workbench/app/models/job.rb | 3 +-
apps/workbench/app/models/proxy_work_unit.rb | 9 +++
.../app/views/work_units/_show_component.html.erb | 11 ++--
.../test/integration/application_layout_test.rb | 72 ----------------------
apps/workbench/test/integration/websockets_test.rb | 17 +++--
apps/workbench/test/integration/work_units_test.rb | 72 ++++++++++++++++++++++
7 files changed, 95 insertions(+), 96 deletions(-)
discards 4d27755da78787d662259f8e63892b6c9591b971 (commit)
via d980abb3bdde99007f1ebb39c1e6855c72bba833 (commit)
via 9d2f9e74b24b1d6245358e13f1381d66a585bf2d (commit)
via 555f1f82e2f9ec4db974a69a0db43097da28cc80 (commit)
via cedab072d40380e330396d5cc3c25f7c0d131484 (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (4d27755da78787d662259f8e63892b6c9591b971)
\
N -- N -- N (d980abb3bdde99007f1ebb39c1e6855c72bba833)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit d980abb3bdde99007f1ebb39c1e6855c72bba833
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Aug 30 16:30:17 2016 -0400
9799: Fix up live_log_lines so it works for all work units.
diff --git a/apps/workbench/app/models/container_work_unit.rb b/apps/workbench/app/models/container_work_unit.rb
index a9fd416..a79f103 100644
--- a/apps/workbench/app/models/container_work_unit.rb
+++ b/apps/workbench/app/models/container_work_unit.rb
@@ -128,13 +128,6 @@ class ContainerWorkUnit < ProxyWorkUnit
[get_combined(:uuid), get(:uuid)].uniq
end
- def live_log_lines(limit=2000)
- event_types = ["stdout", "stderr", "arv-mount", "crunch-run"]
- log_lines = Log.where(event_type: event_types, object_uuid: log_object_uuids).order("id DESC").limit(limit)
- log_lines.results.reverse.
- flat_map { |log| log.properties[:text].split("\n") rescue [] }
- end
-
def render_log
collection = Collection.find(log_collection) rescue nil
if collection
diff --git a/apps/workbench/app/models/job.rb b/apps/workbench/app/models/job.rb
index 73f1f63..bf202c4 100644
--- a/apps/workbench/app/models/job.rb
+++ b/apps/workbench/app/models/job.rb
@@ -43,8 +43,7 @@ class Job < ArvadosBase
end
def stderr_log_query(limit=nil)
- query = Log.where(event_type: "stderr", object_uuid: self.uuid)
- .order("id DESC")
+ query = Log.where(object_uuid: self.uuid).order("created_at DESC")
query = query.limit(limit) if limit
query
end
diff --git a/apps/workbench/app/models/proxy_work_unit.rb b/apps/workbench/app/models/proxy_work_unit.rb
index feab5d8..11ec0ee 100644
--- a/apps/workbench/app/models/proxy_work_unit.rb
+++ b/apps/workbench/app/models/proxy_work_unit.rb
@@ -332,6 +332,15 @@ class ProxyWorkUnit < WorkUnit
[uuid]
end
+ def live_log_lines(limit)
+ Log.where(object_uuid: log_object_uuids).
+ order("created_at DESC").
+ limit(limit).
+ select { |log| log.properties[:text].is_a? String }.
+ reverse.
+ flat_map { |log| log.properties[:text].split("\n") }
+ end
+
protected
def get key, obj=@proxied
diff --git a/apps/workbench/test/integration/websockets_test.rb b/apps/workbench/test/integration/websockets_test.rb
index 3cfd792..54712d3 100644
--- a/apps/workbench/test/integration/websockets_test.rb
+++ b/apps/workbench/test/integration/websockets_test.rb
@@ -201,7 +201,6 @@ class WebsocketTest < ActionDispatch::IntegrationTest
test "test running job with just a few previous log records" do
job = api_fixture("jobs")['running']
- visit page_with_token("active", "/jobs/#{job['uuid']}")
# Create just one old log record
dispatch_log(owner_uuid: job['owner_uuid'],
@@ -209,7 +208,7 @@ class WebsocketTest < ActionDispatch::IntegrationTest
event_type: "stderr",
properties: {"text" => "Historic log message"})
- click_link("Log")
+ visit page_with_token("active", "/jobs/#{job['uuid']}\#Log")
# Expect "all" historic log records because we have less than
# default Rails.configuration.running_job_log_records_to_fetch count
@@ -224,25 +223,23 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
test "test running job with too many previous log records" do
- Rails.configuration.running_job_log_records_to_fetch = 5
-
+ max = 5
+ Rails.configuration.running_job_log_records_to_fetch = max
job = api_fixture("jobs")['running']
- visit page_with_token("active", "/jobs/#{job['uuid']}")
- # Create Rails.configuration.running_job_log_records_to_fetch + 1 log records
- (0..Rails.configuration.running_job_log_records_to_fetch).each do |count|
+ # Create max+1 log records
+ (0..max).each do |count|
dispatch_log(owner_uuid: job['owner_uuid'],
object_uuid: job['uuid'],
event_type: "stderr",
properties: {"text" => "Old log message #{count}"})
end
- # Go to log tab, which results in subscribing to websockets
- click_link("Log")
+ visit page_with_token("active", "/jobs/#{job['uuid']}\#Log")
# Expect all but the first historic log records,
# because that was one too many than fetch count.
- (1..Rails.configuration.running_job_log_records_to_fetch).each do |count|
+ (1..max).each do |count|
assert_text "Old log message #{count}"
end
assert_no_text 'Old log message 0'
commit 9d2f9e74b24b1d6245358e13f1381d66a585bf2d
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Aug 30 16:35:32 2016 -0400
9799: Remove bogus bootstrap classes and fix html syntax.
diff --git a/apps/workbench/app/views/work_units/_show_component.html.erb b/apps/workbench/app/views/work_units/_show_component.html.erb
index 43f5692..f40170a 100644
--- a/apps/workbench/app/views/work_units/_show_component.html.erb
+++ b/apps/workbench/app/views/work_units/_show_component.html.erb
@@ -1,13 +1,13 @@
<%# Work unit status %>
-<div class="container-fluid>
- <div class="row-fluid">
+<div>
+ <div>
<%# Need additional handling for main object display %>
<% if @object.uuid == wu.uuid %>
- <div class="container-fluid">
+ <div>
<div class="pull-right">
- <div class="container-fluid">
- <div class="row-fulid pipeline-instance-spacing">
+ <div>
+ <div class="pipeline-instance-spacing">
<div class="col-md-7">
<% if wu.is_running? and wu.child_summary_str %>
<%= wu.child_summary_str %>
@@ -18,10 +18,10 @@
</div>
<div class="col-md-1">
<% if wu.can_cancel? and @object.editable? %>
- <%= form_tag "#{wu.uri}/cancel", remote: true, style: "display:inline; padding-left: 1em" do |f| %>
- <%= hidden_field_tag :return_to, url_for(@object) %>
- <%= button_tag "Cancel", {class: 'btn btn-xs btn-danger', id: "cancel-obj-button"} %>
- <% end %>
+ <%= form_tag "#{wu.uri}/cancel", remote: true, style: "display:inline; padding-left: 1em" do |f| %>
+ <%= hidden_field_tag :return_to, url_for(@object) %>
+ <%= button_tag "Cancel", {class: 'btn btn-xs btn-danger', id: "cancel-obj-button"} %>
+ <% end %>
<% end %>
</div>
</div>
@@ -41,6 +41,7 @@
<%= raw(wu.show_runtime) %>
</div>
</div>
+</div>
<p>
<%= render(partial: 'work_units/component_detail', locals: {current_obj: wu}) %>
commit 555f1f82e2f9ec4db974a69a0db43097da28cc80
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Aug 30 16:23:59 2016 -0400
9799: Move work unit tests from application_layout_test to work_units_test.
diff --git a/apps/workbench/test/integration/application_layout_test.rb b/apps/workbench/test/integration/application_layout_test.rb
index e8bdbea..93827a9 100644
--- a/apps/workbench/test/integration/application_layout_test.rb
+++ b/apps/workbench/test/integration/application_layout_test.rb
@@ -286,76 +286,4 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
end
end
end
-
- [
- ['jobs', 'running_job_with_components', true],
- ['pipeline_instances', 'components_is_jobspec', false],
- ['containers', 'running', false],
- ['container_requests', 'running', true],
- ].each do |type, fixture, cancelable|
- test "cancel button for #{type}/#{fixture}" do
- if cancelable
- need_selenium 'to cancel'
- end
-
- obj = api_fixture(type)[fixture]
- visit page_with_token "active", "/#{type}/#{obj['uuid']}"
-
- assert_text 'created_at'
- if cancelable
- assert_selector 'button', text: 'Cancel'
- click_button 'Cancel'
- wait_for_ajax
- end
- assert_no_selector 'button', text: 'Cancel'
- end
- end
-
- [
- ['jobs', 'running_job_with_components'],
- ['pipeline_instances', 'has_component_with_completed_jobs'],
- ['container_requests', 'running'],
- ['container_requests', 'completed'],
- ].each do |type, fixture|
- test "edit description for #{type}/#{fixture}" do
- obj = api_fixture(type)[fixture]
- visit page_with_token "active", "/#{type}/#{obj['uuid']}"
-
- within('.arv-description-as-subtitle') do
- find('.fa-pencil').click
- find('.editable-input textarea').set('*Textile description for object*')
- find('.editable-submit').click
- end
- wait_for_ajax
-
- # verify description
- assert page.has_no_text? '*Textile description for object*'
- assert page.has_text? 'Textile description for object'
- end
- end
-
- [
- ['Two Part Pipeline Template', 'part-one', 'Provide a value for the following'],
- ['Workflow with input specifications', 'this work has inputs specified', 'This container is uncommitted'],
- ].each do |template_name, preview_txt, process_txt|
- test "run a process using template #{template_name} from dashboard" do
- visit page_with_token('admin')
- assert_text 'Recent pipelines and processes' # seeing dashboard now
-
- within('.recent-processes-actions') do
- assert page.has_link?('All processes')
- find('a', text: 'Run a pipeline').click
- end
-
- # in the chooser, verify preview and click Next button
- within('.modal-dialog') do
- find('.selectable', text: template_name).click
- assert_text preview_txt
- find('.btn', text: 'Next: choose inputs').click
- end
-
- # in the process page now
- assert_text process_txt
- end
- end
end
diff --git a/apps/workbench/test/integration/work_units_test.rb b/apps/workbench/test/integration/work_units_test.rb
index 63ba275..fb5bc63 100644
--- a/apps/workbench/test/integration/work_units_test.rb
+++ b/apps/workbench/test/integration/work_units_test.rb
@@ -55,4 +55,76 @@ class WorkUnitsTest < ActionDispatch::IntegrationTest
assert_no_selector "a[href=\"#{link}\"]"
end
end
+
+ [
+ ['jobs', 'running_job_with_components', true],
+ ['pipeline_instances', 'components_is_jobspec', false],
+ ['containers', 'running', false],
+ ['container_requests', 'running', true],
+ ].each do |type, fixture, cancelable|
+ test "cancel button for #{type}/#{fixture}" do
+ if cancelable
+ need_selenium 'to cancel'
+ end
+
+ obj = api_fixture(type)[fixture]
+ visit page_with_token "active", "/#{type}/#{obj['uuid']}"
+
+ assert_text 'created_at'
+ if cancelable
+ assert_selector 'button', text: 'Cancel'
+ click_button 'Cancel'
+ wait_for_ajax
+ end
+ assert_no_selector 'button', text: 'Cancel'
+ end
+ end
+
+ [
+ ['jobs', 'running_job_with_components'],
+ ['pipeline_instances', 'has_component_with_completed_jobs'],
+ ['container_requests', 'running'],
+ ['container_requests', 'completed'],
+ ].each do |type, fixture|
+ test "edit description for #{type}/#{fixture}" do
+ obj = api_fixture(type)[fixture]
+ visit page_with_token "active", "/#{type}/#{obj['uuid']}"
+
+ within('.arv-description-as-subtitle') do
+ find('.fa-pencil').click
+ find('.editable-input textarea').set('*Textile description for object*')
+ find('.editable-submit').click
+ end
+ wait_for_ajax
+
+ # verify description
+ assert page.has_no_text? '*Textile description for object*'
+ assert page.has_text? 'Textile description for object'
+ end
+ end
+
+ [
+ ['Two Part Pipeline Template', 'part-one', 'Provide a value for the following'],
+ ['Workflow with input specifications', 'this work has inputs specified', 'This container is uncommitted'],
+ ].each do |template_name, preview_txt, process_txt|
+ test "run a process using template #{template_name} from dashboard" do
+ visit page_with_token('admin')
+ assert_text 'Recent pipelines and processes' # seeing dashboard now
+
+ within('.recent-processes-actions') do
+ assert page.has_link?('All processes')
+ find('a', text: 'Run a pipeline').click
+ end
+
+ # in the chooser, verify preview and click Next button
+ within('.modal-dialog') do
+ find('.selectable', text: template_name).click
+ assert_text preview_txt
+ find('.btn', text: 'Next: choose inputs').click
+ end
+
+ # in the process page now
+ assert_text process_txt
+ end
+ end
end
commit cedab072d40380e330396d5cc3c25f7c0d131484
Author: Tom Clegg <tom at curoverse.com>
Date: Tue Aug 30 11:36:28 2016 -0400
9799: Fix show/hide "cancel container req" button: check ArvadosBase#editable?, and use CR priority instead of container priority.
diff --git a/apps/workbench/app/models/container_work_unit.rb b/apps/workbench/app/models/container_work_unit.rb
index 1ed182c..a9fd416 100644
--- a/apps/workbench/app/models/container_work_unit.rb
+++ b/apps/workbench/app/models/container_work_unit.rb
@@ -46,13 +46,17 @@ class ContainerWorkUnit < ProxyWorkUnit
end
def can_cancel?
- @proxied.is_a?(ContainerRequest) && state_label.in?(["Queued", "Locked", "Running"]) && priority > 0
+ @proxied.is_a?(ContainerRequest) && @proxied.state == "Committed" && @proxied.priority > 0 && @proxied.editable?
end
def container_uuid
get(:container_uuid)
end
+ def priority
+ @proxied.priority
+ end
+
# For the following properties, use value from the @container if exists
# This applies to a ContainerRequest with container_uuid
@@ -86,10 +90,6 @@ class ContainerWorkUnit < ProxyWorkUnit
get_combined(:runtime_constraints)
end
- def priority
- get_combined(:priority)
- end
-
def log_collection
get_combined(:log)
end
@@ -149,7 +149,7 @@ class ContainerWorkUnit < ProxyWorkUnit
end
end
- # End combined propeties
+ # End combined properties
protected
def get_combined key
diff --git a/apps/workbench/test/integration/application_layout_test.rb b/apps/workbench/test/integration/application_layout_test.rb
index 3edd660..e8bdbea 100644
--- a/apps/workbench/test/integration/application_layout_test.rb
+++ b/apps/workbench/test/integration/application_layout_test.rb
@@ -303,13 +303,11 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
assert_text 'created_at'
if cancelable
- assert page.has_button?('Cancel'), 'No Cancel button'
+ assert_selector 'button', text: 'Cancel'
click_button 'Cancel'
wait_for_ajax
- assert page.has_no_button?('Cancel'), 'Cancel button not expected after clicking'
- else
- assert page.has_no_button?('Cancel'), 'Cancel button not expected'
end
+ assert_no_selector 'button', text: 'Cancel'
end
end
diff --git a/apps/workbench/test/test_helper.rb b/apps/workbench/test/test_helper.rb
index 78ef2d2..73bfda6 100644
--- a/apps/workbench/test/test_helper.rb
+++ b/apps/workbench/test/test_helper.rb
@@ -32,14 +32,16 @@ class ActiveSupport::TestCase
# in integration tests -- they do not yet inherit this setting
fixtures :all
def use_token token_name
- was = Thread.current[:arvados_api_token]
+ user_was = Thread.current[:user]
+ token_was = Thread.current[:arvados_api_token]
auth = api_fixture('api_client_authorizations')[token_name.to_s]
Thread.current[:arvados_api_token] = auth['api_token']
if block_given?
begin
yield
ensure
- Thread.current[:arvados_api_token] = was
+ Thread.current[:user] = user_was
+ Thread.current[:arvados_api_token] = token_was
end
end
end
diff --git a/apps/workbench/test/unit/work_unit_test.rb b/apps/workbench/test/unit/work_unit_test.rb
index c737982..2b1cac9 100644
--- a/apps/workbench/test/unit/work_unit_test.rb
+++ b/apps/workbench/test/unit/work_unit_test.rb
@@ -91,4 +91,18 @@ class WorkUnitTest < ActiveSupport::TestCase
end
end
end
+
+ test 'can_cancel?' do
+ use_token 'active' do
+ assert find_fixture(Job, 'running').work_unit.can_cancel?
+ refute find_fixture(Container, 'running').work_unit.can_cancel?
+ assert find_fixture(ContainerRequest, 'running').work_unit.can_cancel?
+ end
+ use_token 'spectator' do
+ refute find_fixture(ContainerRequest, 'running_anonymous_accessible').work_unit.can_cancel?
+ end
+ use_token 'admin' do
+ assert find_fixture(ContainerRequest, 'running_anonymous_accessible').work_unit.can_cancel?
+ end
+ end
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list