Permalink
Browse files

[util] Colour

  • Loading branch information...
1 parent 2fac38a commit a3a61a5b7b1100ac5ff03d1c2704bd38d6419a22 @seshness seshness committed Dec 13, 2011
Showing with 26 additions and 2 deletions.
  1. +1 −1 new_sandbox/paxos/leader_election.rb
  2. +1 −1 new_sandbox/tests/tc_leader_election.rb
  3. +24 −0 new_sandbox/util/colour.rb
View
2 new_sandbox/paxos/leader_election.rb
@@ -52,7 +52,7 @@ module LeaderMembership
magenta <= leader { |l| ["leader: #{l.host}"] }
blue <= leader_vote { |lv| ["leader_vote: #{lv.inspect}"] }
green <= member_list { |ml| ["member_list: #{ml.inspect}"] }
- cyan <= potential_member
+ #cyan <= potential_member
end
# Each node, when receiving a message from pipe_out, needs to determine
View
2 new_sandbox/tests/tc_leader_election.rb
@@ -31,7 +31,7 @@ def test_simple
puts "We have 3 hosts: #{hosts.inspect}"
q = Queue.new
- 3.times { q.push(true) }
+ 6.times { q.push(true) }
respondedp = {}
lms.each do |lm|
View
24 new_sandbox/util/colour.rb
@@ -0,0 +1,24 @@
+require 'rubygems'
+require 'bud'
+
+module Colour
+ state do
+ interface input, :red, [:payload]
+ interface input, :green, [:payload]
+ interface input, :yellow, [:payload]
+ interface input, :blue, [:payload]
+ interface input, :magenta, [:payload]
+ interface input, :cyan, [:payload]
+ interface input, :white, [:payload]
+ end
+
+ bloom do
+ stdio <~ red { |p| ["\e[0;31m#{p.payload} at timestep #{budtime} on #{ip_port}\e[0m"] }
+ stdio <~ green { |p| ["\e[0;32m#{p.payload} at timestep #{budtime} on #{ip_port}\e[0m"] }
+ stdio <~ yellow { |p| ["\e[0;33m#{p.payload} at timestep #{budtime} on #{ip_port}\e[0m"] }
+ stdio <~ blue { |p| ["\e[0;34m#{p.payload} at timestep #{budtime} on #{ip_port}\e[0m"] }
+ stdio <~ magenta { |p| ["\e[0;35m#{p.payload} at timestep #{budtime} on #{ip_port}\e[0m"] }
+ stdio <~ cyan { |p| ["\e[0;36m#{p.payload} at timestep #{budtime} on #{ip_port}\e[0m"] }
+ stdio <~ white { |p| ["\e[0;37m#{p.payload} at timestep #{budtime} on #{ip_port}\e[0m"] }
+ end
+end

0 comments on commit a3a61a5

Please sign in to comment.