Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions apps/dashboard/app/lib/account_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ def dynamic_accounts

# To be used with dynamic forms. This method stithes together data
# about the queue's availablity WRT clusters.
# If the user has no account with access to a given queue, it is excluded.
# If a user has access to a given queue but only with specific accounts,
# data attributes are added to indicate which accounts can *not* be used for that queue.
#
# @return [Array] - the dynamic form options
def queues
Expand Down Expand Up @@ -134,13 +137,7 @@ def unique_qos_names

# do you have _any_ account that can submit to this queue?
def blocked_queue?(queue)
allow_accounts = queue.allow_accounts

if allow_accounts.nil?
false
else
allow_accounts.intersection(account_names).empty?
end
(accounts.select {|account| account_allowed?(queue, account)}).none?
end

def queues_per_cluster
Expand All @@ -154,18 +151,20 @@ def queues_per_cluster
end

def queue_account_data(queue)
account_names.map do |account|
accounts.map do |account|
["data-option-for-auto-accounts-#{account}", false] unless account_allowed?(queue, account)
end.compact.to_h
end

def account_allowed?(queue, account_name)
return false if queue.deny_accounts.any? { |account| account == account_name }

if queue.allow_accounts.nil?
true
else
queue.allow_accounts.any? { |account| account == account_name }
end
# can _this_ account submit to this queue?
def account_allowed?(queue, account)
# This is the simplest possible implementation, and may not reflect the actual behavior of any
# given resource manager. For example, Slurm completely ignores DenyQos when AllowQos exists.
# This behavior is replicated in OOD Core by conditionally setting deny_qos to an empty array.
return false if queue.allow_accounts && !queue.allow_accounts.include?(account.to_s)
return false if queue.deny_accounts.include?(account.to_s)
return false if queue.allow_qos && !(queue.allow_qos & account.qos).any?
return false if (queue.deny_qos & account.qos).any?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return false if (queue.deny_qos & account.qos).any?
return false if account.qos.difference(queue.deny_qos).none?

Copy link
Contributor Author

@simonLeary42 simonLeary42 Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was wrong. If you have 3 QoS and one of those are denied, you still have access via the other 2 QoS. Only if all of your account's QoS denied should the account be considered denied.

true
end
end