Sha256: 2def2cff782ebf4c292c6dae0130bad428877584f9396fdb7b18cbc72b696dbe

Contents?: true

Size: 1.65 KB

Versions: 1

Compression:

Stored size: 1.65 KB

Contents

module Filbunke
  class Repository

    attr_accessor :name, 
                  :host, 
                  :port, 
                  :local_path, 
                  :file_umask, 
                  :directory_umask, 
                  :user, 
                  :pass, 
                  :hadoop_binary, 
                  :run_every,
                  :hydra_concurrency,
                  :num_callback_processes,
                  :num_callback_threads

    def initialize(repository_config)
      @name = repository_config["filbunke_server_repository"]
      @host = repository_config["filbunke_server_host"]
      @port = repository_config["filbunke_server_port"]
      @local_path = repository_config["local_path"]
      @file_umask = repository_config["file_umask"].to_i
      @directory_umask = repository_config["directory_umask"].to_i
      @user = repository_config["file_url_username"]
      @pass = repository_config["file_url_password"]
      @hadoop_binary = repository_config["hadoop_binary"]
      @run_every = repository_config.fetch("run_every", 10).to_i
      @hydra_concurrency = repository_config.fetch("hydra_concurrency", 100).to_i
      @num_callback_processes = repository_config["num_callback_processes"].to_i
      @num_callback_threads = repository_config["num_callback_threads"].to_i

      if @num_callback_threads == 0 and @num_callback_processes == 0
        @num_callback_threads = Parallel.processor_count
      end
      
      raise ConfigurationError.new("callbacks cant use both processes and threads  (#{@name})") if @num_callback_threads > 0 && @num_callback_processes > 0
      
    end

  end

  class ConfigurationError < StandardError
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
filbunke-2.0.2 lib/filbunke/repository.rb