comana 0.0.10 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGES +8 -1
- data/Gemfile +7 -12
- data/VERSION +1 -1
- data/bin/genqsub +45 -0
- data/bin/hostinfo +182 -0
- data/bin/machinestatus +6 -3
- data/bin/queueinfo +28 -0
- data/comana.gemspec +110 -0
- data/lib/comana/clustersetting.rb +4 -3
- data/lib/comana/computationmanager.rb +25 -2
- data/lib/comana/gridenginescript.rb +68 -0
- data/lib/comana/hostinspector.rb +221 -2
- data/lib/comana/queuemanager.rb +34 -0
- data/lib/comana/queuesubmitter.rb +3 -1
- data/lib/comana.rb +2 -2
- data/test/hostinspector/.gitignore +1 -0
- data/test/test_gridenginescript.rb +16 -0
- data/test/test_hostinspector.rb +112 -0
- data/test/test_queuemanager.rb +19 -0
- metadata +57 -49
- data/lib/comana/hostinspector/pbsnodes.rb +0 -51
- data/lib/comana/hostinspector/ping.rb +0 -34
- data/test/test_hostinspector_pbsnodes.rb +0 -92
- data/test/test_hostinspector_ping.rb +0 -21
@@ -1,51 +0,0 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
# coding: utf-8
|
3
|
-
|
4
|
-
require 'rexml/document'
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
class Comana::HostInspector::Pbsnodes
|
9
|
-
attr_reader :name, :state, :np, :properties, :ntype, :gpus, :status
|
10
|
-
|
11
|
-
class UnknownNodeError < Exception; end
|
12
|
-
|
13
|
-
def initialize(hostname, pbs_server = nil)
|
14
|
-
@hostname = hostname
|
15
|
-
command = "pbsnodes -x #{hostname}"
|
16
|
-
command = "pbsnodes -x -s #{pbs_server} #{hostname}" if pbs_server
|
17
|
-
command = "cat test/pbsnodes/#{hostname}.xml" if $TEST
|
18
|
-
#command = "cat test/pbsnodes/#{hostname}.xml"
|
19
|
-
parse `#{command} 2> /dev/null`
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def parse(str)
|
25
|
-
doc = REXML::Document.new(str)
|
26
|
-
#pp doc.elements["/Data/Node/name" ] == nil
|
27
|
-
if doc.elements["/Data/Node/name" ] == nil
|
28
|
-
raise UnknownNodeError
|
29
|
-
end
|
30
|
-
|
31
|
-
@name = doc.elements["/Data/Node/name" ].text
|
32
|
-
@state = doc.elements["/Data/Node/state" ].text
|
33
|
-
@np = doc.elements["/Data/Node/np" ].text
|
34
|
-
@properties = doc.elements["/Data/Node/properties"].text
|
35
|
-
@ntype = doc.elements["/Data/Node/ntype" ].text
|
36
|
-
@gpus = doc.elements["/Data/Node/gpus" ].text
|
37
|
-
|
38
|
-
#status
|
39
|
-
@status = {}
|
40
|
-
elem = doc.elements["/Data/Node/status"]
|
41
|
-
if elem
|
42
|
-
#doc.elements["/Data/Node/status"].text.to_s.split(",").each do |equation|
|
43
|
-
elem.text.split(",").each do |equation|
|
44
|
-
left = equation.split("=")[0]
|
45
|
-
right = equation.split("=")[1].to_s
|
46
|
-
@status[left] = right
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
@@ -1,34 +0,0 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
# coding: utf-8
|
3
|
-
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
class Comana::HostInspector::Ping
|
8
|
-
PING_MIN_INTERVAL = 1
|
9
|
-
|
10
|
-
#
|
11
|
-
def initialize(hostname)
|
12
|
-
@hostname = hostname
|
13
|
-
@alive = ping
|
14
|
-
end
|
15
|
-
|
16
|
-
#Return true if ping respond from the host.
|
17
|
-
#Return false if no ping respond from the host.
|
18
|
-
def alive?
|
19
|
-
@alive
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
#Try ping three times.
|
25
|
-
#Return true if at least one time responds.
|
26
|
-
#def ping3
|
27
|
-
def ping
|
28
|
-
3.times do
|
29
|
-
return true if system("ping -c 1 -W #{PING_MIN_INTERVAL} #{@hostname} 2> /dev/null 1> /dev/null")
|
30
|
-
end
|
31
|
-
return false
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
@@ -1,92 +0,0 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
# coding: utf-8
|
3
|
-
|
4
|
-
require "fileutils"
|
5
|
-
require "helper"
|
6
|
-
|
7
|
-
$TEST = true
|
8
|
-
|
9
|
-
#describe Comana::HostInspector::do
|
10
|
-
class TC_Pbsnodes < Test::Unit::TestCase
|
11
|
-
|
12
|
-
def setup
|
13
|
-
@p00 = Comana::HostInspector::Pbsnodes.new("Br10")
|
14
|
-
@p01 = Comana::HostInspector::Pbsnodes.new("Br09")
|
15
|
-
@p02 = Comana::HostInspector::Pbsnodes.new("Ge00")
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_state
|
19
|
-
assert_equal("Br10", @p00.name)
|
20
|
-
assert_equal("free", @p00.state)
|
21
|
-
assert_equal("1", @p00.np)
|
22
|
-
assert_equal("Br", @p00.properties)
|
23
|
-
assert_equal("cluster", @p00.ntype)
|
24
|
-
assert_equal(
|
25
|
-
{
|
26
|
-
"rectime" => "1368099478",
|
27
|
-
"varattr" => "",
|
28
|
-
"jobs" => "",
|
29
|
-
"state" => "free",
|
30
|
-
"netload" => "1636471502",
|
31
|
-
"gres" => "",
|
32
|
-
"loadave" => "0.00",
|
33
|
-
"ncpus" => "4",
|
34
|
-
"physmem" => "12322444kb",
|
35
|
-
"availmem" => "20402856kb",
|
36
|
-
"totmem" => "20702856kb",
|
37
|
-
"idletime" => "1389153",
|
38
|
-
"nusers" => "0",
|
39
|
-
"nsessions" => "? 0",
|
40
|
-
"sessions" => "? 0",
|
41
|
-
"uname" => "Linux Br10 3.0.0-12-server #20-Ubuntu SMP Fri Oct 7 16:36:30 UTC 2011 x86_64",
|
42
|
-
"opsys" => "linux"
|
43
|
-
},
|
44
|
-
@p00.status
|
45
|
-
)
|
46
|
-
assert_equal("0", @p00.gpus)
|
47
|
-
|
48
|
-
|
49
|
-
assert_equal("Br09",@p01.name)
|
50
|
-
assert_equal("down",@p01.state)
|
51
|
-
assert_equal("1",@p01.np)
|
52
|
-
assert_equal("Br",@p01.properties)
|
53
|
-
assert_equal("cluster",@p01.ntype)
|
54
|
-
assert_equal({},@p01.status)
|
55
|
-
assert_equal("0",@p01.gpus)
|
56
|
-
|
57
|
-
|
58
|
-
assert_equal("Ge00", @p02.name)
|
59
|
-
assert_equal("job-exclusive", @p02.state)
|
60
|
-
assert_equal("1", @p02.np)
|
61
|
-
assert_equal("Ge", @p02.properties)
|
62
|
-
assert_equal("cluster", @p02.ntype)
|
63
|
-
assert_equal(
|
64
|
-
{
|
65
|
-
"rectime" => "1368442164",
|
66
|
-
"varattr" => "",
|
67
|
-
"jobs" => "6073.os.calc.atom",
|
68
|
-
"state" => "free",
|
69
|
-
"netload" => "18920135352",
|
70
|
-
"gres" => "",
|
71
|
-
"loadave" => "0.63",
|
72
|
-
"ncpus" => "4",
|
73
|
-
"physmem" => "4046772kb",
|
74
|
-
"availmem" => "12143912kb",
|
75
|
-
"totmem" => "12427184kb",
|
76
|
-
"idletime" => "2697087",
|
77
|
-
"nusers" => "0",
|
78
|
-
"nsessions" => "? 0",
|
79
|
-
"sessions" => "? 0",
|
80
|
-
"uname" => "Linux Ge00 3.0.0-12-server #20-Ubuntu SMP Fri Oct 7 16:36:30 UTC 2011 x86_64",
|
81
|
-
"opsys" => "linux"
|
82
|
-
},
|
83
|
-
@p02.status
|
84
|
-
)
|
85
|
-
assert_equal("0", @p02.gpus)
|
86
|
-
|
87
|
-
assert_raise(Comana::HostInspector::Pbsnodes::UnknownNodeError){
|
88
|
-
Comana::HostInspector::Pbsnodes.new("Ge08")
|
89
|
-
}
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
@@ -1,21 +0,0 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
# coding: utf-8
|
3
|
-
|
4
|
-
require "helper"
|
5
|
-
|
6
|
-
#describe Comana::HostInspector::Ping do
|
7
|
-
class TC_Ping < Test::Unit::TestCase
|
8
|
-
def setup
|
9
|
-
#context 'not exist or down' do
|
10
|
-
@hi00 = Comana::HostInspector::Ping.new("")
|
11
|
-
|
12
|
-
#context 'exist and alive' do
|
13
|
-
@hi01 = Comana::HostInspector::Ping.new("localhost")
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_alive?
|
17
|
-
assert_equal(false , @hi00.alive?)
|
18
|
-
assert_equal(true , @hi01.alive?)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|