eclipsed 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 231a30a631f4fabf42b52cc2b934b06408c8c12e
4
- data.tar.gz: 5189b8efe6fd590381e2b2780c019b8b456b3d92
3
+ metadata.gz: 9fd1e98568770cf285cb13945ba524ae9652b3b8
4
+ data.tar.gz: e5bcc5c59817d7256912c5b28e061d10ea85f718
5
5
  SHA512:
6
- metadata.gz: b07fdafb8d0abb6acec2ec8f1e1c49d6efce0d508be8bc9f90ec5f896ba6d1c49e0ed0976be9b22f6d3f54b95b0643f39bbe073a34d42b45666a0b3374cad92e
7
- data.tar.gz: 7bcbf0a41b05fe6cbd014452a2ecaabfb948bba69521e1d11f574eaf04ffd75e603b21e8ecdc5802ee7dd4ca49d26334ac1955fb743f273ebe96967a13417fbd
6
+ metadata.gz: e06b946cc75b2c6b584b4c318360205311193afe4248a1961d40999e17cd486a49c0a08161a045945d10541e8e1d33a8475178f7e87c078c4fa1d8f397b38ccd
7
+ data.tar.gz: 972b98d0c24c3855c4d0a9d1d2cfd9627a718321e6e05b07b20eee195b4ab18a84a235d898580e644231be636cb801f476f1f72a816f62010b0ee9a3793e8a20
data/Gemfile CHANGED
@@ -3,7 +3,6 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in eclipsed.gemspec
4
4
  gemspec
5
5
 
6
- gem 'ffi' # For loading C functions, in this case the hash functions
7
6
  gem 'awesome_print' # Pretty-printer
8
7
  gem 'table_print' # Pretty-printer
9
8
  gem 'pry' # Pretty-printer
data/eclipsed.gemspec CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |spec|
13
13
  #spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
14
14
  end
15
15
 
16
- spec.summary = %q{EclipseMR governor}
17
- spec.description = %q{Controls EclipseMR.}
16
+ spec.summary = %q{EclipseDFS governor}
17
+ spec.description = %q{Controls EclipseDFS.}
18
18
  spec.homepage = "http://dicl.unist.ac.kr"
19
19
  spec.license = "MIT"
20
20
 
@@ -1,3 +1,3 @@
1
1
  module Eclipsed
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/eclipsed.rb CHANGED
@@ -1,17 +1,10 @@
1
1
  require "eclipsed/version"
2
2
  require 'optparse' # For parsing the options
3
3
  require 'json' #
4
- require 'ffi' # For loading C functions, in this case the hash functions
5
4
  require 'awesome_print' # Pretty-printer
6
5
  require 'table_print' # Pretty-printer
7
6
 
8
7
  module Eclipsed
9
- module EclipseAPI #{{{
10
- extend FFI::Library
11
- ffi_lib "libecfs.so"
12
- attach_function :hash_ruby, [ :string ], :uint32
13
- end
14
- #}}}
15
8
  # print_async {{{
16
9
  def print_async(msg)
17
10
  Thread.new(msg) do |m|
@@ -36,9 +29,6 @@ module Eclipsed
36
29
  @verbose = false
37
30
  end
38
31
 
39
- # }}}
40
- # set_fs_variables {{{
41
-
42
32
  # }}}
43
33
  # find_confpath {{{
44
34
  def find_confpath
@@ -55,15 +45,31 @@ module Eclipsed
55
45
  # launch {{{
56
46
  def launch
57
47
  thr = print_async "Initializing framework..."
58
- `master &>/dev/null &`
59
- sleep 1
60
48
  @nodelist.each do |node|
61
- system "ssh #{node} 'nohup slave </dev/null &>/dev/null & exit'"
49
+ cmd = "ssh #{node} 'export PATH=\"#{ENV['PATH']}\"; nohup eclipse_node </dev/null &>/dev/null &'"
50
+ puts cmd if @verbose
51
+ system cmd
62
52
  end
63
53
  thr.exit
64
54
  print "\r"
65
55
  end
66
56
 
57
+ #}}}
58
+ # debug_at {{{
59
+ def debug_at(index)
60
+ i = 0
61
+ @nodelist.each do |node|
62
+ if i != index.to_i then
63
+ cmd = "ssh #{node} 'export PATH=\"#{ENV['PATH']}\"; nohup eclipse_node </dev/null &>/dev/null & exit'"
64
+ puts cmd
65
+ system cmd
66
+ end
67
+ i = i + 1
68
+ end
69
+ cmd = "ssh #{@nodelist[index.to_i]} \'export PATH=\"#{ENV['PATH']}\"; gdb --args eclipse_node \'"
70
+ puts cmd
71
+ exec cmd
72
+ end
67
73
  #}}}
68
74
  # show {{{
69
75
  def show
@@ -72,13 +78,17 @@ module Eclipsed
72
78
  instance = [ ]
73
79
  in_english = { true => "Running", false => "Stopped" }
74
80
 
75
- cmd = "pgrep -u #{`whoami`.chomp} master &>/dev/null"
76
- puts cmd if @verbose
77
- status = in_english[system cmd]
78
- instance << { :host => "localhost", :status => status, :role => "master" }
79
-
81
+ status = nil
80
82
  @nodelist.each do |node|
81
- mr_status = in_english[system "ssh #{node} pgrep -u #{`whoami`.chomp} -x slave &>/dev/null"]
83
+ out = nil
84
+ cmd = "ssh #{node} \'pgrep -x eclipse_node &>/dev/null; echo $\'"
85
+ puts cmd if @verbose
86
+ if `#{cmd}`.chomp == '0'
87
+ out = true
88
+ else
89
+ out = false
90
+ end
91
+ mr_status = in_english[out]
82
92
  instance << { :host => node, :status => mr_status, :role => "worker" }
83
93
  end
84
94
 
@@ -91,20 +101,12 @@ module Eclipsed
91
101
  # close {{{
92
102
  def close
93
103
  thr = print_async "Stopping framework..."
94
- `pkill -u #{`whoami`.chomp} master`
95
104
  @nodelist.each do |node|
96
- `ssh #{node} pkill -u #{`whoami`.chomp} slave`
105
+ `ssh #{node} pkill -u #{`whoami`.chomp} eclipse_node`
97
106
  end
98
107
  thr.exit
99
108
  print "\r"
100
109
  end #}}}
101
- # submit {{{
102
- def submit(input)
103
- # @instance[:app]= input
104
- # File.open(@fs_tmpfile, 'w') { |f| f.write(JSON.generate(@instance)) }
105
-
106
- system input.join(' ')
107
- end #}}}
108
110
  # kill {{{
109
111
  def kill(input)
110
112
  @nodelist.each do |node|
@@ -120,163 +122,33 @@ module Eclipsed
120
122
  end #}}}
121
123
  end
122
124
 
123
- class Fs < Core
124
- include EclipseAPI
125
- def initialize #{{{
126
- @files = {}
127
- @config = File.open(find_confpath) { |f| JSON.parse(f.read) }
128
- @fs_path = @config['path']['filesystem']
129
- @fs_scratch_path = @config['path']['scratch']
130
- @fs_tmpfile = @fs_path + "/.list"
131
- @files = File.open(@fs_tmpfile) { |f| JSON.parse(f.read) } if File.exist? @fs_tmpfile
132
- alias :hash :hash_ruby
133
- super()
134
- end
135
-
136
- def node_containing(fn); @nodelist[hash(fn) % @nodelist.length] end
137
-
138
- #}}}
139
- # put {{{
140
- def put(input)
141
- input.each do |fn|
142
- node = node_containing(fn)
143
- @files[fn] = node
144
-
145
- File.open(@fs_tmpfile, 'w') { |f| f.write(JSON.generate(@files)) }
146
- cmd = "scp #{@fs_path}/#{fn} #{node}:#{@fs_scratch_path}/#{fn}"
147
- puts cmd if @verbose
148
- system cmd
149
- end
150
- end
151
-
152
- #}}}
153
- # cat {{{
154
- def cat(input)
155
- input.each do |fn|
156
- system "ssh #{node_containing(fn)} cat #{@fs_scratch_path}/#{fn}"
157
- end
158
- end
159
-
160
- #}}}
161
- # get {{{
162
- def get(input)
163
- input.each do |fn|
164
- cmd = "scp #{node_containing(fn)}:#{@fs_scratch_path}/#{fn} ."
165
- puts cmd if @verbose
166
- system cmd
167
- end
168
- end
169
-
170
- #}}}
171
- # rm {{{
172
- def rm(input)
173
- input = @files.keys.grep(%r[#{@regex}]) if @regex
174
-
175
- input.each do |fn|
176
- # raise "\'#{fn}\' not found in Eclipse FS" unless @files[fn]
177
-
178
- node = node_containing(fn)
179
- pathtofile = @fs_scratch_path + "/" + fn
180
- cmd = "ssh #{node} rm -f #{pathtofile}"
181
- puts cmd if @verbose
182
- system cmd
183
- @files.delete(fn)
184
- File.open(@fs_tmpfile, 'w') { |f| f.write(JSON.generate(@files)) }
185
- end
186
- end
187
-
188
- #}}}
189
- def list #{{{
190
- thr = print_async "Collecting information..."
191
- output = [ ]
192
- @files.each{|k, v| output << { :filename => k, :location => v} }
193
-
194
- @nodelist.each do |node|
195
- `ssh #{node} ls #{@fs_scratch_path}`.each_line do |l|
196
- l.chomp!
197
- output << { :filename => l, :location => node} unless @files.has_key?(l)
198
- end
199
- end
200
-
201
- thr.exit
202
- print "\r\e[K"
203
- tp output, :filename, :location
204
- end
205
-
206
- #}}}
207
- def config #{{{
208
- ap self.instance_variables.map{|var| [var, self.instance_variable_get(var)]}.to_h
209
- end #}}}
210
- # compile {{{
211
- def compile(input)
212
- sources = input.join(' ')
213
- raise 'Need to specify output file (-o File)' unless @outputfile
214
-
215
- cmd = "#{CXX} -static -o #{@outputfile} #{sources} -l ecfs"
216
- puts cmd if @verbose
217
- system cmd
218
- end
219
-
220
- #}}}
221
- def clear #{{{
222
- rm @files.keys
223
- @nodelist.each do |node|
224
- cmd = "ssh #{node} rm -rf #{@fs_scratch_path}/.job* #{@fs_scratch_path}/*"
225
- puts cmd if @verbose
226
- system cmd
227
- end
228
- end
229
- #}}}
230
- end
231
-
232
- class CLI_driver < Fs
125
+ class CLI_driver < Core
233
126
  def initialize input: #{{{
234
127
  @options = {}
235
128
  super()
236
129
  OptionParser.new do |opts|
237
- opts.banner = "ecfs (Eclipse FileSystem) is an script to manage the fs\n" +
238
- "Usage: ecfs [options] <actions> [FILE]..."
130
+ opts.banner = "eclipsed (Eclipse Daemon controler) is an script to manage the EclipseDFS\n" +
131
+ "Usage: eclipsed [options] <actions> [FILE]..."
239
132
  opts.version = 1.0
240
133
  opts.program_name = "Eclipse Launcher"
241
134
  opts.separator "Core actions"
242
135
  opts.separator " launch Create new Eclipse network"
243
136
  opts.separator " close Close the network"
244
137
  opts.separator " status Check the status of the network"
245
- opts.separator " submit Submit application"
246
138
  opts.separator " kill kill application in each node"
247
139
  opts.separator ""
248
- opts.separator "Filesystem actions"
249
- opts.separator " put FILE... insert FILE..."
250
- opts.separator " get FILE... copy the FILES to the current directory"
251
- opts.separator " rm FILE... remove FILE..."
252
- opts.separator " cat FILE... \'cat\' the FILE..."
253
- opts.separator " clear remove all the files in the FS"
254
- opts.separator " ls list all the files in the FS"
255
- opts.separator " config list all the internal variables"
256
- opts.separator " cc -o OUTPUT INPUT... Compile file with EclipseFS API using OUTPUT name"
257
- opts.separator ""
258
140
  opts.separator "Options"
259
141
  opts.on_tail("-h", "--help" , "recursive this") { puts opts; exit}
260
142
  opts.on_tail("-v", "--verbose" , "printout verbose info") { @verbose = true }
261
143
  opts.on_tail("-V", "--version" , "printout version") { puts opts.ver; exit }
262
- opts.on_tail("-o FILE", "output file, for mcc") { |f| @outputfile = f }
263
- opts.on_tail("-r REGEX", "regex for remove or ls") { |r| @regex = r }
264
144
  end.parse! input
265
145
 
266
146
  case input.shift
267
147
  when 'launch' then launch
268
148
  when 'close' then close
269
149
  when 'status' then show
270
- when 'submit' then submit input
271
150
  when 'kill' then kill input
272
- when 'put' then put input
273
- when 'get' then get input
274
- when 'cat' then cat input
275
- when 'rm' then rm input
276
- when 'clear' then clear
277
- when 'ls' then list
278
- when 'config' then config
279
- when 'cc' then compile(input)
151
+ when 'debug_at' then debug_at input[0]
280
152
  when 'pry' then pry
281
153
  else raise "Not action given"
282
154
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eclipsed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vicente Adolfo Bolea Sanchez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-06 00:00:00.000000000 Z
11
+ date: 2016-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
- description: Controls EclipseMR.
41
+ description: Controls EclipseDFS.
42
42
  email:
43
43
  - vicente.bolea@gmail.com
44
44
  executables:
@@ -77,8 +77,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  version: '0'
78
78
  requirements: []
79
79
  rubyforge_project:
80
- rubygems_version: 2.4.5
80
+ rubygems_version: 2.4.3
81
81
  signing_key:
82
82
  specification_version: 4
83
- summary: EclipseMR governor
83
+ summary: EclipseDFS governor
84
84
  test_files: []