Class: Spec::Distributed::RindaSlaveRunner
Instance Method Summary
collapse
Methods included from TupleArgs
#process_tuple_args, #tuples
Methods inherited from SlaveRunner
#initialize, #prepare_run, #run_behaviour_at, #top_svn_dir, #update_wc
Instance Method Details
#process_args(args) ⇒ Object
9
10
11
|
# File 'lib/spec/distributed/rinda_slave_runner.rb', line 9
def process_args(args)
process_tuple_args(args)
end
|
#register_self ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/spec/distributed/rinda_slave_runner.rb', line 42
def register_self
fail_count = 0
begin
puts "registering service for tuple selector #{tuples.inspect}"
@service_ts.write(tuples(self), Rinda::SimpleRenewer.new)
rescue Exception => e
puts "could not register my self in the tuplespace. Exception: #{e.message}"
start_or_find_ring_server
fail_count += 1
retry if fail_count < 5
puts "Unable to re-register my self. Giving up."
exit
end
end
|
#report_dump ⇒ Object
This is called by the master over DRb. the master should be ‘take’ing so re-register
22
23
24
25
|
# File 'lib/spec/distributed/rinda_slave_runner.rb', line 22
def report_dump
super
register_self
end
|
#run(paths, exit_when_done) ⇒ Object
13
14
15
16
17
18
|
# File 'lib/spec/distributed/rinda_slave_runner.rb', line 13
def run(paths, exit_when_done)
start_or_find_ring_server
register_self
@started = true
DRb.thread.join
end
|
#slave_watermark ⇒ Object
57
58
59
|
# File 'lib/spec/distributed/rinda_slave_runner.rb', line 57
def slave_watermark
"#{@url} selecting #{@tuple_selector.inspect}"
end
|
#start_or_find_ring_server ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/spec/distributed/rinda_slave_runner.rb', line 27
def start_or_find_ring_server
DRb.start_service
@url = DRb.uri.to_s
begin
puts "Looking for Ring server..."
@ring_server = Rinda::RingFinger.new
@service_ts = @ring_server.lookup_ring_any(2)
puts "Located Ring server at #{@service_ts.__drburi}"
rescue Exception
puts "No Ring server found, starting my own."
@service_ts = Rinda::TupleSpace.new
@ring_server = Rinda::RingServer.new(@service_ts)
end
end
|