Module: TORQUE
- Defined in:
- lib/torque_rm/qsub.rb,
lib/torque_rm/qdel.rb,
lib/torque_rm/qstat.rb,
lib/torque_rm/common.rb
Overview
Defined Under Namespace
Modules: Qdel
Classes: Qstat, Qsub
Constant Summary
collapse
- @@username =
Etc.getlogin
- @@qcommands_path =
'/usr/bin'
- @@master =
Rye::Box.new("localhost")
- @@conf =
{}
Class Method Summary
collapse
Class Method Details
.host ⇒ Object
Get the host name/ip of the local/remote server user as submitter/interface to PBS
75
76
77
|
# File 'lib/torque_rm/common.rb', line 75
def self.host
self.server.host
end
|
.hostname ⇒ Object
Get the hostname, this may require an internet connection and fully qualified name
80
81
82
|
# File 'lib/torque_rm/common.rb', line 80
def self.hostname
self.server.hostname
end
|
.load_config(file = nil) ⇒ Object
Load configuration, default from file in user home with name .toruqe_rm.yaml
64
65
66
67
|
# 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 ⇒ Object
45
46
47
|
# File 'lib/torque_rm/common.rb', line 45
def self.path
self.qcommands_path
end
|
.qcommands_path ⇒ Object
41
42
43
|
# File 'lib/torque_rm/common.rb', line 41
def self.qcommands_path
@@qcommands_path
end
|
.qcommands_path=(path) ⇒ Object
33
34
35
36
37
38
39
|
# 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) ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# 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.server = conf[:hostname]
end
end
|
.save_config(file = nil) ⇒ Object
Save configuration, default in user home with name .toruqe_rm.yaml
70
71
72
|
# 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 ⇒ Object
15
16
17
|
# File 'lib/torque_rm/common.rb', line 15
def self.server
@@master
end
|
.server=(hostname) ⇒ Object
9
10
11
12
13
|
# File 'lib/torque_rm/common.rb', line 9
def self.server=(hostname)
if hostname
@@master = Rye::Box.new(hostname, @@conf)
end
end
|
.user ⇒ Object
27
28
29
|
# File 'lib/torque_rm/common.rb', line 27
def self.user
@@username
end
|
.username ⇒ Object
23
24
25
|
# File 'lib/torque_rm/common.rb', line 23
def self.username
@@username
end
|
.username=(username) ⇒ Object
19
20
21
|
# File 'lib/torque_rm/common.rb', line 19
def self.username=(username)
@@username = username
end
|