[ARVADOS] updated: ff3bb22d4b2bff5666907a6eeb6cd68cd3cbe22b

Git user git at public.curoverse.com
Fri Mar 31 22:12:19 EDT 2017


Summary of changes:
 .../methods/container_requests.html.textile.liquid |  2 +-
 services/api/app/models/collection.rb              | 44 ++++++++++++++--------
 2 files changed, 30 insertions(+), 16 deletions(-)

       via  ff3bb22d4b2bff5666907a6eeb6cd68cd3cbe22b (commit)
       via  b651984ff68c6f8add9b99427b205a2cb7c87462 (commit)
      from  65121f8db54a1ed15207d050e1f48c5fc26d646b (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 ff3bb22d4b2bff5666907a6eeb6cd68cd3cbe22b
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Mar 31 22:07:19 2017 -0400

    11100: Adjust delete_at in before_validation hook instead of validation. Permit changing trash_at without extending delete_at.

diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index 92300d6..4a1e610 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -510,35 +510,49 @@ class Collection < ArvadosModel
     true
   end
 
-  # If trash_at is updated without touching delete_at, automatically
-  # update delete_at to a sensible value.
   def default_trash_interval
     if trash_at_changed? && !delete_at_changed?
+      # If trash_at is updated without touching delete_at,
+      # automatically update delete_at to a sensible value.
       if trash_at.nil?
         self.delete_at = nil
       else
         self.delete_at = trash_at + Rails.configuration.default_trash_lifetime.seconds
       end
+    elsif !trash_at || !delete_at || trash_at > delete_at
+      # Not trash, or bogus arguments? Just validate in
+      # validate_trash_and_delete_timing.
+    elsif delete_at_changed? && delete_at >= trash_at
+      # Fix delete_at if needed, so it's not earlier than the expiry
+      # time on any permission tokens that might have been given out.
+
+      # In any case there are no signatures expiring after now+TTL.
+      # Also, if the existing trash_at time has already passed, we
+      # know we haven't given out any signatures since then.
+      earliest_delete = [
+        @validation_timestamp,
+        trash_at_was,
+      ].compact.min + Rails.configuration.blob_signature_ttl.seconds
+
+      # The previous value of delete_at is also an upper bound on the
+      # longest-lived permission token. For example, if TTL=14,
+      # trash_at_was=now-7, delete_at_was=now+7, then it is safe to
+      # set trash_at=now+6, delete_at=now+8.
+      earliest_delete = [earliest_delete, delete_at_was].compact.min
+
+      # If delete_at is too soon, use the earliest possible time.
+      if delete_at < earliest_delete
+        self.delete_at = earliest_delete
+      end
     end
   end
 
   def validate_trash_and_delete_timing
     if trash_at.nil? != delete_at.nil?
       errors.add :delete_at, "must be set if trash_at is set, and must be nil otherwise"
+    elsif delete_at && delete_at < trash_at
+      errors.add :delete_at, "must not be earlier than trash_at"
     end
-
-    if delete_at
-      if delete_at < trash_at
-        errors.add :delete_at, "must not be earlier than trash_at"
-      else
-        earliest_delete = ([@validation_timestamp, trash_at_was].compact.min +
-                           Rails.configuration.blob_signature_ttl.seconds)
-        if delete_at < earliest_delete
-          self.delete_at = earliest_delete
-        end
-      end
-    end
-
     true
   end
 end

commit b651984ff68c6f8add9b99427b205a2cb7c87462
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Mar 31 17:26:43 2017 -0400

    11100: Specify units in output_ttl docs.

diff --git a/doc/api/methods/container_requests.html.textile.liquid b/doc/api/methods/container_requests.html.textile.liquid
index 446ba15..75bf3d1 100644
--- a/doc/api/methods/container_requests.html.textile.liquid
+++ b/doc/api/methods/container_requests.html.textile.liquid
@@ -44,7 +44,7 @@ table(table table-bordered table-condensed).
 |command|array of strings|Command to execute in the container.|Required. e.g., @["echo","hello"]@|
 |output_path|string|Path to a directory or file inside the container that should be preserved as container's output when it finishes. This path must be, or be inside, one of the mount targets. For best performance, point output_path to a writable collection mount. Also, see "Pre-populate output using Mount points":#pre-populate-output for details regarding optional output pre-population using mount points.|Required.|
 |output_name|string|Desired name for the output collection. If null, a name will be assigned automatically.||
-|output_ttl|integer|Desired lifetime for the output collection. If zero, the output collection will not be deleted automatically.||
+|output_ttl|integer|Desired lifetime for the output collection, in seconds. If zero, the output collection will not be deleted automatically.||
 |priority|integer|Higher value means spend more resources on this container_request, i.e., go ahead of other queued containers, bring up more nodes etc.|Priority 0 means a container should not be run on behalf of this request. Clients are expected to submit container requests with zero priority in order to preview the container that will be used to satisfy it. Priority can be null if and only if state!="Committed".|
 |expires_at|datetime|After this time, priority is considered to be zero.|Not yet implemented.|
 |use_existing|boolean|If possible, use an existing (non-failed) container to satisfy the request instead of creating a new one.|Default is true|

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list