Class: Nitra::Slave::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/nitra/slave.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ Client

Returns a new instance of Client.



5
6
7
# File 'lib/nitra/slave.rb', line 5

def initialize(configuration)
  @configuration = configuration
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



3
4
5
# File 'lib/nitra/slave.rb', line 3

def configuration
  @configuration
end

Instance Method Details

#connectObject

Starts the slave runners.

We do this in two steps, starts them all and then sends them their configurations. This extra complexity speeds up the initial startup when working with many slaves.



15
16
17
18
19
20
21
22
23
24
# File 'lib/nitra/slave.rb', line 15

def connect
  runner_id = "A"
  @configuration.slaves.collect do |slave_details|
    runner_id = runner_id.succ
    server = start_host(slave_details, runner_id)
    [server, slave_details, runner_id]
  end.collect do |server, slave_details, runner_id|
    configure_host(server, slave_details, runner_id)
  end.compact
end