class Eclipsed::Core
}}}
Public Instance Methods
all_but(index)
click to toggle source
}}}
all_but {{{
# File lib/eclipsed.rb, line 62 def all_but(index) thr = print_async "Initializing framework..." i = 0 @nodelist.each do |node| if i != index.to_i then cmd = "ssh #{node} 'export PATH=\"#{ENV['PATH']}\"; nohup eclipse_node </dev/null &>/dev/null &'" puts cmd if @verbose system cmd unless @dryrun end i = i + 1 end thr.exit print "\r" end
attach_at(index)
click to toggle source
}}}
attach_at {{{
# File lib/eclipsed.rb, line 102 def attach_at(index) cmd = "ssh #{@nodelist[index.to_i]} -t \"#{"sudo" if @sudo} gdb --pid \\`pgrep -u #{`whoami`.chomp} -x eclipse_node\\`\"" puts cmd if @verbose exec cmd unless @dryrun end
close()
click to toggle source
}}}
close {{{
# File lib/eclipsed.rb, line 136 def close thr = print_async "Stopping framework..." user = `whoami`.chomp @nodelist.each do |node| cmd = "ssh #{node} 'pgrep -u #{user} eclipse_node &>/dev/null && kill -s SIGKILL $(ps -o pgrp= -p $(pgrep -u #{user} -x eclipse_node) | xargs echo - | tr -d [:blank:])'" puts cmd if @verbose system cmd unless @dryrun end thr.exit print "\r" end
compile(input)
click to toggle source
compile {{{
# File lib/eclipsed.rb, line 170 def compile(input) file_name = File.basename(input,File.extname(input)) cmd = "g++ -std=c++14 -Wall -Werror -o #{file_name} #{file_name}.cc #{@lpath} -lvmr -lvdfs -lboost_system" puts cmd if @verbose system cmd unless @dryrun end
configure()
click to toggle source
Configure {{{
# File lib/eclipsed.rb, line 27 def configure json_conf = File.open(find_confpath) { |f| JSON.parse(f.read) } @nodelist = json_conf['network']['nodes'] @app_dir = json_conf['path']['applications'] #@lpath = json_conf['veloxd']['lflags'] @verbose = false end
debug_at(index)
click to toggle source
}}}
debug_at {{{
# File lib/eclipsed.rb, line 86 def debug_at(index) i = 0 @nodelist.each do |node| if i != index.to_i then cmd = "ssh #{node} 'export PATH=\"#{ENV['PATH']}\"; nohup eclipse_node </dev/null &>/dev/null & exit'" puts cmd system cmd end i = i + 1 end cmd = "ssh #{@nodelist[index.to_i]} -t \'export PATH=\"#{ENV['PATH']}\"; gdb --args eclipse_node \'" puts cmd if @verbose exec cmd unless @dryrun end
find_confpath()
click to toggle source
}}} find_confpath
{{{
# File lib/eclipsed.rb, line 37 def find_confpath home = "#{ENV['HOME']}/.eclipse.json" etc = "/etc/.eclipse.json" if File.exists? home return home elsif File.exists? etc return etc end end
kill(input)
click to toggle source
kill {{{
# File lib/eclipsed.rb, line 148 def kill(input) @nodelist.each do |node| cmd = "ssh #{node} \'pkill -u #{`whoami`.chomp} #{input.join}\'" puts cmd if @verbose system cmd unless @dryrun end end
launch()
click to toggle source
}}} launch {{{
# File lib/eclipsed.rb, line 49 def launch thr = print_async "Initializing framework..." @nodelist.each do |node| cmd = "ssh #{node} 'export PATH=\"#{ENV['PATH']}\"; export LD_LIBRARY_PATH=\"#{ENV['LD_LIBRARY_PATH']}\"; ulimit -Sn 4000; nohup eclipse_node </dev/null &>/dev/null &'" puts cmd if @verbose system cmd unless @dryrun end thr.exit print "\r" end
pry()
click to toggle source
pry {{{
# File lib/eclipsed.rb, line 156 def pry require 'pry' binding.pry end
restart()
click to toggle source
}}}
restart {{{
# File lib/eclipsed.rb, line 79 def restart close launch end
show()
click to toggle source
}}}
show {{{
# File lib/eclipsed.rb, line 109 def show msg_handler = print_async "Collecting information..." instance = [ ] in_english = { true => "Running", false => "Stopped" } status = nil @nodelist.each do |node| out = nil cmd = "ssh #{node} \'pgrep -u #{`whoami`.chomp} -x eclipse_node &>/dev/null; echo $?\'" puts cmd if @verbose if `#{cmd}`.chomp == '0' out = true else out = false end mr_status = in_english[out] instance << { :host => node, :status => mr_status, :role => "worker" } end msg_handler.exit print "\r" tp instance, "host", "role", "status" end
submit(input)
click to toggle source
submit {{{
# File lib/eclipsed.rb, line 161 def submit(input) file_name = File.basename(input,File.extname(input)) system "g++ -c -std=c++14 -Wall -Werror -rdynamic -fpic #{input}" system "gcc -shared -fPIC -rdynamic -o #{file_name}.so #{file_name}.o" @nodelist.each do |node| system "scp #{file_name}.so #{node}:#{@app_dir}/" end end