Class: OodCore::Job::QueueInfo
- Inherits:
-
Object
- Object
- OodCore::Job::QueueInfo
- Includes:
- DataFormatter
- Defined in:
- lib/ood_core/job/queue_info.rb
Overview
QueueInfo is information about a given queue on a scheduler.
Instance Attribute Summary collapse
-
#allow_accounts ⇒ Object
readonly
The accounts that are allowed to use this queue.
-
#deny_accounts ⇒ Object
readonly
The accounts that are not allowed to use this queue.
-
#name ⇒ Object
(also: #to_s)
readonly
The name of the queue.
-
#qos ⇒ Object
readonly
The QoSes associated with this queue.
-
#tres ⇒ Object
readonly
An Hash of Trackable Resources and their values.
Instance Method Summary collapse
- #gpu? ⇒ Boolean
-
#initialize(**opts) ⇒ QueueInfo
constructor
A new instance of QueueInfo.
- #to_h ⇒ Object
Methods included from DataFormatter
Constructor Details
#initialize(**opts) ⇒ QueueInfo
Returns a new instance of QueueInfo.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ood_core/job/queue_info.rb', line 26 def initialize(**opts) @name = opts.fetch(:name, 'unknown') @qos = opts.fetch(:qos, []) @tres = opts.fetch(:tres, {}) allow_accounts = opts.fetch(:allow_accounts, nil) @allow_accounts = if allow_accounts.nil? nil else allow_accounts.compact.map { |acct| upcase_accounts? ? acct.to_s.upcase : acct } end @deny_accounts = opts.fetch(:deny_accounts, []).compact.map do |acct| upcase_accounts? ? acct.to_s.upcase : acct end end |
Instance Attribute Details
#allow_accounts ⇒ Object (readonly)
The accounts that are allowed to use this queue.
nil means ALL accounts are allowed.
18 19 20 |
# File 'lib/ood_core/job/queue_info.rb', line 18 def allow_accounts @allow_accounts end |
#deny_accounts ⇒ Object (readonly)
The accounts that are not allowed to use this queue.
21 22 23 |
# File 'lib/ood_core/job/queue_info.rb', line 21 def deny_accounts @deny_accounts end |
#name ⇒ Object (readonly) Also known as: to_s
The name of the queue.
9 10 11 |
# File 'lib/ood_core/job/queue_info.rb', line 9 def name @name end |
#qos ⇒ Object (readonly)
The QoSes associated with this queue
13 14 15 |
# File 'lib/ood_core/job/queue_info.rb', line 13 def qos @qos end |
#tres ⇒ Object (readonly)
An Hash of Trackable Resources and their values.
24 25 26 |
# File 'lib/ood_core/job/queue_info.rb', line 24 def tres @tres end |
Instance Method Details
#gpu? ⇒ Boolean
50 51 52 |
# File 'lib/ood_core/job/queue_info.rb', line 50 def gpu? tres.keys.any? { |name| name.to_s.match?(%r{^gres/gpu($|:)}i) } end |
#to_h ⇒ Object
43 44 45 46 47 48 |
# File 'lib/ood_core/job/queue_info.rb', line 43 def to_h instance_variables.map do |var| name = var.to_s.gsub('@', '').to_sym [name, send(name)] end.to_h end |