X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/ce45451379c464c222791af2319f823f36a5cd21..74ba49615bbce04863068b095bd103f870c90b4f:/services/api/app/models/container.rb diff --git a/services/api/app/models/container.rb b/services/api/app/models/container.rb index af058494b2..0326b12985 100644 --- a/services/api/app/models/container.rb +++ b/services/api/app/models/container.rb @@ -22,7 +22,7 @@ class Container < ArvadosModel attribute :secret_mounts, :jsonbHash, default: {} attribute :runtime_status, :jsonbHash, default: {} attribute :runtime_auth_scopes, :jsonbArray, default: [] - attribute :output_storage_classes, :jsonbArray, default: ["default"] + attribute :output_storage_classes, :jsonbArray, default: lambda { Rails.configuration.DefaultStorageClasses } serialize :environment, Hash serialize :mounts, Hash @@ -289,7 +289,21 @@ class Container < ArvadosModel candidates = candidates.where('secret_mounts_md5 = ?', secret_mounts_md5) log_reuse_info(candidates) { "after filtering on secret_mounts_md5 #{secret_mounts_md5.inspect}" } - candidates = candidates.where_serialized(:runtime_constraints, resolve_runtime_constraints(attrs[:runtime_constraints]), md5: true) + if attrs[:runtime_constraints]['cuda'].nil? + attrs[:runtime_constraints]['cuda'] = { + 'device_count' => 0, + 'driver_version' => '', + 'hardware_capability' => '', + } + end + resolved_runtime_constraints = [resolve_runtime_constraints(attrs[:runtime_constraints])] + if resolved_runtime_constraints[0]['cuda']['device_count'] == 0 + # If no CUDA requested, extend search to include older container + # records that don't have a 'cuda' section in runtime_constraints + resolved_runtime_constraints << resolved_runtime_constraints[0].except('cuda') + end + + candidates = candidates.where_serialized(:runtime_constraints, resolved_runtime_constraints, md5: true, multivalue: true) log_reuse_info(candidates) { "after filtering on runtime_constraints #{attrs[:runtime_constraints].inspect}" } log_reuse_info { "checking for state=Complete with readable output and log..." }