module TORQUE

require 'ostruct'

Public Class Methods

host() click to toggle source

Get the host name/ip of the local/remote server user as submitter/interface to PBS

# File lib/torque_rm/common.rb, line 75
def self.host
      self.server.host
end
hostname() click to toggle source

Get the hostname, this may require an internet connection and fully qualified name

# File lib/torque_rm/common.rb, line 80
def self.hostname
      self.server.hostname
end
load_config(file=nil) click to toggle source

Load configuration, default from file in user home with name .toruqe_rm.yaml

# File lib/torque_rm/common.rb, line 64
def self.load_config(file=nil)
      self.read_config File.expand_path(file.nil? ? "~/.torque_rm.yaml" : file)
      self
end
path() click to toggle source
# File lib/torque_rm/common.rb, line 45
def self.path
      self.qcommands_path
end
qcommands_path() click to toggle source
# File lib/torque_rm/common.rb, line 41
def self.qcommands_path
      @@qcommands_path
end
qcommands_path=(path) click to toggle source
# File lib/torque_rm/common.rb, line 33
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
read_config(file) click to toggle source
# File lib/torque_rm/common.rb, line 49
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
save_config(file=nil) click to toggle source

Save configuration, default in user home with name .toruqe_rm.yaml

# File lib/torque_rm/common.rb, line 70
def self.save_config(file=nil)
      File.write File.expand_path(file.nil? ? "~/.torque_rm.yaml" : file), {hostname: @@master.host, path: @@qcommands_path, user: @@username}.to_yaml
end
server() click to toggle source
# File lib/torque_rm/common.rb, line 15
def self.server
      @@master
end
server=(hostname) click to toggle source
# File lib/torque_rm/common.rb, line 9
def self.server=(hostname)
      if hostname
              @@master = Rye::Box.new(hostname, @@conf)
      end
end
user() click to toggle source
# File lib/torque_rm/common.rb, line 27
def self.user
  @@username
end
username() click to toggle source
# File lib/torque_rm/common.rb, line 23
def self.username
  @@username
end
username=(username) click to toggle source
# File lib/torque_rm/common.rb, line 19
def self.username=(username)
        @@username = username
end