Class: OodCore::Job::ClusterInfo

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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_nodesObject (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_gpusObject (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_nodesObject (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_processorsObject (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_nodesObject (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_gpusObject (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_nodesObject (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_processorsObject (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_hObject



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