Sha256: e7f580c7ed98144f86e29c801ee8b59c27f30d9132564de4ad840be0ad2399e9
Contents?: true
Size: 1.71 KB
Versions: 3
Compression:
Stored size: 1.71 KB
Contents
# TODO: Deprecate this file =begin rdoc The connection to the messenger from poolparty, the client. This class will setup a socket connection to the master's client at the messenger_client_port =end module PoolParty module Messenger def with_socket(testing=false, &block) host = testing ? "localhost" : (master.ip) vputs "Pinging #{host} with the messenger" socket = TCPSocket.open(host, Default.messenger_client_port) out = yield(socket) socket.close out end # TODO: Fix cookie setting def self.erl_command(hostname, extra="", min_ports=7000, max_ports=7050) command_line_opts = "-cookie -pa #{append_dir}/ebin -kernel inet_dist_listen_min #{min_ports} inet_dist_listen_max #{max_ports} -sname #{hostname}" "erl #{command_line_opts} #{extra}" end def self.append_dir ::File.expand_path(::File.join( ::File.dirname(__FILE__), "..", "..", "erlang/messenger" )) end def messenger_send!(msg="get_current_load cpu", testing=false) with_socket(testing) do |sock| sock.send(msg, 0) @str = sock.recv(2000) end vputs "Received #{@str} from #{msg}" @str end def messenger_cast!(msg="force_reconfig") with_socket do |sock| sock.send(msg, 0) end end def self.messenger_send!(cmd="", testing=false) command = Messenger.erl_command("client#{Time.now.to_i}", "-s pm_client -run pm_client #{cmd} -s erlang halt -noshell") testing ? command : %x[#{command}] end # Helper methods def self.startup_remote_messenger(hostname, testing=false) # messenger_send!("") # testing ? command : %x[#{command}] end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
auser-poolparty-1.1.6 | lib/poolparty/net/messenger.rb |
auser-poolparty-1.1.7 | lib/poolparty/net/messenger.rb |
fairchild-poolparty-1.1.5 | lib/poolparty/net/messenger.rb |