[ARVADOS] updated: 65da23323c06079612db9285e0ab2bd1ac9ea253
Git user
git at public.curoverse.com
Thu Apr 27 11:44:01 EDT 2017
Summary of changes:
.../app/controllers/container_requests_controller.rb | 17 ++++++++++++-----
.../container_requests/_extra_tab_line_buttons.html.erb | 4 ++--
.../controllers/container_requests_controller_test.rb | 12 +++++++++---
3 files changed, 23 insertions(+), 10 deletions(-)
via 65da23323c06079612db9285e0ab2bd1ac9ea253 (commit)
from 8c948701e887e96f05ffaf0adaec9da9f2533f72 (commit)
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 65da23323c06079612db9285e0ab2bd1ac9ea253
Author: Lucas Di Pentima <lucas at curoverse.com>
Date: Thu Apr 27 12:42:49 2017 -0300
11185: When re-run, the default behaviour is to copy reuse disabled. Changed modal dialog to allow
the user to enable reuse.
Updated tests.
diff --git a/apps/workbench/app/controllers/container_requests_controller.rb b/apps/workbench/app/controllers/container_requests_controller.rb
index 36bda08..51ad4b6 100644
--- a/apps/workbench/app/controllers/container_requests_controller.rb
+++ b/apps/workbench/app/controllers/container_requests_controller.rb
@@ -64,15 +64,23 @@ class ContainerRequestsController < ApplicationController
@object = ContainerRequest.new
- if params[:no_reuse]
+ # By default the copied CR won't be reusing jobs, unless use_existing=true param
+ # is passed.
+ command = src.command
+ if params[:use_existing]
+ @object.use_existing = true
+ # Pass the correct argument to arvados-cwl-runner command.
+ if src.command[0] == 'arvados-cwl-runner'
+ command = src.command - ['--disable-reuse']
+ command.insert(1, '--enable-reuse')
+ end
+ else
@object.use_existing = false
- # If "no reuse" requested, pass the correct argument to arvados-cwl-runner command.
+ # Pass the correct argument to arvados-cwl-runner command.
if src.command[0] == 'arvados-cwl-runner'
command = src.command - ['--enable-reuse']
command.insert(1, '--disable-reuse')
end
- else
- command = src.command
end
@object.command = command
@@ -88,7 +96,6 @@ class ContainerRequestsController < ApplicationController
@object.runtime_constraints = src.runtime_constraints
@object.scheduling_parameters = src.scheduling_parameters
@object.state = 'Uncommitted'
- @object.use_existing = false
# set owner_uuid to that of source, provided it is a project and writable by current user
current_project = Group.find(src.owner_uuid) rescue nil
diff --git a/apps/workbench/app/views/container_requests/_extra_tab_line_buttons.html.erb b/apps/workbench/app/views/container_requests/_extra_tab_line_buttons.html.erb
index 6d5ba64..fc810b1 100644
--- a/apps/workbench/app/views/container_requests/_extra_tab_line_buttons.html.erb
+++ b/apps/workbench/app/views/container_requests/_extra_tab_line_buttons.html.erb
@@ -22,8 +22,8 @@
</div>
<div class="modal-body">
- <%= check_box_tag(:no_reuse, "true", false) %>
- <%= label_tag(:script_use_latest, "Disable container reuse") %>
+ <%= check_box_tag(:use_existing, "true", false) %>
+ <%= label_tag(:use_existing, "Enable container reuse") %>
</div>
<div class="modal-footer">
diff --git a/apps/workbench/test/controllers/container_requests_controller_test.rb b/apps/workbench/test/controllers/container_requests_controller_test.rb
index 9b4009e..7b0f6fc 100644
--- a/apps/workbench/test/controllers/container_requests_controller_test.rb
+++ b/apps/workbench/test/controllers/container_requests_controller_test.rb
@@ -55,14 +55,20 @@ class ContainerRequestsControllerTest < ActionController::TestCase
assert_equal "Copy of #{completed_cr['name']}", copied_cr['name']
assert_equal completed_cr['cmd'], copied_cr['cmd']
assert_equal completed_cr['runtime_constraints']['ram'], copied_cr['runtime_constraints'][:ram]
+ refute copied_cr[:use_existing]
end
- test "container request copy without reuse" do
+ test "container request copy with reuse enabled" do
completed_cr = api_fixture('container_requests')['completed']
- post(:copy, {id: completed_cr['uuid']}, session_for(:active))
+ post(:copy,
+ {
+ id: completed_cr['uuid'],
+ use_existing: true,
+ },
+ session_for(:active))
assert_response 302
copied_cr = assigns(:object)
assert_not_nil copied_cr
- refute copied_cr['use_existing']
+ assert copied_cr['use_existing']
end
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list