class Falcore::Node::Base
Public Class Methods
new(data = {})
click to toggle source
# File lib/falcore/nodes/base.rb, line 21 def initialize(data = {}) @data = data.dup end
Public Instance Methods
disk_space()
click to toggle source
@return [Integer]
# File lib/falcore/nodes/base.rb, line 74 def disk_space Util.deep_fetch(@data, 'monitorData', 'hudson.node_monitors.DiskSpaceMonitor', 'size').to_i end
display_name()
click to toggle source
@return [String]
# File lib/falcore/nodes/base.rb, line 37 def display_name @data['displayName'] end
executors()
click to toggle source
@return [Integer]
# File lib/falcore/nodes/base.rb, line 47 def executors @data['numExecutors'].to_i end
free_memory()
click to toggle source
@return [Integer]
# File lib/falcore/nodes/base.rb, line 80 def free_memory Util.deep_fetch(@data, 'monitorData', 'hudson.node_monitors.SwapSpaceMonitor', 'availablePhysicalMemory').to_i end
free_swap()
click to toggle source
@return [Integer]
# File lib/falcore/nodes/base.rb, line 92 def free_swap Util.deep_fetch(@data, 'monitorData', 'hudson.node_monitors.SwapSpaceMonitor', 'availableSwapSpace').to_i end
id()
click to toggle source
The unique ID for this node. This is the {display_name}, but any dots (.
) are substituted with dashes (-
), because dots are the delimiters for StatsD and other common dumpers.
@return [String]
# File lib/falcore/nodes/base.rb, line 32 def id "jenkins.#{display_name.gsub(/\./, '-')}" end
idle?()
click to toggle source
@return [true, false]
# File lib/falcore/nodes/base.rb, line 42 def idle? !!@data['idle'] end
inspect()
click to toggle source
@private
# File lib/falcore/nodes/base.rb, line 109 def inspect list = Node::Base.public_instance_methods(false) .reject { |name| [:to_s, :inspect].include?(name) } .sort .map { |name| "#{name}: #{public_send(name).inspect}" } "#<#{self.class} #{list.join(', ')}>" end
offline?()
click to toggle source
@return [true, false]
# File lib/falcore/nodes/base.rb, line 52 def offline? !!@data['offline'] end
response_time()
click to toggle source
@return [Integer]
# File lib/falcore/nodes/base.rb, line 62 def response_time Util.deep_fetch(@data, 'monitorData', 'hudson.node_monitors.ResponseTimeMonitor', 'average').to_f end
temporarily_offline?()
click to toggle source
@return [true, false]
# File lib/falcore/nodes/base.rb, line 57 def temporarily_offline? !!@data['temporarilyOffline'] end
temporary_space()
click to toggle source
@return [Integer]
# File lib/falcore/nodes/base.rb, line 68 def temporary_space Util.deep_fetch(@data, 'monitorData', 'hudson.node_monitors.TemporarySpaceMonitor', 'size').to_i end
to_s()
click to toggle source
@private
# File lib/falcore/nodes/base.rb, line 104 def to_s "#<#{self.class}>" end
total_memory()
click to toggle source
@return [Integer]
# File lib/falcore/nodes/base.rb, line 86 def total_memory Util.deep_fetch(@data, 'monitorData', 'hudson.node_monitors.SwapSpaceMonitor', 'totalPhysicalMemory').to_i end
total_swap()
click to toggle source
@return [Integer]
# File lib/falcore/nodes/base.rb, line 98 def total_swap Util.deep_fetch(@data, 'monitorData', 'hudson.node_monitors.SwapSpaceMonitor', 'totalSwapSpace').to_i end