comana 0.0.8 → 0.0.9
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/VERSION +1 -1
- data/comana.gemspec +2 -2
- data/lib/comana/machineinfo.rb +9 -0
- data/lib/comana/queuesubmitter.rb +52 -50
- data/memo.txt +3 -0
- data/spec/queuesubmitter_spec.rb +110 -77
- metadata +13 -13
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.9
|
data/comana.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "comana"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["ippei94da"]
|
12
|
-
s.date = "2012-05-
|
12
|
+
s.date = "2012-05-29"
|
13
13
|
s.description = "Comana, COmputation MANAger,\n is a software to provide a framework of\n managing scientific computing.\n Researchers on computing have to check calculation and\n generate new calculation and execute, repeatedly.\n The abstract class that this gem provide would help the work.\n "
|
14
14
|
s.email = "ippei94da@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/comana/machineinfo.rb
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
require "fileutils"
|
5
5
|
require "comana/computationmanager.rb"
|
6
6
|
require "comana/machineinfo.rb"
|
7
|
-
require "optparse"
|
8
7
|
|
9
8
|
#
|
10
9
|
#
|
@@ -20,61 +19,64 @@ class QueueSubmitter < ComputationManager
|
|
20
19
|
class InvalidArgumentError < Exception; end
|
21
20
|
|
22
21
|
# opts is a hash includes data belows:
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
# Note that this is not directory name, to check to be calculatable.
|
22
|
+
# "command" => executable command line written in script.
|
23
|
+
# "cluster" => name of cluster.
|
24
|
+
# "target" => calculation as ComputationManager subclass.
|
25
|
+
# Note that this is not target name, to check calculatable.
|
28
26
|
def initialize(opts)
|
29
|
-
|
30
|
-
|
27
|
+
#opts = self.class.correct_options(opts)
|
28
|
+
["target", "command", "number", "cluster"].each do |symbol|
|
29
|
+
raise InitializeError, "No #{symbol} in argument 'opts'" unless opts.has_key?(symbol)
|
31
30
|
end
|
32
31
|
|
33
|
-
super(opts[
|
34
|
-
|
35
|
-
@
|
36
|
-
@
|
37
|
-
@
|
32
|
+
super(opts["target"].dir)
|
33
|
+
|
34
|
+
@command = opts["command"]
|
35
|
+
@cluster = opts["cluster"]
|
36
|
+
@number = opts["number"]
|
38
37
|
@lockdir = "lock_queuesubmitter"
|
39
38
|
end
|
40
39
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
unless
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
40
|
+
## Check and correct options given as hash, 'opts', using machineinfo.
|
41
|
+
## Return hash corrected.
|
42
|
+
## 'opts' must have keys of
|
43
|
+
## "number"
|
44
|
+
## "cluster"
|
45
|
+
## "target"
|
46
|
+
## machineinfo is a MachineInfo class instance.
|
47
|
+
#def self.correct_options(opts, machineinfo)
|
48
|
+
# # option analysis
|
49
|
+
# ["target", "number", "cluster"].each do |symbol|
|
50
|
+
# raise InitializeError, "No #{symbol} in argument 'opts'" unless opts.has_key?(symbol)
|
51
|
+
# end
|
52
|
+
|
53
|
+
|
54
|
+
# #unless ary.size == 1
|
55
|
+
# # raise InitializeError, "Not one target indicated: #{ary.join(", ")}."
|
56
|
+
# #end
|
57
|
+
|
58
|
+
# #unless opts["cluster"]
|
59
|
+
# # raise InvalidArgumentError,
|
60
|
+
# # "-c option not set."
|
61
|
+
# #end
|
62
|
+
|
63
|
+
# ## Number of nodes: number, key string, or default value(1).
|
64
|
+
# #if opts["number"].to_i > 0
|
65
|
+
# # opts["number"] = opts["number"].to_i
|
66
|
+
# #else
|
67
|
+
# # number = machineinfo.get_info(opts["cluster"])[opts["number"]]
|
68
|
+
# # if number
|
69
|
+
# # opts["number"] = number
|
70
|
+
# # else
|
71
|
+
# # raise InvalidArgumentError,
|
72
|
+
# # "No entry '#{opts["number"]}' in machineinfo: #{machineinfo.inspect}."
|
73
|
+
# # end
|
74
|
+
# #end
|
75
|
+
# #opts["number"] ||= 1
|
76
|
+
|
77
|
+
|
78
|
+
# opts
|
79
|
+
#end
|
78
80
|
|
79
81
|
def calculate
|
80
82
|
# prologue
|
data/memo.txt
CHANGED
@@ -4,6 +4,9 @@ Comana don't have information of output files.
|
|
4
4
|
Because it is difficult to define final output and to deal systematically.
|
5
5
|
e.g., repeated calculation till convergence.
|
6
6
|
|
7
|
+
0.0.9 release
|
8
|
+
Change opts specification in QueueSubmitter; symbol to string
|
9
|
+
|
7
10
|
0.0.8 release
|
8
11
|
Changed queuesubmitter option. (long name symbol)
|
9
12
|
Add prologue and epilogue to QueueSubmitter.
|
data/spec/queuesubmitter_spec.rb
CHANGED
@@ -15,13 +15,12 @@ end
|
|
15
15
|
#describe QueueSubmitter, "with chars to be escaped" do
|
16
16
|
describe QueueSubmitter do
|
17
17
|
describe "#initialize" do
|
18
|
-
context "opts not have
|
18
|
+
context "opts not have target" do
|
19
19
|
opts = {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
:fileserver => "FS",
|
20
|
+
#"target" => "dir_name",
|
21
|
+
"command" => "command_line",
|
22
|
+
"cluster" => "Nodes",
|
23
|
+
"number" => 4,
|
25
24
|
}
|
26
25
|
it {lambda{QueueSubmitter.new(opts)}.should raise_error(
|
27
26
|
QueueSubmitter::InitializeError)}
|
@@ -29,23 +28,21 @@ describe QueueSubmitter do
|
|
29
28
|
|
30
29
|
context "opts not have :command" do
|
31
30
|
opts = {
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
:fileserver => "FS",
|
31
|
+
"target" => ComputationManager.new("dir_name"),
|
32
|
+
#"command" => "command_line",
|
33
|
+
"cluster" => "Nodes",
|
34
|
+
"number" => 4,
|
37
35
|
}
|
38
36
|
it {lambda{QueueSubmitter.new(opts)}.should raise_error(
|
39
37
|
QueueSubmitter::InitializeError)}
|
40
38
|
end
|
41
39
|
|
42
|
-
context "opts not have
|
40
|
+
context "opts not have cluster" do
|
43
41
|
opts = {
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
:fileserver => "FS",
|
42
|
+
"target" => ComputationManager.new("dir_name"),
|
43
|
+
"command" => "command_line",
|
44
|
+
#"cluster" => "Nodes",
|
45
|
+
"number" => 4,
|
49
46
|
}
|
50
47
|
it {lambda{QueueSubmitter.new(opts)}.should raise_error(
|
51
48
|
QueueSubmitter::InitializeError)}
|
@@ -53,61 +50,101 @@ describe QueueSubmitter do
|
|
53
50
|
|
54
51
|
context "opts not have :command" do
|
55
52
|
opts = {
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
:fileserver => "FS",
|
53
|
+
"target" => ComputationManager.new("dir_name"),
|
54
|
+
#"command" => "command_line",
|
55
|
+
"cluster" => "Nodes",
|
56
|
+
"number" => 4,
|
61
57
|
}
|
62
58
|
it {lambda{QueueSubmitter.new(opts)}.should raise_error(
|
63
59
|
QueueSubmitter::InitializeError)}
|
64
60
|
end
|
65
61
|
end
|
66
62
|
|
67
|
-
describe "#self.
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
"
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
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
|
79
75
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
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
85
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
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
|
90
95
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
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
|
95
105
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
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
|
100
122
|
|
101
|
-
|
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
|
102
140
|
|
103
141
|
describe "#dump_prologue" do
|
104
142
|
before do
|
105
143
|
opts = {
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
:fileserver => "FS",
|
144
|
+
"target" => ComputationManager.new("spec/not_started"),
|
145
|
+
"command" => "command_line",
|
146
|
+
"cluster" => "Nodes",
|
147
|
+
"number" => 4,
|
111
148
|
}
|
112
149
|
@qs00 = QueueSubmitter.new(opts)
|
113
150
|
|
@@ -137,11 +174,10 @@ describe QueueSubmitter do
|
|
137
174
|
describe "#dump_script" do
|
138
175
|
before do
|
139
176
|
opts = {
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
:fileserver => "FS",
|
177
|
+
"target" => ComputationManager.new("spec/not_started"),
|
178
|
+
"command" => "command_line",
|
179
|
+
"cluster" => "Nodes",
|
180
|
+
"number" => 4,
|
145
181
|
}
|
146
182
|
@qs00 = QueueSubmitter.new(opts)
|
147
183
|
|
@@ -164,11 +200,10 @@ describe QueueSubmitter do
|
|
164
200
|
describe "#dump_epilogue" do
|
165
201
|
before do
|
166
202
|
opts = {
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
:fileserver => "FS",
|
203
|
+
"target" => ComputationManager.new("spec/not_started"),
|
204
|
+
"command" => "command_line",
|
205
|
+
"cluster" => "Nodes",
|
206
|
+
"number" => 4,
|
172
207
|
}
|
173
208
|
@qs00 = QueueSubmitter.new(opts)
|
174
209
|
|
@@ -200,11 +235,10 @@ describe QueueSubmitter do
|
|
200
235
|
context "locked" do
|
201
236
|
it do
|
202
237
|
opts = {
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
:fileserver => "FS",
|
238
|
+
"target" => ComputationManager.new("spec/queuesubmitter/locked"),
|
239
|
+
"command" => "command_line",
|
240
|
+
"cluster" => "Nodes",
|
241
|
+
"number" => 4,
|
208
242
|
}
|
209
243
|
@qs00 = QueueSubmitter.new(opts)
|
210
244
|
|
@@ -215,11 +249,10 @@ describe QueueSubmitter do
|
|
215
249
|
context "unlocked" do
|
216
250
|
it do
|
217
251
|
opts = {
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
:fileserver => "FS",
|
252
|
+
"target" => ComputationManager.new("spec/queuesubmitter/unlocked"),
|
253
|
+
"command" => "command_line",
|
254
|
+
"cluster" => "Nodes",
|
255
|
+
"number" => 4,
|
223
256
|
}
|
224
257
|
@qs00 = QueueSubmitter.new(opts)
|
225
258
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comana
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &72264660 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.10.0
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *72264660
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rdoc
|
27
|
-
requirement: &
|
27
|
+
requirement: &72264230 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '3.12'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *72264230
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &72263870 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.1.3
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *72263870
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: jeweler
|
49
|
-
requirement: &
|
49
|
+
requirement: &72263500 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.8.3
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *72263500
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: simplecov
|
60
|
-
requirement: &
|
60
|
+
requirement: &72263070 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *72263070
|
69
69
|
description: ! "Comana, COmputation MANAger,\n is a software to provide a framework
|
70
70
|
of\n managing scientific computing.\n Researchers on computing have to check
|
71
71
|
calculation and\n generate new calculation and execute, repeatedly.\n The
|
@@ -125,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
segments:
|
127
127
|
- 0
|
128
|
-
hash:
|
128
|
+
hash: 67223151
|
129
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
130
|
none: false
|
131
131
|
requirements:
|