AccountCache.accounts uses just one slurm adapter:
https://github.com/OSC/ondemand/blob/4acd0a2a3ac3cb46787f757005255d1890be10f2/apps/dashboard/app/lib/account_cache.rb#L13-L14
cluster = Configuration.job_clusters.select(&:slurm?).first
cluster.nil? ? [] : cluster.job_adapter.accounts
In contrast, queues_per_cluster loops over each slurm adapter:
https://github.com/OSC/ondemand/blob/4acd0a2a3ac3cb46787f757005255d1890be10f2/apps/dashboard/app/lib/account_cache.rb#L149-L150
Configuration.job_clusters.each do |cluster|
hash[cluster.id] = cluster.job_adapter.queues
This works (I think) because scontrol is specific to one cluster, while sacctmgr is not.
I think that if accounts were stored in more than one slurm database, any account in any job adapter but the 1st would be omitted from auto_accounts.
Would it not be more natural to make the slurm adapter to limit its sacctmgr output to the relevant cluster, and loop over each cluster in AccountCache.accounts, just like how we looop over each cluster in AccountCache.queues_per_cluster? This would also remove the need to store cluster information in each AccountInfo, just like how there's no need to store cluster information in each QueueInfo.
It would be easier to reason about a job adapter if it was definitely/always limited to one cluster, especially if an adapter needs to be scheduler-agnostic.
AccountCache.accountsuses just one slurm adapter:https://github.com/OSC/ondemand/blob/4acd0a2a3ac3cb46787f757005255d1890be10f2/apps/dashboard/app/lib/account_cache.rb#L13-L14
In contrast,
queues_per_clusterloops over each slurm adapter:https://github.com/OSC/ondemand/blob/4acd0a2a3ac3cb46787f757005255d1890be10f2/apps/dashboard/app/lib/account_cache.rb#L149-L150
This works (I think) because
scontrolis specific to one cluster, whilesacctmgris not.I think that if accounts were stored in more than one slurm database, any account in any job adapter but the 1st would be omitted from
auto_accounts.Would it not be more natural to make the slurm adapter to limit itssacctmgroutput to the relevant cluster, and loop over each cluster inAccountCache.accounts, just like how we looop over each cluster inAccountCache.queues_per_cluster? This would also remove the need to store cluster information in eachAccountInfo, just like how there's no need to store cluster information in eachQueueInfo.It would be easier to reason about a job adapter if it was definitely/always limited to one cluster, especially if an adapter needs to be scheduler-agnostic.