11185: Added "Re-run without reuse" button to the completed CR page, so that it
authorLucas Di Pentima <lucas@curoverse.com>
Wed, 26 Apr 2017 02:04:49 +0000 (23:04 -0300)
committerLucas Di Pentima <lucas@curoverse.com>
Wed, 26 Apr 2017 02:04:49 +0000 (23:04 -0300)
copies the CR modifying the arvados-cwl-runner arguments to avoid container
reuse.
Expanded related test.

apps/workbench/app/controllers/container_requests_controller.rb
apps/workbench/app/views/container_requests/_extra_tab_line_buttons.html.erb
apps/workbench/test/controllers/container_requests_controller_test.rb

index b286a9456e14e3a2538df122c31e6071fab33558..75bcebd63f7d889e8c433ac13b234c1c2690c182 100644 (file)
@@ -64,7 +64,15 @@ class ContainerRequestsController < ApplicationController
 
     @object = ContainerRequest.new
 
-    @object.command = src.command
+    # If "no reuse" requested, pass the correct argument to arvados-cwl-runner command.
+    if params[:no_reuse] and src.command[0] == 'arvados-cwl-runner'
+      command = src.command - ['--enable-reuse']
+      command.insert(1, '--disable-reuse')
+    else
+      command = src.command
+    end
+
+    @object.command = command
     @object.container_image = src.container_image
     @object.cwd = src.cwd
     @object.description = src.description
index fd7953551729d722b8cff678feb73baadc81f7d2..46f4bc919d50f00f93876668ac0d5ede2c526ed8 100644 (file)
@@ -1,7 +1,13 @@
 <% if @object.state == 'Final' %>
+  <%= link_to(copy_container_request_path('id' => @object.uuid, 'no_reuse' => true),
+      class: 'btn btn-sm btn-primary',
+      data: {toggle: :tooltip, placement: :top}, title: 'This will make a copy and take you there. You can then make any needed changes and run it without container reuse',
+      method: :post,
+      ) do %>
+    <i class="fa fa-fw fa-play"></i> Re-run without reuse
+  <% end %>
   <%= link_to(copy_container_request_path('id' => @object.uuid),
       class: 'btn btn-sm btn-primary',
-      title: 'Re-run',
       data: {toggle: :tooltip, placement: :top}, title: 'This will make a copy and take you there. You can then make any needed changes and run it',
       method: :post,
       ) do %>
index 70e042cd3dcad21a38de4b639343bef6ab7c5098..6a0dd3044560ec26d60cbfe7c9ad8d064f37d0ac 100644 (file)
@@ -30,7 +30,7 @@ class ContainerRequestsControllerTest < ActionController::TestCase
     assert_select 'Download the log', false
   end
 
-  test "completed container request offers re-run option" do
+  test "completed container request offers re-run options" do
     use_token 'active'
 
     uuid = api_fixture('container_requests')['completed']['uuid']
@@ -39,6 +39,7 @@ class ContainerRequestsControllerTest < ActionController::TestCase
     assert_response :success
 
    assert_includes @response.body, "href=\"/container_requests/#{uuid}/copy\""
+   assert_includes @response.body, "href=\"/container_requests/#{uuid}/copy?no_reuse=true\""
   end
 
   test "container request copy" do