Class: Phantom::Collector

Inherits:
Object
  • Object
show all
Defined in:
lib/phantom/collector.rb

Class Method Summary collapse

Class Method Details

.get_running_instancesObject



11
12
13
14
# File 'lib/phantom/collector.rb', line 11

def get_running_instances
  lines = running_phantoms_shell_output.split("\n")
  parse_processes lines
end

.missing_portsObject



16
17
18
# File 'lib/phantom/collector.rb', line 16

def missing_ports
  required_ports - get_running_instances.map(&:port)
end

.on_port(port) ⇒ Object



7
8
9
# File 'lib/phantom/collector.rb', line 7

def on_port(port)
  get_running_instances.find {|p| p.port == port}
end

.required_portsObject



20
21
22
# File 'lib/phantom/collector.rb', line 20

def required_ports
  (Cfg.phantom_base_port..(Cfg.phantom_base_port+Cfg.phantom_processes_number-1)).to_a
end