Class: OodCore::Job::ClusterInfo
- Inherits:
-
Object
- Object
- OodCore::Job::ClusterInfo
- Defined in:
- lib/ood_core/job/cluster_info.rb
Overview
An object that contains details about the cluster’s active and total nodes, processors and gpus.
Instance Attribute Summary collapse
-
#active_gpu_nodes ⇒ Object
readonly
Returns the value of attribute active_gpu_nodes.
-
#active_gpus ⇒ Object
readonly
Returns the value of attribute active_gpus.
-
#active_nodes ⇒ Object
readonly
Returns the value of attribute active_nodes.
-
#active_processors ⇒ Object
readonly
Returns the value of attribute active_processors.
-
#total_gpu_nodes ⇒ Object
readonly
Returns the value of attribute total_gpu_nodes.
-
#total_gpus ⇒ Object
readonly
Returns the value of attribute total_gpus.
-
#total_nodes ⇒ Object
readonly
Returns the value of attribute total_nodes.
-
#total_processors ⇒ Object
readonly
Returns the value of attribute total_processors.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ ClusterInfo
constructor
A new instance of ClusterInfo.
- #to_h ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ ClusterInfo
Returns a new instance of ClusterInfo.
10 11 12 13 14 15 16 17 18 |
# File 'lib/ood_core/job/cluster_info.rb', line 10 def initialize(opts = {}) opts = opts.transform_keys(&:to_sym) @active_nodes = opts.fetch(:active_nodes, nil).to_i @total_nodes = opts.fetch(:total_nodes, nil).to_i @active_processors = opts.fetch(:active_processors, nil).to_i @total_processors = opts.fetch(:total_processors, nil).to_i @active_gpus = opts.fetch(:active_gpus, nil).to_i @total_gpus = opts.fetch(:total_gpus, nil).to_i end |
Instance Attribute Details
#active_gpu_nodes ⇒ Object (readonly)
Returns the value of attribute active_gpu_nodes.
7 8 9 |
# File 'lib/ood_core/job/cluster_info.rb', line 7 def active_gpu_nodes @active_gpu_nodes end |
#active_gpus ⇒ Object (readonly)
Returns the value of attribute active_gpus.
7 8 9 |
# File 'lib/ood_core/job/cluster_info.rb', line 7 def active_gpus @active_gpus end |
#active_nodes ⇒ Object (readonly)
Returns the value of attribute active_nodes.
7 8 9 |
# File 'lib/ood_core/job/cluster_info.rb', line 7 def active_nodes @active_nodes end |
#active_processors ⇒ Object (readonly)
Returns the value of attribute active_processors.
7 8 9 |
# File 'lib/ood_core/job/cluster_info.rb', line 7 def active_processors @active_processors end |
#total_gpu_nodes ⇒ Object (readonly)
Returns the value of attribute total_gpu_nodes.
7 8 9 |
# File 'lib/ood_core/job/cluster_info.rb', line 7 def total_gpu_nodes @total_gpu_nodes end |
#total_gpus ⇒ Object (readonly)
Returns the value of attribute total_gpus.
7 8 9 |
# File 'lib/ood_core/job/cluster_info.rb', line 7 def total_gpus @total_gpus end |
#total_nodes ⇒ Object (readonly)
Returns the value of attribute total_nodes.
7 8 9 |
# File 'lib/ood_core/job/cluster_info.rb', line 7 def total_nodes @total_nodes end |
#total_processors ⇒ Object (readonly)
Returns the value of attribute total_processors.
7 8 9 |
# File 'lib/ood_core/job/cluster_info.rb', line 7 def total_processors @total_processors end |
Instance Method Details
#to_h ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ood_core/job/cluster_info.rb', line 20 def to_h { active_nodes: active_nodes, total_nodes: total_nodes, active_processors: active_processors, total_processors: total_processors, active_gpus: active_gpus, total_gpus: total_gpus } end |