1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 require 'update_priorities'
7 class Arvados::V1::ContainerRequestsController < ApplicationController
8 accept_attribute_as_json :environment, Hash
9 accept_attribute_as_json :mounts, Hash
10 accept_attribute_as_json :runtime_constraints, Hash
11 accept_attribute_as_json :command, Array
12 accept_attribute_as_json :filters, Array
13 accept_attribute_as_json :scheduling_parameters, Hash
14 accept_attribute_as_json :secret_mounts, Hash
16 def self._index_requires_parameters
20 type: 'boolean', required: false, default: false, description: "Include container requests whose owner project is trashed.",
25 def self._show_requires_parameters
29 type: 'boolean', required: false, default: false, description: "Show container request even if its owner project is trashed.",
34 def self._container_status_requires_parameters
38 type: 'string', required: true, description: "The UUID of the ContainerRequest in question.",
43 # This API is handled entirely by controller, so this method is
44 # never called -- it's only here for the sake of adding the API to
45 # the generated discovery document.
47 send_json({"errors" => "controller-only API, not handled by rails"}, status: 400)
51 if (resource_attrs.keys.map(&:to_sym) - [:owner_uuid, :name, :description, :properties]).empty? or @object.container_uuid.nil?
52 # If no attributes are being updated besides these, there are no
53 # cascading changes to other rows/tables, the only lock will be
54 # the single row lock on SQL UPDATE.
57 # Get locks ahead of time to avoid deadlock in cascading priority
59 Container.transaction do
60 row_lock_for_priority_update @object.container_uuid