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.
-
#allow_qos ⇒ Object
readonly
The QoSes associated with this queue.
-
#deny_accounts ⇒ Object
readonly
The accounts that are not allowed to use this queue.
-
#deny_qos ⇒ Object
readonly
Returns the value of attribute deny_qos.
-
#max_cpus ⇒ Integer
readonly
The maximum CPUs the job can request.
-
#max_nodes ⇒ Integer
readonly
The maximum nodes a job can request for this queue.
-
#max_time ⇒ Integer
readonly
The maximum number of time in seconds the job can request.
-
#min_nodes ⇒ Integer
readonly
The minimum nodes a job can request for this queue.
-
#name ⇒ Object
(also: #to_s)
readonly
The name of the queue.
-
#tres ⇒ Object
readonly
An Hash of Trackable Resources and their values.
Instance Method Summary collapse
- #allow_all_qos? ⇒ Boolean
- #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.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/ood_core/job/queue_info.rb', line 48 def initialize(**opts) @name = opts.fetch(:name, 'unknown') @allow_qos = opts.fetch(:allow_qos, []) @deny_qos = opts.fetch(:deny_qos, []) @tres = opts.fetch(:tres, {}) # these options preserve nil @min_nodes = opts[:min_nodes] && opts[:min_nodes].to_i @max_nodes = opts[:max_nodes] && opts[:max_nodes].to_i @max_cpus = opts[:max_cpus] && opts[:max_cpus].to_i @max_time = opts[:max_time] && opts[:max_time].to_i 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.
19 20 21 |
# File 'lib/ood_core/job/queue_info.rb', line 19 def allow_accounts @allow_accounts end |
#allow_qos ⇒ Object (readonly)
The QoSes associated with this queue
13 14 15 |
# File 'lib/ood_core/job/queue_info.rb', line 13 def allow_qos @allow_qos end |
#deny_accounts ⇒ Object (readonly)
The accounts that are not allowed to use this queue.
22 23 24 |
# File 'lib/ood_core/job/queue_info.rb', line 22 def deny_accounts @deny_accounts end |
#deny_qos ⇒ Object (readonly)
Returns the value of attribute deny_qos.
14 15 16 |
# File 'lib/ood_core/job/queue_info.rb', line 14 def deny_qos @deny_qos end |
#max_cpus ⇒ Integer (readonly)
The maximum CPUs the job can request. Note these are maximum per node. Defaults to nil. Returns nil if unlimited.
41 42 43 |
# File 'lib/ood_core/job/queue_info.rb', line 41 def max_cpus @max_cpus end |
#max_nodes ⇒ Integer (readonly)
The maximum nodes a job can request for this queue. Defaults to nil. Returns nil if unlimited.
35 36 37 |
# File 'lib/ood_core/job/queue_info.rb', line 35 def max_nodes @max_nodes end |
#max_time ⇒ Integer (readonly)
The maximum number of time in seconds the job can request. Defaults to nil. Returns nil if unlimited.
46 47 48 |
# File 'lib/ood_core/job/queue_info.rb', line 46 def max_time @max_time end |
#min_nodes ⇒ Integer (readonly)
The minimum nodes a job can request for this queue. Defaults to nil.
30 31 32 |
# File 'lib/ood_core/job/queue_info.rb', line 30 def min_nodes @min_nodes 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 |
#tres ⇒ Object (readonly)
An Hash of Trackable Resources and their values.
25 26 27 |
# File 'lib/ood_core/job/queue_info.rb', line 25 def tres @tres end |
Instance Method Details
#allow_all_qos? ⇒ Boolean
83 84 85 |
# File 'lib/ood_core/job/queue_info.rb', line 83 def allow_all_qos? allow_qos.empty? && deny_qos.empty? end |
#gpu? ⇒ Boolean
79 80 81 |
# File 'lib/ood_core/job/queue_info.rb', line 79 def gpu? tres.keys.any? { |name| name.to_s.match?(%r{^gres/gpu($|:)}i) } end |
#to_h ⇒ Object
72 73 74 75 76 77 |
# File 'lib/ood_core/job/queue_info.rb', line 72 def to_h instance_variables.map do |var| name = var.to_s.gsub('@', '').to_sym [name, send(name)] end.to_h end |