Sha256: c9f0f11e0803ed19aabfb73dc911def8403aa02182431fcb7c7098c614ce6984

Contents?: true

Size: 1.51 KB

Versions: 24

Compression:

Stored size: 1.51 KB

Contents

# FIXME: should be a module
class Skynet
  include SkynetDebugger
  def self.start(options={})
    begin
      mq = Skynet::MessageQueue.new
    rescue Skynet::ConnectionError
      if Skynet::MessageQueue.adapter == :tuplespace
        ts_port = Skynet::CONFIG[:TS_SERVER_HOSTS].first.split(':').last
        # puts "trying to make ts skynet_tuplespace_server --port=#{ts_port} --logfile=#{Skynet.config.logfile_location} --piddir=#{Skynet.config.skynet_pid_dir} --use_ringserver=#{Skynet.config.ts_use_ringserver} --drburi=#{Skynet.config.ts_drburi} start"
        cmd = "skynet_tuplespace_server  --port=#{ts_port} --logfile=#{Skynet.config.logfile_location} --piddir=#{Skynet.config.skynet_pid_dir} --use_ringserver=#{Skynet.config.ts_use_ringserver} --drburi=#{Skynet.config.ts_drburi} start"
        pid = fork do
          exec(cmd)
        end
        sleep Skynet::CONFIG[:TS_SERVER_START_DELAY]
      end
    end

    options[:script_path] = Skynet::CONFIG[:LAUNCHER_PATH]
    
    if ARGV.detect {|a| a == 'console' }
      ARGV.delete('console')
      Skynet::Console.start
    elsif options[:worker_type] or ARGV.detect {|a| a =~ /worker_type/ }
      Skynet::Worker.start(options)
    else
      if ARGV.include?('stop')
        Skynet::Manager.stop(options)
      else
        options["daemonize"] = true if ARGV.include?('start')      
        Skynet::Manager.start(options)
      end
    end
  end

  def self.new(options={})
    warn("Skynet.new is deprecated, please use Skynet.start instead")
    start(options)
  end
end

Version data entries

24 entries across 24 versions & 3 rubygems

Version Path
brendan-skynet-0.9.3.1 lib/skynet/skynet_launcher.rb
brendan-skynet-0.9.3.2 lib/skynet/skynet_launcher.rb
brendan-skynet-0.9.3.3 lib/skynet/skynet_launcher.rb
brendan-skynet-0.9.3.5 lib/skynet/skynet_launcher.rb
brendan-skynet-0.9.3.6 lib/skynet/skynet_launcher.rb
brendan-skynet-0.9.3.7 lib/skynet/skynet_launcher.rb
brendan-skynet-0.9.3.8 lib/skynet/skynet_launcher.rb
brendan-skynet-0.9.303 lib/skynet/launcher.rb
brendan-skynet-0.9.304 lib/skynet/launcher.rb
brendan-skynet-0.9.305 lib/skynet/launcher.rb
brendan-skynet-0.9.31 lib/skynet/skynet_launcher.rb
brendan-skynet-0.9.310 lib/skynet/launcher.rb
brendan-skynet-0.9.311 lib/skynet/launcher.rb
brendan-skynet-0.9.312 lib/skynet/launcher.rb
brendan-skynet-0.9.313 lib/skynet/launcher.rb
brendan-skynet-0.9.314 lib/skynet/launcher.rb
brendan-skynet-0.9.315 lib/skynet/launcher.rb
brendan-skynet-0.9.316 lib/skynet/launcher.rb
brendan-skynet-0.9.317 lib/skynet/launcher.rb
brendan-skynet-0.9.318 lib/skynet/launcher.rb