Class: OodCore::Job::AccountInfo

Inherits:
Object
  • Object
show all
Includes:
DataFormatter
Defined in:
lib/ood_core/job/account_info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DataFormatter

#upcase_accounts?

Constructor Details

#initialize(**opts) ⇒ AccountInfo

Returns a new instance of AccountInfo.



22
23
24
25
26
27
28
# File 'lib/ood_core/job/account_info.rb', line 22

def initialize(**opts)
  orig_name = opts.fetch(:name, 'unknown')
  @name = upcase_accounts? ? orig_name.upcase : orig_name
  @qos = opts.fetch(:qos, [])
  @cluster = opts.fetch(:cluster, nil)
  @queue = opts.fetch(:queue, nil)
end

Instance Attribute Details

#clusterObject (readonly)

The cluster this account is associated with.



16
17
18
# File 'lib/ood_core/job/account_info.rb', line 16

def cluster
  @cluster
end

#nameObject (readonly) Also known as: to_s

The name of the account.



9
10
11
# File 'lib/ood_core/job/account_info.rb', line 9

def name
  @name
end

#qosObject (readonly)

The QoS values this account can use.



13
14
15
# File 'lib/ood_core/job/account_info.rb', line 13

def qos
  @qos
end

#queueObject (readonly)

The queue this account can use. nil means there is no queue info for this account.



20
21
22
# File 'lib/ood_core/job/account_info.rb', line 20

def queue
  @queue
end

Instance Method Details

#to_hObject



30
31
32
33
34
35
# File 'lib/ood_core/job/account_info.rb', line 30

def to_h
  instance_variables.map do |var|
    name = var.to_s.gsub('@', '').to_sym
    [name, send(name)]
  end.to_h
end