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.
Files changed (53) hide show
  1. data/CHANGES +20 -0
  2. data/Gemfile +10 -4
  3. data/Rakefile +26 -9
  4. data/VERSION +1 -1
  5. data/bin/machinestatus +189 -0
  6. data/bin/scpall +64 -0
  7. data/bin/sshall +58 -0
  8. data/example/dot.clustersetting +15 -0
  9. data/lib/comana.rb +12 -1
  10. data/lib/comana/clustersetting.rb +55 -0
  11. data/lib/comana/computationmanager.rb +10 -10
  12. data/lib/comana/hostinspector.rb +4 -0
  13. data/lib/comana/hostinspector/pbsnodes.rb +51 -0
  14. data/lib/comana/hostinspector/ping.rb +34 -0
  15. data/lib/comana/hostselector.rb +45 -0
  16. data/lib/comana/queuesubmitter.rb +39 -64
  17. data/memo.txt +2 -0
  18. data/test/helper.rb +17 -0
  19. data/{spec → test}/locked/input_a +0 -0
  20. data/{spec → test}/locked/input_b +0 -0
  21. data/{spec → test}/locked/lock_comana/dummy +0 -0
  22. data/{spec → test}/locked_outputted/input_a +0 -0
  23. data/{spec → test}/locked_outputted/input_b +0 -0
  24. data/{spec → test}/locked_outputted/lock_comana/dummy +0 -0
  25. data/{spec → test}/locked_outputted/output +0 -0
  26. data/{spec/queuesubmitter/locked/lock_queuesubmitter → test/not_executable}/dummy +0 -0
  27. data/{spec → test}/not_started/input_a +0 -0
  28. data/{spec → test}/not_started/input_b +0 -0
  29. data/{spec → test}/outputted/input_a +0 -0
  30. data/{spec → test}/outputted/input_b +0 -0
  31. data/{spec → test}/outputted/output +0 -0
  32. data/test/pbsnodes/Br09.xml +11 -0
  33. data/test/pbsnodes/Br10.xml +2 -0
  34. data/test/pbsnodes/Ge00.xml +2 -0
  35. data/test/pbsnodes/Ge08.xml +1 -0
  36. data/test/pbsnodes/all.xml +1 -0
  37. data/{spec/queuesubmitter/unlocked → test/queuesubmitter/locked/lock_queuesubmitter}/dummy +0 -0
  38. data/test/queuesubmitter/unlocked/dummy +0 -0
  39. data/test/test_clustersetting.rb +116 -0
  40. data/test/test_computationmanager.rb +131 -0
  41. data/test/test_hostinspector_pbsnodes.rb +92 -0
  42. data/test/test_hostinspector_ping.rb +21 -0
  43. data/test/test_hostselector.rb +57 -0
  44. data/test/test_queuesubmitter.rb +214 -0
  45. metadata +92 -49
  46. data/comana.gemspec +0 -84
  47. data/dot.machineinfo +0 -14
  48. data/lib/comana/machineinfo.rb +0 -44
  49. data/spec/computationmanager_spec.rb +0 -158
  50. data/spec/machineinfo +0 -7
  51. data/spec/machineinfo_spec.rb +0 -52
  52. data/spec/queuesubmitter_spec.rb +0 -263
  53. data/spec/spec_helper.rb +0 -12
data/spec/machineinfo DELETED
@@ -1,7 +0,0 @@
1
- --- # vim:syntax=yaml
2
- "SeriesA":
3
- "data1": "A-1"
4
- "data2": "A-2"
5
- "SeriesB":
6
- "data1": "B-1"
7
- "data2": "B-2"
@@ -1,52 +0,0 @@
1
- #! /usr/bin/env ruby
2
- # coding: utf-8
3
-
4
- require "fileutils"
5
-
6
- require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
7
- require "comana/machineinfo.rb"
8
-
9
- describe MachineInfo do
10
- describe "#load_file" do
11
- context "not exist machineinfo file" do
12
- DATA_FILE = "spec/machineinfo"
13
- it { lambda{MachineInfo.load_file(DATA_FILE)}.should_not raise_error}
14
-
15
- mi00 = MachineInfo.load_file(DATA_FILE)
16
- it {mi00.get_info("SeriesA").should == { "data1" => "A-1", "data2" => "A-2" } }
17
- end
18
-
19
- context "not exist machineinfo file" do
20
- it { lambda{ MachineInfo.load_file("") }.should raise_error(Errno::ENOENT) }
21
- end
22
- end
23
-
24
- describe "#get_info" do
25
- before do
26
- @mi00 = MachineInfo.new({
27
- "SeriesA" => { "data1" => "A-1", "data2" => "A-2" },
28
- "SeriesB" => { "data1" => "B-1", "data2" => "B-2" },
29
- })
30
- end
31
-
32
- context "mach to hostname in data" do
33
- subject { @mi00.get_info("SeriesA") }
34
- it {should == { "data1" => "A-1", "data2" => "A-2" } }
35
- end
36
-
37
- context "series name + integers" do
38
- subject { @mi00.get_info("SeriesA00") }
39
- it {should == { "data1" => "A-1", "data2" => "A-2" } }
40
- end
41
-
42
- context "series name + alphabet" do
43
- it {lambda{@mi00.get_info("seriesAB")}.should raise_error(MachineInfo::NoEntryError)}
44
- end
45
-
46
- context "no entry" do
47
- it {lambda{@mi00.get_info("")}.should raise_error(MachineInfo::NoEntryError)}
48
- end
49
- end
50
-
51
- end
52
-
@@ -1,263 +0,0 @@
1
- #! /usr/bin/env ruby
2
- # coding: utf-8
3
-
4
- require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
5
- require "comana/queuesubmitter.rb"
6
- require "comana/computationmanager.rb"
7
- require "comana/machineinfo.rb"
8
-
9
- class QueueSubmitter < ComputationManager
10
- public :dump_prologue
11
- public :dump_script
12
- public :dump_epilogue
13
- end
14
-
15
- #describe QueueSubmitter, "with chars to be escaped" do
16
- describe QueueSubmitter do
17
- describe "#initialize" do
18
- context "opts not have target" do
19
- opts = {
20
- #"target" => "dir_name",
21
- "command" => "command_line",
22
- "cluster" => "Nodes",
23
- "number" => 4,
24
- }
25
- it {lambda{QueueSubmitter.new(opts)}.should raise_error(
26
- QueueSubmitter::InitializeError)}
27
- end
28
-
29
- context "opts not have :command" do
30
- opts = {
31
- "target" => ComputationManager.new("dir_name"),
32
- #"command" => "command_line",
33
- "cluster" => "Nodes",
34
- "number" => 4,
35
- }
36
- it {lambda{QueueSubmitter.new(opts)}.should raise_error(
37
- QueueSubmitter::InitializeError)}
38
- end
39
-
40
- context "opts not have cluster" do
41
- opts = {
42
- "target" => ComputationManager.new("dir_name"),
43
- "command" => "command_line",
44
- #"cluster" => "Nodes",
45
- "number" => 4,
46
- }
47
- it {lambda{QueueSubmitter.new(opts)}.should raise_error(
48
- QueueSubmitter::InitializeError)}
49
- end
50
-
51
- context "opts not have :command" do
52
- opts = {
53
- "target" => ComputationManager.new("dir_name"),
54
- #"command" => "command_line",
55
- "cluster" => "Nodes",
56
- "number" => 4,
57
- }
58
- it {lambda{QueueSubmitter.new(opts)}.should raise_error(
59
- QueueSubmitter::InitializeError)}
60
- end
61
- end
62
-
63
- #describe "#self.correct_options" do
64
- # before do
65
- # @machine_info = MachineInfo.new(
66
- # {
67
- # "CLUSTER" => {
68
- # "speed" => 2,
69
- # "economy" => 1,
70
- # "command" => "calc_command"
71
- # },
72
- # }
73
- # )
74
- # end
75
-
76
- # context "cluster not indicated" do
77
- # opts = {
78
- # "number" => 1,
79
- # #"cluster" => "CLUSTER",
80
- # "target" => "calc_dir",
81
- # }
82
- # it {lambda{QueueSubmitter.correct_options(opts, @machine_info)}.should
83
- # raise_error(QueueSubmitter::InvalidArgumentError)}
84
- # end
85
-
86
- # context "target not indicated" do
87
- # opts = {
88
- # "number" => 1,
89
- # "cluster" => "CLUSTER",
90
- # #"target" => "calc_dir",
91
- # }
92
- # it {lambda{QueueSubmitter.correct_options(opts, @machine_info)}.should
93
- # raise_error(QueueSubmitter::InvalidArgumentError)}
94
- # end
95
-
96
- # context "number not indicated" do
97
- # opts = {
98
- # #"number" => 1,
99
- # "cluster" => "CLUSTER",
100
- # "target" => "calc_dir",
101
- # }
102
- # it {lambda{QueueSubmitter.correct_options(opts, @machine_info)}.should
103
- # raise_error(QueueSubmitter::InvalidArgumentError)}
104
- # end
105
-
106
- # context "orthodox indication" do
107
- # opts = {
108
- # "number" => 1,
109
- # "cluster" => "CLUSTER",
110
- # "target" => "calc_dir",
111
- # }
112
- # results = QueueSubmitter.correct_options(opts, @machine_info)
113
- # it {results.should ==
114
- # {
115
- # "target" => "calc_dir",
116
- # "command" => "calc_command",
117
- # "number" => 1,
118
- # "cluster" => "CLUSTER",
119
- # }
120
- # }
121
- # end
122
-
123
- # context "number indication as string in MachineInfo" do
124
- # opts = {
125
- # "cluster" => "CLUSTER",
126
- # "number" => "speed",
127
- # "target" => "calc_dir",
128
- # }
129
- # results = QueueSubmitter.correct_options(opts, @machine_info)
130
- # it {results.should ==
131
- # {
132
- # "cluster" => "CLUSTER",
133
- # "number" => 2,
134
- # "target" => "calc_dir",
135
- # "command" => "calc_command",
136
- # }
137
- # }
138
- # end
139
- #end
140
-
141
- describe "#dump_prologue" do
142
- before do
143
- opts = {
144
- "target" => ComputationManager.new("spec/not_started"),
145
- "command" => "command_line",
146
- "cluster" => "Nodes",
147
- "number" => 4,
148
- }
149
- @qs00 = QueueSubmitter.new(opts)
150
-
151
- @correct = [
152
- '#! /bin/sh',
153
- 'LOGFILE="${PBS_O_WORKDIR}/prologue_script.log"',
154
- 'echo "hostname : `hostname`" >> $LOGFILE',
155
- 'echo "job id : $1" >> $LOGFILE',
156
- 'echo "job execution user name : $2" >> $LOGFILE',
157
- 'echo "job execution group name : $3" >> $LOGFILE',
158
- 'echo "job name : $4" >> $LOGFILE',
159
- 'echo "list of requested resource limits: $5" >> $LOGFILE',
160
- 'echo "job execution queue : $6" >> $LOGFILE',
161
- 'echo "job account : $7" >> $LOGFILE',
162
- 'echo "PBS_O_WORKDIR : ${PBS_O_WORKDIR}" >> $LOGFILE',
163
- 'echo "nodes in pbs_nodefile : " >> $LOGFILE',
164
- 'cat ${PBS_NODEFILE} >> $LOGFILE',
165
- 'exit 0',
166
- ].join("\n")
167
- end
168
-
169
- context "speed mode" do
170
- it { @qs00.dump_prologue.should == @correct}
171
- end
172
- end
173
-
174
- describe "#dump_script" do
175
- before do
176
- opts = {
177
- "target" => ComputationManager.new("spec/not_started"),
178
- "command" => "command_line",
179
- "cluster" => "Nodes",
180
- "number" => 4,
181
- }
182
- @qs00 = QueueSubmitter.new(opts)
183
-
184
- @correct = [
185
- "#! /bin/sh",
186
- "#PBS -N spec/not_started",
187
- "#PBS -l nodes=4:ppn=1:Nodes,walltime=7:00:00:00",
188
- "#PBS -j oe",
189
- "",
190
- "cd ${PBS_O_WORKDIR} && \\",
191
- "command_line",
192
- ].join("\n")
193
- end
194
-
195
- context "speed mode" do
196
- it { @qs00.dump_script.should == @correct}
197
- end
198
- end
199
-
200
- describe "#dump_epilogue" do
201
- before do
202
- opts = {
203
- "target" => ComputationManager.new("spec/not_started"),
204
- "command" => "command_line",
205
- "cluster" => "Nodes",
206
- "number" => 4,
207
- }
208
- @qs00 = QueueSubmitter.new(opts)
209
-
210
- @correct = [
211
- '#! /bin/sh',
212
- 'LOGFILE="${PBS_O_WORKDIR}/epilogue_script.log"',
213
- 'echo "job id : $1" >> $LOGFILE',
214
- 'echo "job execution user name : $2" >> $LOGFILE',
215
- 'echo "job execution group name : $3" >> $LOGFILE',
216
- 'echo "job name : $4" >> $LOGFILE',
217
- 'echo "session id : $5" >> $LOGFILE',
218
- 'echo "list of requested resource limits: $6" >> $LOGFILE',
219
- 'echo "list of resources used by job : $7" >> $LOGFILE',
220
- 'echo "job execution queue : $8" >> $LOGFILE',
221
- 'echo "job account : $9" >> $LOGFILE',
222
- 'echo "job exit code : $10" >> $LOGFILE',
223
- 'exit 0',
224
- ].join("\n")
225
- end
226
-
227
- context "speed mode" do
228
- it { @qs00.dump_epilogue.should == @correct}
229
- end
230
- end
231
-
232
-
233
-
234
- describe "#finished?" do
235
- context "locked" do
236
- it do
237
- opts = {
238
- "target" => ComputationManager.new("spec/queuesubmitter/locked"),
239
- "command" => "command_line",
240
- "cluster" => "Nodes",
241
- "number" => 4,
242
- }
243
- @qs00 = QueueSubmitter.new(opts)
244
-
245
- @qs00.finished?.should == true
246
- end
247
- end
248
-
249
- context "unlocked" do
250
- it do
251
- opts = {
252
- "target" => ComputationManager.new("spec/queuesubmitter/unlocked"),
253
- "command" => "command_line",
254
- "cluster" => "Nodes",
255
- "number" => 4,
256
- }
257
- @qs00 = QueueSubmitter.new(opts)
258
-
259
- @qs00.finished?.should == false
260
- end
261
- end
262
- end
263
- end
data/spec/spec_helper.rb DELETED
@@ -1,12 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- $LOAD_PATH.unshift(File.dirname(__FILE__))
3
- require 'rspec'
4
- require 'comana'
5
-
6
- # Requires supporting files with custom matchers and macros, etc,
7
- # in ./support/ and its subdirectories.
8
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
-
10
- RSpec.configure do |config|
11
-
12
- end