X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/2b6f6f61757ad01f7d8baf63b190c1e1cd42db41..24a1cdaa5b5a3a98b47ab6802d00e7c4d2a848df:/services/api/app/models/container.rb diff --git a/services/api/app/models/container.rb b/services/api/app/models/container.rb index 4b02ad52e5..42d0ed49bf 100644 --- a/services/api/app/models/container.rb +++ b/services/api/app/models/container.rb @@ -228,8 +228,10 @@ class Container < ArvadosModel rc['keep_cache_ram'] = Rails.configuration.Containers.DefaultKeepCacheRAM end if rc['keep_cache_disk'] == 0 and rc['keep_cache_ram'] == 0 - # Only set if keep_cache_ram isn't set. - rc['keep_cache_disk'] = Rails.configuration.Containers.DefaultKeepCacheDisk + # If neither ram nor disk cache was specified and + # DefaultKeepCacheRAM==0, default to disk cache with size equal + # to RAM constraint (but at least 2 GiB and at most 32 GiB). + rc['keep_cache_disk'] = [[rc['ram'] || 0, 2 << 30].max, 32 << 30].min end rc end @@ -716,6 +718,31 @@ class Container < ArvadosModel end if retryable_requests.any? + scheduling_parameters = { + # partitions: empty if any are empty, else the union of all parameters + "partitions": retryable_requests + .map { |req| req.scheduling_parameters["partitions"] || [] } + .reduce { |cur, new| (cur.empty? or new.empty?) ? [] : (cur | new) }, + + # preemptible: true if all are true, else false + "preemptible": retryable_requests + .map { |req| req.scheduling_parameters["preemptible"] } + .all?, + + # max_run_time: 0 if any are 0 (unlimited), else the maximum + "max_run_time": retryable_requests + .map { |req| req.scheduling_parameters["max_run_time"] || 0 } + .reduce do |cur, new| + if cur == 0 or new == 0 + 0 + elsif new > cur + new + else + cur + end + end, + } + c_attrs = { command: self.command, cwd: self.cwd, @@ -724,7 +751,7 @@ class Container < ArvadosModel container_image: self.container_image, mounts: self.mounts, runtime_constraints: self.runtime_constraints, - scheduling_parameters: self.scheduling_parameters, + scheduling_parameters: scheduling_parameters, secret_mounts: prev_secret_mounts, runtime_token: prev_runtime_token, runtime_user_uuid: self.runtime_user_uuid,