Class: Eclipsed::CLI_driver

Inherits:
Core
  • Object
show all
Defined in:
lib/eclipsed.rb

Constant Summary

Constants included from Eclipsed

VERSION

Instance Method Summary collapse

Methods inherited from Core

#all_but, #attach_at, #close, #compile, #configure, #debug_at, #find_confpath, #kill, #launch, #pry, #restart, #show, #submit

Methods included from Eclipsed

#print_async

Constructor Details

#initialize(input:) ⇒ CLI_driver

{{{



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/eclipsed.rb', line 179

def initialize input: #{{{
  super()
  configure()

  opt = OptionParser.new do |opts|
    opts.banner = "eclipsed (Eclipse Daemon controler) is an script to manage the EclipseDFS\n" +
      "Usage: eclipsed [options] <actions> [FILE]..."
    opts.version = Eclipsed::VERSION
    opts.program_name = "Eclipse Launcher"
    opts.separator "Core actions"
    opts.separator "    launch       Create new Eclipse network"
    opts.separator "    close        Close the network"
    opts.separator "    restart      Close and create the network"
    opts.separator "    status       Check the status of the network"
    opts.separator "    kill         kill application in each node"
    opts.separator ""
    opts.separator "MapReduce actions"
    opts.separator "    submit [app]   Submit application to VeloxMR system"
    opts.separator "    compile [app]  Compile application client binary"
    opts.separator ""
    opts.separator "Debugging actions"
    opts.separator "    debug_at [N]   Launch eclipseDFS with node N in gdb"  
    opts.separator "    attach_at [N]  Attach gdb to the N node"
    opts.separator "    all_but [N]    Launch all eclipse in all nodes but one"
    opts.separator ""
    opts.separator "Options"
    opts.on_tail("-h", "--help"   , "recursive this")         { puts opts; exit}
    opts.on_tail("-v", "--verbose" , "printout verbose info") { @verbose = true }
    opts.on_tail("-n", "--dry-run" , "Show what its about to do") { @dryrun = true }
    opts.on_tail("-V", "--version" , "printout version") { puts opts.ver; exit }
    opts.on_tail("-s", "--sudo" , "Use sudo for attach") { @sudo = true }
  end
  opt.parse! input

  if input.empty?
    puts opt.help 
    exit
  end


  case input.shift
  when 'launch' then launch
  when 'close' then  close
  when 'restart' then restart 
  when 'status' then show
  when 'kill' then   kill input
  when 'debug_at' then debug_at input[0]
  when 'attach_at' then attach_at input[0]
  when 'all_but' then all_but input[0]
  when 'submit' then submit input[0]
  when 'compile' then compile input[0]
  when 'pry' then    pry
  else            raise 'No valid argument, rerun with --help' 
  end
end