1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 class Arvados::V1::ContainerRequestsController < ApplicationController
6 accept_attribute_as_json :environment, Hash
7 accept_attribute_as_json :mounts, Hash
8 accept_attribute_as_json :runtime_constraints, Hash
9 accept_attribute_as_json :command, Array
10 accept_attribute_as_json :filters, Array
11 accept_attribute_as_json :scheduling_parameters, Hash
12 accept_attribute_as_json :secret_mounts, Hash
14 def self._index_requires_parameters
18 type: 'boolean', required: false, default: false, description: "Include container requests whose owner project is trashed.",
23 def self._show_requires_parameters
27 type: 'boolean', required: false, default: false, description: "Show container request even if its owner project is trashed.",
33 # Lock containers table to avoid deadlock in cascading priority update (see #20240)
34 Container.transaction do
35 ActiveRecord::Base.connection.execute "LOCK TABLE containers IN EXCLUSIVE MODE"
41 if (resource_attrs.keys - [:owner_uuid, :name, :description, :properties]).empty?
42 # If no attributes are being updated besides these, there are no
43 # cascading changes to other rows/tables, so we should just use
45 @object.reload(lock: true)
48 # Lock containers table to avoid deadlock in cascading priority update (see #20240)
49 Container.transaction do
50 ActiveRecord::Base.connection.execute "LOCK TABLE containers IN EXCLUSIVE MODE"