<commit_before>require 'rye'
require 'etc'

module TORQUE
  @@username = Etc.getlogin
	@@qcommands_path = '/usr/bin'
  @@master = Rye::Box.new("localhost")
  def self.server=(hostname)
  	if hostname
  		@@master = Rye::Box.new(hostname,:user => @@username)
  	end
  end

  def self.server
  	@@master
  end

	def self.username=(username)
		@@username = username
	end


  def self.qcommands_path=(path)
  	@@qcommands_path = path
  	%w(qstat qsub qdel).each do |command|
  	  Rye::Cmd.remove_command command if Rye::Cmd.can? command
  	  Rye::Cmd.add_command command, File.join(qcommands_path, command)
  	end
  end

  def self.qcommands_path
  	@@qcommands_path
  end

  def self.path
  	self.qcommands_path
  end

  def self.read_config(file)
  	if File.exists?(file)
  	  conf = YAML::load( File.open( file) )
  	  self.qcommands_path = conf[:path]
    	self.username = conf[:username] unless conf[:username].nil?
  	  self.server = conf[:hostname]
		end
  end

  # Load configuration, default from file in user home with name .toruqe_rm.yaml
  def self.load_config(file=nil)
  	self.read_config File.expand_path(file.nil? ? "~/.torque_rm.yaml" : file)
  	self
  end

  # Save configuration, default in user home with name .toruqe_rm.yaml
  def self.save_config(file=nil)
  	File.write File.expand_path(file.nil? ? "~/.torque_rm.yaml" : file), {hostname: @@master.host, path: @@qcommands_path, username: @@username}.to_yaml
  end<commit_msg>user yaml conf file with keywords compliant to RyeBox specs to configure a connection<commit_after>require 'rye'
require 'etc'

module TORQUE
  @@username = Etc.getlogin
	@@qcommands_path = '/usr/bin'
  @@master = Rye::Box.new("localhost")
  @@conf = {}
  def self.server=(hostname)
  	if hostname
  		@@master = Rye::Box.new(hostname, @@conf)
  	end
  end

  def self.server
  	@@master
  end

	def self.username=(username)
		@@username = username
	end


  def self.qcommands_path=(path)
  	@@qcommands_path = path
  	%w(qstat qsub qdel).each do |command|
  	  Rye::Cmd.remove_command command if Rye::Cmd.can? command
  	  Rye::Cmd.add_command command, File.join(qcommands_path, command)
  	end
  end

  def self.qcommands_path
  	@@qcommands_path
  end

  def self.path
  	self.qcommands_path
  end

  def self.read_config(file)
  	if File.exists?(file)
  	  conf = YAML::load( File.open( file) )
      @@conf = conf.dup
      @@conf.delete(:hostname)
      @@conf.delete(:path)
  	  self.qcommands_path = conf[:path]
    	self.username = conf[:user] unless conf[:user].nil?
      # self.port = conf[:port] unless conf[:port].nil?
      # self.password = conf[:password] unless conf[:password].nil?
  	  self.server = conf[:hostname]
		end
  end

  # Load configuration, default from file in user home with name .toruqe_rm.yaml
  def self.load_config(file=nil)
  	self.read_config File.expand_path(file.nil? ? "~/.torque_rm.yaml" : file)
  	self
  end

  # Save configuration, default in user home with name .toruqe_rm.yaml
  def self.save_config(file=nil)
  	File.write File.expand_path(file.nil? ? "~/.torque_rm.yaml" : file), {hostname: @@master.host, path: @@qcommands_path, username: @@username}.to_yaml
  end
{'fraction_non_alphanumeric': 0.1291139240506329, 'fraction_numerical': 0.0, 'mean_word_length': 3.634897360703812, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '735906', 'n_tokens_mistral': 1174, 'n_tokens_neox': 1137, 'n_words': 259}