comana 0.0.9 → 0.0.10
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.
- data/CHANGES +20 -0
- data/Gemfile +10 -4
- data/Rakefile +26 -9
- data/VERSION +1 -1
- data/bin/machinestatus +189 -0
- data/bin/scpall +64 -0
- data/bin/sshall +58 -0
- data/example/dot.clustersetting +15 -0
- data/lib/comana.rb +12 -1
- data/lib/comana/clustersetting.rb +55 -0
- data/lib/comana/computationmanager.rb +10 -10
- data/lib/comana/hostinspector.rb +4 -0
- data/lib/comana/hostinspector/pbsnodes.rb +51 -0
- data/lib/comana/hostinspector/ping.rb +34 -0
- data/lib/comana/hostselector.rb +45 -0
- data/lib/comana/queuesubmitter.rb +39 -64
- data/memo.txt +2 -0
- data/test/helper.rb +17 -0
- data/{spec → test}/locked/input_a +0 -0
- data/{spec → test}/locked/input_b +0 -0
- data/{spec → test}/locked/lock_comana/dummy +0 -0
- data/{spec → test}/locked_outputted/input_a +0 -0
- data/{spec → test}/locked_outputted/input_b +0 -0
- data/{spec → test}/locked_outputted/lock_comana/dummy +0 -0
- data/{spec → test}/locked_outputted/output +0 -0
- data/{spec/queuesubmitter/locked/lock_queuesubmitter → test/not_executable}/dummy +0 -0
- data/{spec → test}/not_started/input_a +0 -0
- data/{spec → test}/not_started/input_b +0 -0
- data/{spec → test}/outputted/input_a +0 -0
- data/{spec → test}/outputted/input_b +0 -0
- data/{spec → test}/outputted/output +0 -0
- data/test/pbsnodes/Br09.xml +11 -0
- data/test/pbsnodes/Br10.xml +2 -0
- data/test/pbsnodes/Ge00.xml +2 -0
- data/test/pbsnodes/Ge08.xml +1 -0
- data/test/pbsnodes/all.xml +1 -0
- data/{spec/queuesubmitter/unlocked → test/queuesubmitter/locked/lock_queuesubmitter}/dummy +0 -0
- data/test/queuesubmitter/unlocked/dummy +0 -0
- data/test/test_clustersetting.rb +116 -0
- data/test/test_computationmanager.rb +131 -0
- data/test/test_hostinspector_pbsnodes.rb +92 -0
- data/test/test_hostinspector_ping.rb +21 -0
- data/test/test_hostselector.rb +57 -0
- data/test/test_queuesubmitter.rb +214 -0
- metadata +92 -49
- data/comana.gemspec +0 -84
- data/dot.machineinfo +0 -14
- data/lib/comana/machineinfo.rb +0 -44
- data/spec/computationmanager_spec.rb +0 -158
- data/spec/machineinfo +0 -7
- data/spec/machineinfo_spec.rb +0 -52
- data/spec/queuesubmitter_spec.rb +0 -263
- data/spec/spec_helper.rb +0 -12
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
#! /usr/bin/env ruby
|
|
2
|
+
# coding: utf-8
|
|
3
|
+
|
|
4
|
+
require "fileutils"
|
|
5
|
+
require "helper"
|
|
6
|
+
|
|
7
|
+
#require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
8
|
+
|
|
9
|
+
NOW = Time.now
|
|
10
|
+
|
|
11
|
+
class Comana::ComputationManager
|
|
12
|
+
#public :latest_modified_time, :started?
|
|
13
|
+
public :started?
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
class TC_ComputationManager < Test::Unit::TestCase
|
|
17
|
+
class CalcYet < Comana::ComputationManager
|
|
18
|
+
def finished? ; false ; end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class CalcStarted < Comana::ComputationManager
|
|
22
|
+
def finished? ; false ; end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
#describe Comana::ComputationManager, "with output, without lock" do
|
|
26
|
+
class CalcStarted < Comana::ComputationManager
|
|
27
|
+
def finished? ; false ; end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
#describe Comana::ComputationManager, "terminated" do
|
|
31
|
+
class CalcTerminated < Comana::ComputationManager
|
|
32
|
+
def finished? ; false ; end
|
|
33
|
+
def initialize(dir)
|
|
34
|
+
@dir = dir
|
|
35
|
+
@lockdir = "lock_comana"
|
|
36
|
+
@alive_time = 500
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
#describe Comana::ComputationManager, "finished" do
|
|
41
|
+
class CalcFinished < Comana::ComputationManager
|
|
42
|
+
def finished? ; true ; end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
#describe Comana::ComputationManager, "cannot execute" do
|
|
46
|
+
class CalcNotExecutable < Comana::ComputationManager
|
|
47
|
+
def calculate
|
|
48
|
+
end_status = system "" # notExistCommand
|
|
49
|
+
raise ExecuteError unless end_status
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def finished?
|
|
53
|
+
return false
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def prepare_next
|
|
57
|
+
#return false
|
|
58
|
+
raise
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def setup
|
|
66
|
+
calc_dir = "test/not_started"
|
|
67
|
+
@calc00 = CalcYet.new(calc_dir)
|
|
68
|
+
File.utime(NOW - 1000 ,NOW - 1000, "#{calc_dir}/input_a")
|
|
69
|
+
File.utime(NOW - 2000 ,NOW - 2000, "#{calc_dir}/input_b")
|
|
70
|
+
@lockdir = "#{calc_dir}/lock_comana"
|
|
71
|
+
FileUtils.rm(@lockdir) if File.exist?(@lockdir)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
calc_dir = "test/locked"
|
|
75
|
+
@calc01 = CalcStarted .new(calc_dir)
|
|
76
|
+
File.utime(NOW - 1000 ,NOW - 1000, "#{calc_dir}/input_a")
|
|
77
|
+
File.utime(NOW - 2000 ,NOW - 2000, "#{calc_dir}/input_b")
|
|
78
|
+
|
|
79
|
+
calc_dir = "test/outputted"
|
|
80
|
+
@calc02 = CalcStarted .new(calc_dir)
|
|
81
|
+
File.utime(NOW - 1000 ,NOW - 1000, "#{calc_dir}/input_a")
|
|
82
|
+
File.utime(NOW - 2000 ,NOW - 2000, "#{calc_dir}/input_b")
|
|
83
|
+
File.utime(NOW - 2000 ,NOW - 2000, "#{calc_dir}/output")
|
|
84
|
+
|
|
85
|
+
calc_dir = "test/locked_outputted"
|
|
86
|
+
@calc_terminated = CalcTerminated.new(calc_dir)
|
|
87
|
+
File.utime(NOW - 1000 ,NOW - 1000, "#{calc_dir}/input_a")
|
|
88
|
+
File.utime(NOW - 2000 ,NOW - 2000, "#{calc_dir}/input_b")
|
|
89
|
+
File.utime(NOW - 9000 ,NOW - 9000, "#{calc_dir}/output")
|
|
90
|
+
File.utime(NOW - 9000 ,NOW - 9000, "#{calc_dir}/lock_comana")
|
|
91
|
+
File.utime(NOW - 9000 ,NOW - 9000, "#{calc_dir}/lock_comana/dummy")
|
|
92
|
+
|
|
93
|
+
calc_dir = "test/locked_outputted"
|
|
94
|
+
@calc_finished = CalcFinished .new(calc_dir)
|
|
95
|
+
File.utime(NOW - 1000 ,NOW - 1000, "#{calc_dir}/input_a")
|
|
96
|
+
File.utime(NOW - 2000 ,NOW - 2000, "#{calc_dir}/input_b")
|
|
97
|
+
|
|
98
|
+
calc_dir = "test/not_executable"
|
|
99
|
+
@calc_not_exe = CalcNotExecutable .new(calc_dir)
|
|
100
|
+
@lockdir = calc_dir + "/lock_comana"
|
|
101
|
+
Dir.rmdir(@lockdir) if File.exist?(@lockdir)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def test_state
|
|
105
|
+
assert_equal(:yet, @calc00.state)
|
|
106
|
+
assert_equal(:started, @calc01.state)
|
|
107
|
+
assert_equal(:yet, @calc02.state)
|
|
108
|
+
assert_equal(:terminated, @calc_terminated.state)
|
|
109
|
+
assert_equal(:finished, @calc_finished.state)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def test_latest_modified_time
|
|
113
|
+
#it "should return latest modified time" do
|
|
114
|
+
assert_equal(NOW - 1000, @calc00.latest_modified_time)
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def test_started?
|
|
118
|
+
#it "should return false without lock." do
|
|
119
|
+
assert_not_nil(@calc00.started?)
|
|
120
|
+
assert_equal(false, @calc00.started?)
|
|
121
|
+
|
|
122
|
+
#it "should return true with lock." do
|
|
123
|
+
assert_equal(false, @calc00.started?)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def test_start
|
|
127
|
+
#it "should raise error" do
|
|
128
|
+
assert_raise(Comana::ComputationManager::ExecuteError){ @calc_not_exe.start}
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
@@ -0,0 +1,92 @@
|
|
|
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
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#! /usr/bin/env ruby
|
|
2
|
+
# coding: utf-8
|
|
3
|
+
|
|
4
|
+
require "helper"
|
|
5
|
+
|
|
6
|
+
class Comana::HostSelector
|
|
7
|
+
attr_reader :groups_hosts
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
class TC_HostSelector < Test::Unit::TestCase
|
|
11
|
+
def setup
|
|
12
|
+
groups_hosts = {
|
|
13
|
+
"GroupA" => ["A00", "A01"],
|
|
14
|
+
"GroupB" => ["B00", "B01", "B02"]
|
|
15
|
+
}
|
|
16
|
+
@hs00 = Comana::HostSelector.new(groups_hosts)
|
|
17
|
+
|
|
18
|
+
groups_hosts = {
|
|
19
|
+
"GroupNil" => nil,
|
|
20
|
+
"GroupA" => ["A00", "A01"],
|
|
21
|
+
"GroupB" => ["B00", "B01", "B02"]
|
|
22
|
+
}
|
|
23
|
+
@hs01 = Comana::HostSelector.new(groups_hosts)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def test_load_file
|
|
27
|
+
hs = Comana::HostSelector.load_file("example/dot.clustersetting")
|
|
28
|
+
assert_equal(Comana::HostSelector, hs.class)
|
|
29
|
+
#pp hs
|
|
30
|
+
#assert_equal(["A00", "A01", "B00", "B01", "B02"], hs.select_all)
|
|
31
|
+
assert_equal({"A"=>["A00", "A01"], "B"=>["B00", "B01", "B02"]}, hs.groups_hosts)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def test_select_all
|
|
35
|
+
#it 'should return all hosts' do
|
|
36
|
+
assert_equal(["A00", "A01", "B00", "B01", "B02"], @hs00.select_all)
|
|
37
|
+
|
|
38
|
+
#it 'should return all hosts without nil' do
|
|
39
|
+
assert_equal(["A00", "A01", "B00", "B01", "B02"], @hs01.select_all)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def test_select_group
|
|
43
|
+
#it 'should return hosts in GroupA' do
|
|
44
|
+
assert_equal(["A00", "A01"], @hs00.select_group("GroupA"))
|
|
45
|
+
|
|
46
|
+
#it 'should raise Comana::HostSelector::NoEntryError' do
|
|
47
|
+
assert_raise(Comana::HostSelector::NoEntryError){
|
|
48
|
+
@hs00.select_group("GroupNil")
|
|
49
|
+
}
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def test_groups
|
|
53
|
+
#it 'should return all groups' do
|
|
54
|
+
assert_equal(["GroupA", "GroupB"], @hs00.groups)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
#! /usr/bin/env ruby
|
|
2
|
+
# coding: utf-8
|
|
3
|
+
|
|
4
|
+
require "helper"
|
|
5
|
+
class Comana::QueueSubmitter # < ComputationManager
|
|
6
|
+
public :dump_prologue
|
|
7
|
+
public :dump_script
|
|
8
|
+
public :dump_epilogue
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
class TC_QueueSubmitter < Test::Unit::TestCase
|
|
12
|
+
def setup
|
|
13
|
+
opts = {
|
|
14
|
+
:target => Comana::ComputationManager.new("test/not_started"),
|
|
15
|
+
:command => "command_line",
|
|
16
|
+
:cluster => "Nodes",
|
|
17
|
+
:num_nodes => 4,
|
|
18
|
+
}
|
|
19
|
+
@qs_notstarted = Comana::QueueSubmitter.new(opts)
|
|
20
|
+
|
|
21
|
+
opts = {
|
|
22
|
+
:target => Comana::ComputationManager.new("test/queuesubmitter/locked"),
|
|
23
|
+
:command => "command_line",
|
|
24
|
+
:cluster => "Nodes",
|
|
25
|
+
:num_nodes => 4,
|
|
26
|
+
}
|
|
27
|
+
@qs_locked = Comana::QueueSubmitter.new(opts)
|
|
28
|
+
|
|
29
|
+
opts = {
|
|
30
|
+
:target => Comana::ComputationManager.new("test/queuesubmitter/unlocked"),
|
|
31
|
+
:command => "command_line",
|
|
32
|
+
:cluster => "Nodes",
|
|
33
|
+
:num_nodes => 4,
|
|
34
|
+
}
|
|
35
|
+
@qs_unlocked = Comana::QueueSubmitter.new(opts)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def test_initialize
|
|
39
|
+
opts = {
|
|
40
|
+
#:target => "dir_name",
|
|
41
|
+
:command => "command_line",
|
|
42
|
+
:cluster => "Nodes",
|
|
43
|
+
:num_nodes => 4,
|
|
44
|
+
}
|
|
45
|
+
assert_raise(Comana::QueueSubmitter::InitializeError){
|
|
46
|
+
Comana::QueueSubmitter.new(opts)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
opts = {
|
|
50
|
+
:target => Comana::ComputationManager.new("dir_name"),
|
|
51
|
+
#:command => "command_line",
|
|
52
|
+
:cluster => "Nodes",
|
|
53
|
+
:num_nodes => 4,
|
|
54
|
+
}
|
|
55
|
+
assert_raise(Comana::QueueSubmitter::InitializeError){
|
|
56
|
+
Comana::QueueSubmitter.new(opts)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
opts = {
|
|
60
|
+
:target => Comana::ComputationManager.new("dir_name"),
|
|
61
|
+
:command => "command_line",
|
|
62
|
+
#:cluster => "Nodes",
|
|
63
|
+
:num_nodes => 4,
|
|
64
|
+
}
|
|
65
|
+
assert_nothing_raised{ Comana::QueueSubmitter.new(opts) }
|
|
66
|
+
|
|
67
|
+
opts = {
|
|
68
|
+
:target => Comana::ComputationManager.new("dir_name"),
|
|
69
|
+
:command => "command_line",
|
|
70
|
+
:cluster => "Nodes",
|
|
71
|
+
#:num_nodes => 4,
|
|
72
|
+
}
|
|
73
|
+
assert_nothing_raised{ Comana::QueueSubmitter.new(opts) }
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def test_dump_prologue
|
|
77
|
+
#context "speed mode" do
|
|
78
|
+
correct = [
|
|
79
|
+
'#! /bin/sh',
|
|
80
|
+
'LOGFILE="${PBS_O_WORKDIR}/prologue_script.log"',
|
|
81
|
+
'echo "hostname : `hostname`" >> $LOGFILE',
|
|
82
|
+
'echo "job id : $1" >> $LOGFILE',
|
|
83
|
+
'echo "job execution user name : $2" >> $LOGFILE',
|
|
84
|
+
'echo "job execution group name : $3" >> $LOGFILE',
|
|
85
|
+
'echo "job name : $4" >> $LOGFILE',
|
|
86
|
+
'echo "list of requested resource limits: $5" >> $LOGFILE',
|
|
87
|
+
'echo "job execution queue : $6" >> $LOGFILE',
|
|
88
|
+
'echo "job account : $7" >> $LOGFILE',
|
|
89
|
+
'echo "PBS_O_WORKDIR : ${PBS_O_WORKDIR}" >> $LOGFILE',
|
|
90
|
+
'echo "nodes in pbs_nodefile : " >> $LOGFILE',
|
|
91
|
+
'cat ${PBS_NODEFILE} >> $LOGFILE',
|
|
92
|
+
'exit 0',
|
|
93
|
+
].join("\n")
|
|
94
|
+
assert_equal(correct, @qs_notstarted.dump_prologue)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def test_dump_script
|
|
98
|
+
correct = [
|
|
99
|
+
"#! /bin/sh",
|
|
100
|
+
"#PBS -N test/not_started",
|
|
101
|
+
"#PBS -l nodes=4:ppn=1:Nodes,walltime=7:00:00:00",
|
|
102
|
+
"#PBS -j oe",
|
|
103
|
+
"",
|
|
104
|
+
"cd ${PBS_O_WORKDIR} && \\",
|
|
105
|
+
"command_line",
|
|
106
|
+
].join("\n")
|
|
107
|
+
assert_equal(correct, @qs_notstarted.dump_script)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
opts = {
|
|
111
|
+
:target => Comana::ComputationManager.new("test/not_started"),
|
|
112
|
+
:command => "command_line",
|
|
113
|
+
#:cluster => "Nodes",
|
|
114
|
+
:num_nodes => 4,
|
|
115
|
+
}
|
|
116
|
+
qs = Comana::QueueSubmitter.new(opts)
|
|
117
|
+
correct = [
|
|
118
|
+
"#! /bin/sh",
|
|
119
|
+
"#PBS -N test/not_started",
|
|
120
|
+
"#PBS -l nodes=4:ppn=1,walltime=7:00:00:00",
|
|
121
|
+
"#PBS -j oe",
|
|
122
|
+
"",
|
|
123
|
+
"cd ${PBS_O_WORKDIR} && \\",
|
|
124
|
+
"command_line",
|
|
125
|
+
].join("\n")
|
|
126
|
+
assert_equal(correct, qs.dump_script)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
opts = {
|
|
130
|
+
:target => Comana::ComputationManager.new("test/not_started"),
|
|
131
|
+
:command => "command_line",
|
|
132
|
+
:cluster => "Nodes",
|
|
133
|
+
#:num_nodes => 4,
|
|
134
|
+
}
|
|
135
|
+
qs = Comana::QueueSubmitter.new(opts)
|
|
136
|
+
correct = [
|
|
137
|
+
"#! /bin/sh",
|
|
138
|
+
"#PBS -N test/not_started",
|
|
139
|
+
"#PBS -l nodes=1:ppn=1:Nodes,walltime=7:00:00:00",
|
|
140
|
+
"#PBS -j oe",
|
|
141
|
+
"",
|
|
142
|
+
"cd ${PBS_O_WORKDIR} && \\",
|
|
143
|
+
"command_line",
|
|
144
|
+
].join("\n")
|
|
145
|
+
assert_equal(correct, qs.dump_script)
|
|
146
|
+
|
|
147
|
+
opts = {
|
|
148
|
+
:target => Comana::ComputationManager.new("test/not_started"),
|
|
149
|
+
:command => "command_line",
|
|
150
|
+
#:cluster => "Nodes",
|
|
151
|
+
#:num_nodes => 4,
|
|
152
|
+
}
|
|
153
|
+
qs = Comana::QueueSubmitter.new(opts)
|
|
154
|
+
correct = [
|
|
155
|
+
"#! /bin/sh",
|
|
156
|
+
"#PBS -N test/not_started",
|
|
157
|
+
"#PBS -l walltime=7:00:00:00",
|
|
158
|
+
"#PBS -j oe",
|
|
159
|
+
"",
|
|
160
|
+
"cd ${PBS_O_WORKDIR} && \\",
|
|
161
|
+
"command_line",
|
|
162
|
+
].join("\n")
|
|
163
|
+
assert_equal(correct, qs.dump_script)
|
|
164
|
+
|
|
165
|
+
opts = {
|
|
166
|
+
:target => Comana::ComputationManager.new("test/not_started"),
|
|
167
|
+
:command => "command_line",
|
|
168
|
+
#:cluster => "Nodes",
|
|
169
|
+
#:num_nodes => 4,
|
|
170
|
+
:priority => -10,
|
|
171
|
+
}
|
|
172
|
+
qs = Comana::QueueSubmitter.new(opts)
|
|
173
|
+
correct = [
|
|
174
|
+
"#! /bin/sh",
|
|
175
|
+
"#PBS -N test/not_started",
|
|
176
|
+
"#PBS -l walltime=7:00:00:00",
|
|
177
|
+
"#PBS -p -10",
|
|
178
|
+
"#PBS -j oe",
|
|
179
|
+
"",
|
|
180
|
+
"cd ${PBS_O_WORKDIR} && \\",
|
|
181
|
+
"command_line",
|
|
182
|
+
].join("\n")
|
|
183
|
+
assert_equal(correct, qs.dump_script)
|
|
184
|
+
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
def test_dump_epilogue
|
|
188
|
+
correct = [
|
|
189
|
+
'#! /bin/sh',
|
|
190
|
+
'LOGFILE="${PBS_O_WORKDIR}/epilogue_script.log"',
|
|
191
|
+
'echo "job id : $1" >> $LOGFILE',
|
|
192
|
+
'echo "job execution user name : $2" >> $LOGFILE',
|
|
193
|
+
'echo "job execution group name : $3" >> $LOGFILE',
|
|
194
|
+
'echo "job name : $4" >> $LOGFILE',
|
|
195
|
+
'echo "session id : $5" >> $LOGFILE',
|
|
196
|
+
'echo "list of requested resource limits: $6" >> $LOGFILE',
|
|
197
|
+
'echo "list of resources used by job : $7" >> $LOGFILE',
|
|
198
|
+
'echo "job execution queue : $8" >> $LOGFILE',
|
|
199
|
+
'echo "job account : $9" >> $LOGFILE',
|
|
200
|
+
'echo "job exit code : $10" >> $LOGFILE',
|
|
201
|
+
'exit 0',
|
|
202
|
+
].join("\n")
|
|
203
|
+
|
|
204
|
+
assert_equal(correct, @qs_notstarted.dump_epilogue)
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
def test_finished?
|
|
208
|
+
#context "locked" do
|
|
209
|
+
assert_equal(true, @qs_locked.finished?)
|
|
210
|
+
|
|
211
|
+
#context "unlocked" do
|
|
212
|
+
assert_equal(false, @qs_unlocked.finished?)
|
|
213
|
+
end
|
|
214
|
+
end
|