sandro/specjour

List managers at beginning of rake task

Closed this issue · 2 comments

It would be great to see where the managers are, so it's easier to shut them down if there's a stray one. Example new output:

> rake specjour
Waiting for managers
Managers found: 2 (thehostname.local:57406, thehostname.local:57407)
 Workers found: 16

Here's a patch that might rock it:

diff --git a/lib/specjour/dispatcher.rb b/lib/specjour/dispatcher.rb
index 35370c3..7887856 100644
--- a/lib/specjour/dispatcher.rb
+++ b/lib/specjour/dispatcher.rb
@@ -74,12 +74,19 @@ module Specjour
         end
       rescue Timeout::Error
       end
-      puts "Managers found: #{managers.size}"
+      puts "Managers found: #{managers.size}#{print_manager_list}"
       abort unless managers.size > 0
-      puts "Workers found: #{worker_size}"
+      puts " Workers found: #{worker_size}"
       printer.worker_size = worker_size
     end

+    def print_manager_list
+      return unless managers.size > 0
+      result = " ("
+      result << managers.map {|mgr| "#{mgr.send(:drb_uri).host}:#{mgr.send(:drb_uri).port}"}.join(', ')
+      result << ")"
+    end
+
     def printer
       @printer ||= Printer.start(all_specs)
     end

Thanks for the patch, I'll try to get it in soon.