[ARVADOS] updated: 2.1.0-1742-g534b7df51
Git user
git at public.arvados.org
Thu Dec 23 15:54:13 UTC 2021
Summary of changes:
services/api/app/models/container_request.rb | 4 +++-
services/api/test/unit/container_request_test.rb | 7 +++++++
2 files changed, 10 insertions(+), 1 deletion(-)
via 534b7df510b99923a7dc273a2f8cacfd0c599800 (commit)
from 63b40a5af92aef28d8416c945ffc7c9805ae8d7d (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 534b7df510b99923a7dc273a2f8cacfd0c599800
Author: Tom Clegg <tom at curii.com>
Date: Thu Dec 23 10:54:07 2021 -0500
18562: Auto-enable preemptible when changing state to Committed.
(As opposed to during any update.)
Avoids a situation where a client creates a child CR with
preemptible=false, preemptible is automatically changed to true, but
then preemptible instances are removed from config, and the client
cannot change the CR state to committed without also explicitly
clearing the preemptible flag, because the automatically-enabled
preemptible flag is not allowed.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>
diff --git a/services/api/app/models/container_request.rb b/services/api/app/models/container_request.rb
index 273664c5b..3186df090 100644
--- a/services/api/app/models/container_request.rb
+++ b/services/api/app/models/container_request.rb
@@ -326,7 +326,9 @@ class ContainerRequest < ArvadosModel
end
def set_preemptible
- if Rails.configuration.Containers.UsePreemptibleInstances &&
+ if (new_record? || state_changed?) &&
+ state == Committed &&
+ Rails.configuration.Containers.UsePreemptibleInstances &&
get_requesting_container_uuid() &&
self.class.any_preemptible_instances?
self.scheduling_parameters['preemptible'] = true
diff --git a/services/api/test/unit/container_request_test.rb b/services/api/test/unit/container_request_test.rb
index bf12a3960..b7a1a7636 100644
--- a/services/api/test/unit/container_request_test.rb
+++ b/services/api/test/unit/container_request_test.rb
@@ -1053,10 +1053,17 @@ class ContainerRequestTest < ActiveSupport::TestCase
expect[true].push create_minimal_req!(attrs_p)
expect[true].push create_minimal_req!(attrs_nonp)
+ commit_later = create_minimal_req!()
Rails.configuration.InstanceTypes = ConfigLoader.to_OrderedOptions({})
expect[false].push create_minimal_req!(attrs_nonp)
+
+ # Even though preemptible is not allowed, we should be able to
+ # commit a CR that was created earlier when preemptible was the
+ # default.
+ commit_later.update_attributes!(priority: 1, state: "Committed")
+ expect[false].push commit_later
end
set_user_from_auth :active
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list