<commit_before>#!/usr/bin/ruby

require 'thread'

STDOUT.sync = true

unless defined? Mongo
  require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'mongo')
end

class ReplSetManager

  attr_accessor :host, :start_port, :ports, :name, :mongods, :tags, :version

  def initialize(opts={})
    @mongod     = ENV['mongod'] || 'mongod'
    @start_port = opts[:start_port] || 30000
    @ports      = []
    @name       = opts[:name] || 'replica-set-foo'
    @host       = opts[:host]  || 'localhost'
    @retries    = opts[:retries] || 30
    @config     = {"_id" => @name, "members" => []}
    @durable    = opts.fetch(:durable, false)
    @smallfiles = opts.fetch(:smallfiles, true)
    @path       = File.join(File.expand_path(File.dirname(__FILE__)), "data")
    @oplog_size = opts.fetch(:oplog_size, 16)
    @tags = [{"dc" => "ny", "rack" => "a", "db" => "main"},
             {"dc" => "ny", "rack" => "b", "db" => "main"},
             {"dc" => "sf", "rack" => "a", "db" => "main"}]

    @arbiter_count   = opts[:arbiter_count]   || 0
    @secondary_count = opts[:secondary_count] || 2
    @passive_count   = opts[:passive_count] || 0
    @primary_count   = 1

    @count = @primary_count + @passive_count + @arbiter_count + @secondary_count
    if @count > 7
      raise StandardError, "Cannot create a replica set with #{node_count} nodes. 7 is the max."
    end

    @mongods   = {}
    version_string = `mongod --version`
    version_string =~ /(\d\.\d\.\d)/
    @version = $1.split(".").map {|d| d.to_i }
  end
<commit_msg>minor: fix for version_string in ReplSetManager<commit_after>#!/usr/bin/ruby

require 'thread'

STDOUT.sync = true

unless defined? Mongo
  require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'mongo')
end

class ReplSetManager

  attr_accessor :host, :start_port, :ports, :name, :mongods, :tags, :version

  def initialize(opts={})
    @mongod     = ENV['mongod'] || 'mongod'
    @start_port = opts[:start_port] || 30000
    @ports      = []
    @name       = opts[:name] || 'replica-set-foo'
    @host       = opts[:host]  || 'localhost'
    @retries    = opts[:retries] || 30
    @config     = {"_id" => @name, "members" => []}
    @durable    = opts.fetch(:durable, false)
    @smallfiles = opts.fetch(:smallfiles, true)
    @path       = File.join(File.expand_path(File.dirname(__FILE__)), "data")
    @oplog_size = opts.fetch(:oplog_size, 16)
    @tags = [{"dc" => "ny", "rack" => "a", "db" => "main"},
             {"dc" => "ny", "rack" => "b", "db" => "main"},
             {"dc" => "sf", "rack" => "a", "db" => "main"}]

    @arbiter_count   = opts[:arbiter_count]   || 0
    @secondary_count = opts[:secondary_count] || 2
    @passive_count   = opts[:passive_count] || 0
    @primary_count   = 1

    @count = @primary_count + @passive_count + @arbiter_count + @secondary_count
    if @count > 7
      raise StandardError, "Cannot create a replica set with #{node_count} nodes. 7 is the max."
    end

    @mongods   = {}
    version_string = `#{@mongod} --version`
    version_string =~ /(\d\.\d\.\d)/
    @version = $1.split(".").map {|d| d.to_i }
  end

{'fraction_non_alphanumeric': 0.1964630225080386, 'fraction_numerical': 0.010289389067524116, 'mean_word_length': 2.898496240601504, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4914619', 'n_tokens_mistral': 1182, 'n_tokens_neox': 1121, 'n_words': 249}