Class: Nitra::Slave::Client
- Inherits:
-
Object
- Object
- Nitra::Slave::Client
- Defined in:
- lib/nitra/slave.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
Instance Method Summary collapse
-
#connect ⇒ Object
Starts the slave runners.
-
#initialize(configuration) ⇒ Client
constructor
A new instance of Client.
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
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
3 4 5 |
# File 'lib/nitra/slave.rb', line 3 def configuration @configuration end |
Instance Method Details
#connect ⇒ Object
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 |