Sha256: 7f7e4bfeef739d7c6cec521044993f35a5cffc128bef2181d7bf2fe96b1b6bc3

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

module Skynet::ConsoleHelper
# All of these commands can be run at the 'skynet console'.

    def mq
      @mq ||= Skynet::MessageQueue.new
    end                       

    def stats
      mq.stats
    end

    def increment_worker_version
      mq.increment_worker_version
    end

    def get_worker_version
      mq.get_worker_version
    end

    def set_worker_version(*args)
      mq.set_worker_version(*args)
    end

    def manager
      @manager ||= DRbObject.new(nil,Skynet::CONFIG[:SKYNET_LOCAL_MANAGER_URL])
    end

    def add_lib(lib)
      manager.required_libs << File.expand_path(lib)
      manager.restart_workers
    end                      

    def restart_workers
      manager.restart_workers
    end

    def add_workers(num)
      manager.add_workers(num)
    end

    def remove_workers(num)
      manager.remove_workers(num)
    end

    # ===============
    # = Doesnt work =
    # ===============
    # def help
    #   puts <<-HELP
    #    mq
    #    stats
    #    increment_worker_version
    #    get_worker_version
    #    set_worker_version(version)
    #    manager
    #    add_lib(library_to_include)  -- forces a restart
    #    restart_workers
    #    add_workers(number_of_workers)
    #    remove_workers(number_of_workers)
    #   HELP
    # end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
skynet-0.9.2 lib/skynet/skynet_console_helper.rb