[ARVADOS] updated: 1.1.4-357-g1965e17
Git user
git at public.curoverse.com
Thu Jun 7 16:02:02 EDT 2018
Summary of changes:
services/api/app/models/container_request.rb | 8 +++---
services/api/test/unit/container_request_test.rb | 31 ++++++++++++++++++++++++
2 files changed, 36 insertions(+), 3 deletions(-)
via 1965e1793598c76ceef4decd4a5a6c7755c385e3 (commit)
from 73872ccc5bb6b80a6049b44b0113085a9c2b6934 (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 1965e1793598c76ceef4decd4a5a6c7755c385e3
Author: Lucas Di Pentima <ldipentima at veritasgenetics.com>
Date: Tue Jun 5 11:38:12 2018 -0300
7478: Fixes child CR default preemptable setting logic.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <ldipentima at veritasgenetics.com>
diff --git a/services/api/app/models/container_request.rb b/services/api/app/models/container_request.rb
index 8f3f99e..55590f4 100644
--- a/services/api/app/models/container_request.rb
+++ b/services/api/app/models/container_request.rb
@@ -201,9 +201,11 @@ class ContainerRequest < ArvadosModel
def set_default_preemptable_scheduling_parameter
if self.state == Committed
# If preemptable instances (eg: AWS Spot Instances) are allowed,
- # automatically ask them on non-child containers by default.
- if Rails.configuration.preemptable_instances and !self.requesting_container_uuid.nil?
- self.scheduling_parameters['preemptable'] ||= true
+ # ask them on child containers by default.
+ if Rails.configuration.preemptable_instances and
+ !self.requesting_container_uuid.nil? and
+ self.scheduling_parameters['preemptable'].nil?
+ self.scheduling_parameters['preemptable'] = true
end
end
end
diff --git a/services/api/test/unit/container_request_test.rb b/services/api/test/unit/container_request_test.rb
index 6f76218..b36ff06 100644
--- a/services/api/test/unit/container_request_test.rb
+++ b/services/api/test/unit/container_request_test.rb
@@ -787,6 +787,37 @@ class ContainerRequestTest < ActiveSupport::TestCase
end
[
+ 'zzzzz-dz642-runningcontainr',
+ nil,
+ ].each do |requesting_c|
+ test "having preemptable instances active on the API server, a committed #{requesting_c.nil? ? 'non-':''}child CR should not ask for preemptable instance if parameter already set to false" do
+ common_attrs = {cwd: "test",
+ priority: 1,
+ command: ["echo", "hello"],
+ output_path: "test",
+ scheduling_parameters: {"preemptable" => false},
+ mounts: {"test" => {"kind" => "json"}}}
+
+ Rails.configuration.preemptable_instances = true
+ set_user_from_auth :active
+
+ if requesting_c
+ cr = with_container_auth(Container.find_by_uuid requesting_c) do
+ create_minimal_req!(common_attrs)
+ end
+ assert_not_nil cr.requesting_container_uuid
+ else
+ cr = create_minimal_req!(common_attrs)
+ end
+
+ cr.state = ContainerRequest::Committed
+ cr.save!
+
+ assert_equal false, cr.scheduling_parameters['preemptable']
+ end
+ end
+
+ [
[true, 'zzzzz-dz642-runningcontainr', true],
[true, nil, nil],
[false, 'zzzzz-dz642-runningcontainr', nil],
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list