projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
20300: Mark belongs_to relations as optional.
[arvados.git]
/
services
/
api
/
app
/
models
/
arvados_model.rb
diff --git
a/services/api/app/models/arvados_model.rb
b/services/api/app/models/arvados_model.rb
index a369292fb38c09a417b32bd3d33ea165319de647..c909e47cef7ff10e4e4b01cc5221713c7d78a542 100644
(file)
--- a/
services/api/app/models/arvados_model.rb
+++ b/
services/api/app/models/arvados_model.rb
@@
-145,7
+145,7
@@
class ArvadosModel < ApplicationRecord
super(permit_attribute_params(raw_params), *args)
end
super(permit_attribute_params(raw_params), *args)
end
- def update
_attributes
raw_params={}, *args
+ def update raw_params={}, *args
super(self.class.permit_attribute_params(raw_params), *args)
end
super(self.class.permit_attribute_params(raw_params), *args)
end
@@
-156,7
+156,7
@@
class ArvadosModel < ApplicationRecord
end
def self.searchable_columns operator
end
def self.searchable_columns operator
- textonly_operator = !operator.match(/[<=>]/)
+ textonly_operator = !operator.match(/[<=>]/)
&& !operator.in?(['in', 'not in'])
self.columns.select do |col|
case col.type
when :string, :text
self.columns.select do |col|
case col.type
when :string, :text
@@
-464,6
+464,7
@@
class ArvadosModel < ApplicationRecord
end
end
end
end
+ return self if sql_conds == nil
self.where(sql_conds,
user_uuids: all_user_uuids.collect{|c| c["target_uuid"]},
permission_link_classes: ['permission'])
self.where(sql_conds,
user_uuids: all_user_uuids.collect{|c| c["target_uuid"]},
permission_link_classes: ['permission'])
@@
-938,8
+939,6
@@
class ArvadosModel < ApplicationRecord
# hook.
def fill_container_defaults_after_find
fill_container_defaults
# hook.
def fill_container_defaults_after_find
fill_container_defaults
- set_attribute_was('runtime_constraints', runtime_constraints)
- set_attribute_was('scheduling_parameters', scheduling_parameters)
clear_changes_information
end
clear_changes_information
end
@@
-950,6
+949,10
@@
class ArvadosModel < ApplicationRecord
# value in the database to an implicit zero/false value in an update
# request.
def fill_container_defaults
# value in the database to an implicit zero/false value in an update
# request.
def fill_container_defaults
+ # Make sure this is correctly sorted by key, because we merge in
+ # whatever is in the database on top of it, this will be the order
+ # that gets used downstream rather than the order the keys appear
+ # in the database.
self.runtime_constraints = {
'API' => false,
'cuda' => {
self.runtime_constraints = {
'API' => false,
'cuda' => {
@@
-957,6
+960,7
@@
class ArvadosModel < ApplicationRecord
'driver_version' => '',
'hardware_capability' => '',
},
'driver_version' => '',
'hardware_capability' => '',
},
+ 'keep_cache_disk' => 0,
'keep_cache_ram' => 0,
'ram' => 0,
'vcpus' => 0,
'keep_cache_ram' => 0,
'ram' => 0,
'vcpus' => 0,
@@
-965,6
+969,7
@@
class ArvadosModel < ApplicationRecord
'max_run_time' => 0,
'partitions' => [],
'preemptible' => false,
'max_run_time' => 0,
'partitions' => [],
'preemptible' => false,
+ 'supervisor' => false,
}.merge(attributes['scheduling_parameters'] || {})
end
}.merge(attributes['scheduling_parameters'] || {})
end