comana 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -4
- data/VERSION +1 -1
- data/bin/submitqueue +65 -0
- data/comana.gemspec +20 -16
- data/lib/comana/computationmanager.rb +9 -4
- data/lib/comana/machineinfo.rb +9 -10
- data/lib/comana/queuesubmitter.rb +73 -0
- data/memo.txt +4 -0
- data/spec/computationmanager_spec.rb +46 -14
- data/spec/machineinfo +6 -6
- data/spec/machineinfo_spec.rb +19 -10
- data/spec/queuesubmitter_spec.rb +55 -0
- metadata +24 -20
- /data/spec/locked/{comana_lock → lock_comana}/dummy +0 -0
- /data/spec/locked_outputted/{comana_lock → lock_comana}/dummy +0 -0
data/Gemfile
CHANGED
@@ -6,9 +6,9 @@ source "http://rubygems.org"
|
|
6
6
|
# Add dependencies to develop your gem here.
|
7
7
|
# Include everything needed to run rake, tests, features, etc.
|
8
8
|
group :development do
|
9
|
-
gem "rspec", "
|
10
|
-
gem "rdoc", "
|
11
|
-
gem "bundler", "
|
12
|
-
gem "jeweler", "
|
9
|
+
gem "rspec", ">= 2.9.0"
|
10
|
+
gem "rdoc", ">= 3.12"
|
11
|
+
gem "bundler", ">= 1.1.3"
|
12
|
+
gem "jeweler", ">= 1.8.3"
|
13
13
|
gem "simplecov", ">= 0"
|
14
14
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
data/bin/submitqueue
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
require "optparse"
|
5
|
+
require "yaml"
|
6
|
+
require "pp"
|
7
|
+
require "comana/queuesubmitter.rb"
|
8
|
+
require "comana/machineinfo.rb"
|
9
|
+
|
10
|
+
## option analysis
|
11
|
+
OPTS = {}
|
12
|
+
op = OptionParser.new
|
13
|
+
#op.on("-e", "--economy" , "Prior efficiency."){OPTS[:e] = true}
|
14
|
+
op.on("-s" , "--speed" , "Prior speed to efficiency."){OPTS[:s] = true}
|
15
|
+
op.on("-n nodes" , "--nodes" , "Node series." ){|v| OPTS[:n] = v}
|
16
|
+
op.on("-c command", "--command", "Command to calculate." ){|v| OPTS[:c] = v}
|
17
|
+
op.on("-d dir" , "--dir" , "Directory to calculate." ){|v| OPTS[:d] = v}
|
18
|
+
op.parse!(ARGV)
|
19
|
+
#cluster = ARGV[0]
|
20
|
+
#cluster = ARGV
|
21
|
+
|
22
|
+
OPTS[:machineinfo] = MachineInfo.load_file
|
23
|
+
|
24
|
+
qs = QueueSubmitter.new(OPTS)
|
25
|
+
begin
|
26
|
+
qs.start
|
27
|
+
rescue QueueSubmitter::AlreadyStartedError
|
28
|
+
puts "Already started. Exit"
|
29
|
+
exit
|
30
|
+
rescue QueueSubmitter::PrepareNextError
|
31
|
+
puts "Submitted. Exit"
|
32
|
+
exit
|
33
|
+
end
|
34
|
+
|
35
|
+
#yaml = YAML.load_file("#{ENV["HOME"]}/.machineinfo")
|
36
|
+
#pp yaml
|
37
|
+
#
|
38
|
+
#if File.exits?(SCRIPT_FILE)
|
39
|
+
# puts "#{SCRIPT_FILE} already exist. Exit."
|
40
|
+
# exit
|
41
|
+
#end
|
42
|
+
#
|
43
|
+
#File.open(SCRIPT_FILE, "w") do |io|
|
44
|
+
# io.puts "#PBS -N task"
|
45
|
+
# io.puts "#PBS -l nodes=4:ppn=1:Ga"
|
46
|
+
# io.puts "cd $PBS_O_WORKDIR"
|
47
|
+
# io.puts "runvasp"
|
48
|
+
# #io.puts "#/usr/local/bin/mpiexec /usr/local/bin/vasp5212mpi-ifc11-fast"
|
49
|
+
# #io.puts "#/home/ippei/local/mpi/mpiexec-0.84/mpiexec /usr/local/calc/bin/vasp5212-mpich2"
|
50
|
+
# #io.puts "#/usr/local/calc/mpiexec/bin/mpiexec /usr/local/calc/bin/vasp5212-mpich2"
|
51
|
+
# #io.puts "#~/tmp.rb #OK"
|
52
|
+
#
|
53
|
+
# #io.puts condition
|
54
|
+
# #io.puts rsync
|
55
|
+
# #io.puts run
|
56
|
+
# #io.puts rsync
|
57
|
+
# #io.puts mv to trash?
|
58
|
+
#end
|
59
|
+
#
|
60
|
+
## Record job_id in pbs. Overwrite if exists.
|
61
|
+
#job_id = `qsub #{SCRIPT_FILE}`
|
62
|
+
#File.open(PBS_LOG, "w") do |io|
|
63
|
+
# io.puts job_id
|
64
|
+
#end
|
65
|
+
#
|
data/comana.gemspec
CHANGED
@@ -5,13 +5,14 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "comana"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.6"
|
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-08"
|
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
|
+
s.executables = ["submitqueue"]
|
15
16
|
s.extra_rdoc_files = [
|
16
17
|
"LICENSE.txt",
|
17
18
|
"README.rdoc"
|
@@ -24,19 +25,21 @@ Gem::Specification.new do |s|
|
|
24
25
|
"README.rdoc",
|
25
26
|
"Rakefile",
|
26
27
|
"VERSION",
|
28
|
+
"bin/submitqueue",
|
27
29
|
"comana.gemspec",
|
28
30
|
"dot.machineinfo",
|
29
31
|
"lib/comana.rb",
|
30
32
|
"lib/comana/computationmanager.rb",
|
31
33
|
"lib/comana/machineinfo.rb",
|
34
|
+
"lib/comana/queuesubmitter.rb",
|
32
35
|
"memo.txt",
|
33
36
|
"spec/computationmanager_spec.rb",
|
34
|
-
"spec/locked/comana_lock/dummy",
|
35
37
|
"spec/locked/input_a",
|
36
38
|
"spec/locked/input_b",
|
37
|
-
"spec/
|
39
|
+
"spec/locked/lock_comana/dummy",
|
38
40
|
"spec/locked_outputted/input_a",
|
39
41
|
"spec/locked_outputted/input_b",
|
42
|
+
"spec/locked_outputted/lock_comana/dummy",
|
40
43
|
"spec/locked_outputted/output",
|
41
44
|
"spec/machineinfo",
|
42
45
|
"spec/machineinfo_spec.rb",
|
@@ -45,6 +48,7 @@ Gem::Specification.new do |s|
|
|
45
48
|
"spec/outputted/input_a",
|
46
49
|
"spec/outputted/input_b",
|
47
50
|
"spec/outputted/output",
|
51
|
+
"spec/queuesubmitter_spec.rb",
|
48
52
|
"spec/spec_helper.rb"
|
49
53
|
]
|
50
54
|
s.homepage = "http://github.com/ippei94da/comana"
|
@@ -57,23 +61,23 @@ Gem::Specification.new do |s|
|
|
57
61
|
s.specification_version = 3
|
58
62
|
|
59
63
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
60
|
-
s.add_development_dependency(%q<rspec>, ["
|
61
|
-
s.add_development_dependency(%q<rdoc>, ["
|
62
|
-
s.add_development_dependency(%q<bundler>, ["
|
63
|
-
s.add_development_dependency(%q<jeweler>, ["
|
64
|
+
s.add_development_dependency(%q<rspec>, [">= 2.9.0"])
|
65
|
+
s.add_development_dependency(%q<rdoc>, [">= 3.12"])
|
66
|
+
s.add_development_dependency(%q<bundler>, [">= 1.1.3"])
|
67
|
+
s.add_development_dependency(%q<jeweler>, [">= 1.8.3"])
|
64
68
|
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
65
69
|
else
|
66
|
-
s.add_dependency(%q<rspec>, ["
|
67
|
-
s.add_dependency(%q<rdoc>, ["
|
68
|
-
s.add_dependency(%q<bundler>, ["
|
69
|
-
s.add_dependency(%q<jeweler>, ["
|
70
|
+
s.add_dependency(%q<rspec>, [">= 2.9.0"])
|
71
|
+
s.add_dependency(%q<rdoc>, [">= 3.12"])
|
72
|
+
s.add_dependency(%q<bundler>, [">= 1.1.3"])
|
73
|
+
s.add_dependency(%q<jeweler>, [">= 1.8.3"])
|
70
74
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
71
75
|
end
|
72
76
|
else
|
73
|
-
s.add_dependency(%q<rspec>, ["
|
74
|
-
s.add_dependency(%q<rdoc>, ["
|
75
|
-
s.add_dependency(%q<bundler>, ["
|
76
|
-
s.add_dependency(%q<jeweler>, ["
|
77
|
+
s.add_dependency(%q<rspec>, [">= 2.9.0"])
|
78
|
+
s.add_dependency(%q<rdoc>, [">= 3.12"])
|
79
|
+
s.add_dependency(%q<bundler>, [">= 1.1.3"])
|
80
|
+
s.add_dependency(%q<jeweler>, [">= 1.8.3"])
|
77
81
|
s.add_dependency(%q<simplecov>, [">= 0"])
|
78
82
|
end
|
79
83
|
end
|
@@ -7,16 +7,17 @@
|
|
7
7
|
# This profides a framework of scientific computation.
|
8
8
|
# Users have to redefine some methods in subclasses for various computation.
|
9
9
|
#
|
10
|
-
class
|
10
|
+
class ComputationManager
|
11
11
|
class NotImplementedError < Exception; end
|
12
12
|
class AlreadyStartedError < Exception; end
|
13
|
+
class ExecuteError < Exception; end
|
13
14
|
|
14
15
|
attr_reader :dir
|
15
16
|
|
16
17
|
# You can redefine in subclass to modify from default values.
|
17
18
|
def initialize(dir)
|
18
19
|
@dir = dir # redefine in subclass.
|
19
|
-
@lockdir = "
|
20
|
+
@lockdir = "lock_comana"
|
20
21
|
@alive_time = 3600
|
21
22
|
end
|
22
23
|
|
@@ -33,7 +34,7 @@ class Comana
|
|
33
34
|
end
|
34
35
|
|
35
36
|
# Execute calculation.
|
36
|
-
# If log of
|
37
|
+
# If log of ComputationManager exist, raise ComputationManager::AlreadyStartedError,
|
37
38
|
# because the calculation has been done by other process already.
|
38
39
|
def start
|
39
40
|
begin
|
@@ -43,7 +44,8 @@ class Comana
|
|
43
44
|
end
|
44
45
|
|
45
46
|
while true
|
46
|
-
calculate
|
47
|
+
end_status = calculate
|
48
|
+
raise ExecuteError unless end_status
|
47
49
|
if finished?
|
48
50
|
break
|
49
51
|
else
|
@@ -55,6 +57,9 @@ class Comana
|
|
55
57
|
|
56
58
|
private
|
57
59
|
|
60
|
+
# Redefine in subclass.
|
61
|
+
# Return nil if cannot execute, return false if error in executing,
|
62
|
+
# like Kernel.system.
|
58
63
|
def calculate
|
59
64
|
raise NotImplementedError, "#{self.class}::calculate need to be redefined"
|
60
65
|
end
|
data/lib/comana/machineinfo.rb
CHANGED
@@ -3,8 +3,10 @@
|
|
3
3
|
|
4
4
|
require "yaml"
|
5
5
|
|
6
|
-
#
|
7
|
-
#
|
6
|
+
# Series name is composed only of alphabets.
|
7
|
+
# Host name is started by the series name and followed by integers.
|
8
|
+
# E.g.,
|
9
|
+
# "Fe", "Fe00", "Fe01" are of series "Fe" and not "F"
|
8
10
|
#
|
9
11
|
class MachineInfo
|
10
12
|
|
@@ -15,18 +17,15 @@ class MachineInfo
|
|
15
17
|
@data = data
|
16
18
|
end
|
17
19
|
|
18
|
-
def self.load_file(data_file)
|
19
|
-
#pp data_file
|
20
|
-
#pp ENV["PWD"]
|
21
|
-
#pp File.open(DATA_FILE, "r").readlines
|
20
|
+
def self.load_file(data_file = (ENV["HOME"] + "/.machineinfo"))
|
22
21
|
data = YAML.load_file(data_file)
|
23
22
|
MachineInfo.new data
|
24
|
-
#pp @data
|
25
23
|
end
|
26
24
|
|
27
|
-
def
|
28
|
-
|
29
|
-
@data
|
25
|
+
def get_info(host)
|
26
|
+
series = host.sub(/\d*$/, "")
|
27
|
+
raise NoEntryError unless @data.has_key?(series)
|
28
|
+
@data[series]
|
30
29
|
end
|
31
30
|
|
32
31
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
require "comana/computationmanager.rb"
|
5
|
+
require "comana/machineinfo.rb"
|
6
|
+
|
7
|
+
#
|
8
|
+
#
|
9
|
+
#
|
10
|
+
class QueueSubmitter < ComputationManager
|
11
|
+
QSUB_SCRIPT = "script.qsub"
|
12
|
+
|
13
|
+
class PrepareNextError < Exception; end
|
14
|
+
|
15
|
+
#
|
16
|
+
def initialize(opts)
|
17
|
+
super(opts[:d])
|
18
|
+
@command = opts[:c]
|
19
|
+
@nodes = opts[:n]
|
20
|
+
@speed = opts[:s]
|
21
|
+
@machineinfo = opts[:machineinfo]
|
22
|
+
@lockdir = "lock_queuesubmitter"
|
23
|
+
end
|
24
|
+
|
25
|
+
def calculate
|
26
|
+
script_path = "#{@dir}/#{QSUB_SCRIPT}"
|
27
|
+
File.open(script_path, "w") do |io|
|
28
|
+
dump_qsub_str(io)
|
29
|
+
end
|
30
|
+
|
31
|
+
system("cd #{@dir}; qsub #{script_path} > #{@dir}/#{@lockdir}/stdout")
|
32
|
+
end
|
33
|
+
|
34
|
+
# Raise QueueSubmitter::PrepareNextError when called.
|
35
|
+
def prepare_next
|
36
|
+
raise PrepareNextError
|
37
|
+
end
|
38
|
+
|
39
|
+
def finished?
|
40
|
+
# do nothing
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def dump_qsub_str(io = nil)
|
46
|
+
fs = @machineinfo.get_info("fileserver") #fileserver
|
47
|
+
node_info = @machineinfo.get_info(@nodes)
|
48
|
+
num = node_info["economy_nodes"]
|
49
|
+
num = node_info["speed_nodes"] if @speed
|
50
|
+
|
51
|
+
str = [
|
52
|
+
"#! /bin/sh",
|
53
|
+
"#PBS -N #{@dir}",
|
54
|
+
"#PBS -l nodes=#{num}:ppn=1:#{@nodes},walltime=168:00:00",
|
55
|
+
"#PBS -j oe",
|
56
|
+
"mkdir -p ${PBS_O_WORKDIR}",
|
57
|
+
"cp ${PBS_NODEFILE} ${PBS_O_WORKDIR}/pbs_nodefile",
|
58
|
+
"rsync -azq --delete #{fs}:${PBS_O_WORKDIR}/ ${PBS_O_WORKDIR}",
|
59
|
+
"cd ${PBS_O_WORKDIR}",
|
60
|
+
"#{@command}",
|
61
|
+
"#rsync -azq --delete ${PBS_O_WORKDIR}/ #{fs}:${PBS_O_WORKDIR}",
|
62
|
+
"#rm -rf ${PBS_O_WORKDIR}",
|
63
|
+
].join("\n")
|
64
|
+
|
65
|
+
if io
|
66
|
+
io.puts str
|
67
|
+
else
|
68
|
+
return str
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
|
data/memo.txt
CHANGED
@@ -2,6 +2,10 @@ Comana don't have information of output files.
|
|
2
2
|
Because it is difficult to define final output and to deal systematically.
|
3
3
|
e.g., repeated calculation till convergence.
|
4
4
|
|
5
|
+
0.0.6 release
|
6
|
+
Add bin/submitqueue.
|
7
|
+
Add lib/queuesubmitter.rb.
|
8
|
+
|
5
9
|
0.0.5 release
|
6
10
|
Changed directory structure and file name.
|
7
11
|
Changed method name.
|
@@ -3,12 +3,12 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
3
3
|
|
4
4
|
NOW = Time.now
|
5
5
|
|
6
|
-
class
|
6
|
+
class ComputationManager
|
7
7
|
public :latest_modified_time, :started?
|
8
8
|
end
|
9
9
|
|
10
|
-
describe
|
11
|
-
class CalcYet <
|
10
|
+
describe ComputationManager, "not started" do
|
11
|
+
class CalcYet < ComputationManager
|
12
12
|
def finished? ; false ; end
|
13
13
|
end
|
14
14
|
before do
|
@@ -17,7 +17,7 @@ describe Comana, "not started" do
|
|
17
17
|
|
18
18
|
File.utime(NOW - 1000 ,NOW - 1000, "#{calc_dir}/input_a")
|
19
19
|
File.utime(NOW - 2000 ,NOW - 2000, "#{calc_dir}/input_b")
|
20
|
-
@lockdir = "#{calc_dir}/
|
20
|
+
@lockdir = "#{calc_dir}/lock_comana"
|
21
21
|
FileUtils.rm(@lockdir) if File.exist?(@lockdir)
|
22
22
|
end
|
23
23
|
|
@@ -43,8 +43,8 @@ describe Comana, "not started" do
|
|
43
43
|
#end
|
44
44
|
end
|
45
45
|
|
46
|
-
describe
|
47
|
-
class CalcStarted <
|
46
|
+
describe ComputationManager, "with lock" do
|
47
|
+
class CalcStarted < ComputationManager
|
48
48
|
def finished? ; false ; end
|
49
49
|
end
|
50
50
|
|
@@ -60,8 +60,8 @@ describe Comana, "with lock" do
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
describe
|
64
|
-
class CalcStarted <
|
63
|
+
describe ComputationManager, "with output, without lock" do
|
64
|
+
class CalcStarted < ComputationManager
|
65
65
|
def finished? ; false ; end
|
66
66
|
end
|
67
67
|
|
@@ -81,12 +81,12 @@ describe Comana, "with output, without lock" do
|
|
81
81
|
|
82
82
|
end
|
83
83
|
|
84
|
-
describe
|
85
|
-
class CalcTerminated <
|
84
|
+
describe ComputationManager, "terminated" do
|
85
|
+
class CalcTerminated < ComputationManager
|
86
86
|
def finished? ; false ; end
|
87
87
|
def initialize(dir)
|
88
88
|
@dir = dir
|
89
|
-
@lockdir = "
|
89
|
+
@lockdir = "lock_comana"
|
90
90
|
@alive_time = 500
|
91
91
|
end
|
92
92
|
end
|
@@ -98,7 +98,7 @@ describe Comana, "terminated" do
|
|
98
98
|
File.utime(NOW - 1000 ,NOW - 1000, "#{calc_dir}/input_a")
|
99
99
|
File.utime(NOW - 2000 ,NOW - 2000, "#{calc_dir}/input_b")
|
100
100
|
File.utime(NOW - 9000 ,NOW - 9000, "#{calc_dir}/output")
|
101
|
-
File.utime(NOW - 9000 ,NOW - 9000, "#{calc_dir}/
|
101
|
+
File.utime(NOW - 9000 ,NOW - 9000, "#{calc_dir}/lock_comana")
|
102
102
|
end
|
103
103
|
|
104
104
|
it "should return the state" do
|
@@ -106,8 +106,8 @@ describe Comana, "terminated" do
|
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
|
-
describe
|
110
|
-
class CalcFinished <
|
109
|
+
describe ComputationManager, "finished" do
|
110
|
+
class CalcFinished < ComputationManager
|
111
111
|
def finished? ; true ; end
|
112
112
|
end
|
113
113
|
|
@@ -123,3 +123,35 @@ describe Comana, "finished" do
|
|
123
123
|
@calc_finished .state.should == :finished
|
124
124
|
end
|
125
125
|
end
|
126
|
+
|
127
|
+
describe ComputationManager, "cannot execute" do
|
128
|
+
class CalcNotExecutable < ComputationManager
|
129
|
+
def calculate
|
130
|
+
system "" # notExistCommand
|
131
|
+
end
|
132
|
+
|
133
|
+
def finished?
|
134
|
+
return false
|
135
|
+
end
|
136
|
+
|
137
|
+
def prepare_next
|
138
|
+
#return false
|
139
|
+
raise
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
before do
|
144
|
+
calc_dir = "spec/not_executable"
|
145
|
+
@calc = CalcNotExecutable .new(calc_dir)
|
146
|
+
#File.utime(NOW - 1000 ,NOW - 1000, "#{calc_dir}/input_a")
|
147
|
+
#File.utime(NOW - 2000 ,NOW - 2000, "#{calc_dir}/input_b")
|
148
|
+
@lockdir = calc_dir + "/lock_comana"
|
149
|
+
|
150
|
+
Dir.rmdir(@lockdir) if File.exist?(@lockdir)
|
151
|
+
end
|
152
|
+
|
153
|
+
it "should raise error" do
|
154
|
+
lambda{@calc.start}.should raise_error(ComputationManager::ExecuteError)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
data/spec/machineinfo
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- # vim:syntax=yaml
|
2
|
-
"
|
3
|
-
"data1": "
|
4
|
-
"data2": "
|
5
|
-
"
|
6
|
-
"data1": "
|
7
|
-
"data2": "
|
2
|
+
"SeriesA":
|
3
|
+
"data1": "A-1"
|
4
|
+
"data2": "A-2"
|
5
|
+
"SeriesB":
|
6
|
+
"data1": "B-1"
|
7
|
+
"data2": "B-2"
|
data/spec/machineinfo_spec.rb
CHANGED
@@ -12,8 +12,8 @@ describe MachineInfo do
|
|
12
12
|
DATA_FILE = "spec/machineinfo"
|
13
13
|
#DATA_FILE = "spec/dummy.yaml"
|
14
14
|
#data = {
|
15
|
-
# "
|
16
|
-
# "
|
15
|
+
# "SeriesA" => { "data1" => "A-1", "data2" => "A-2" },
|
16
|
+
# "SeriesB" => { "data1" => "B-1", "data2" => "B-2" },
|
17
17
|
#}
|
18
18
|
#io = File.open(DATA_FILE, "w")
|
19
19
|
#YAML.dump(data, io)
|
@@ -24,7 +24,7 @@ describe MachineInfo do
|
|
24
24
|
it { lambda{MachineInfo.load_file(DATA_FILE)}.should_not raise_error}
|
25
25
|
|
26
26
|
mi00 = MachineInfo.load_file(DATA_FILE)
|
27
|
-
it {mi00.
|
27
|
+
it {mi00.get_info("SeriesA").should == { "data1" => "A-1", "data2" => "A-2" } }
|
28
28
|
|
29
29
|
#FileUtils.rm DATA_FILE
|
30
30
|
end
|
@@ -34,21 +34,30 @@ describe MachineInfo do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
describe "#
|
37
|
+
describe "#get_info" do
|
38
38
|
before do
|
39
39
|
@mi00 = MachineInfo.new({
|
40
|
-
"
|
41
|
-
"
|
40
|
+
"SeriesA" => { "data1" => "A-1", "data2" => "A-2" },
|
41
|
+
"SeriesB" => { "data1" => "B-1", "data2" => "B-2" },
|
42
42
|
})
|
43
43
|
end
|
44
44
|
|
45
|
-
context "
|
46
|
-
subject { @mi00.
|
47
|
-
it {should == { "data1" => "
|
45
|
+
context "mach to hostname in data" do
|
46
|
+
subject { @mi00.get_info("SeriesA") }
|
47
|
+
it {should == { "data1" => "A-1", "data2" => "A-2" } }
|
48
|
+
end
|
49
|
+
|
50
|
+
context "series name + integers" do
|
51
|
+
subject { @mi00.get_info("SeriesA00") }
|
52
|
+
it {should == { "data1" => "A-1", "data2" => "A-2" } }
|
53
|
+
end
|
54
|
+
|
55
|
+
context "series name + alphabet" do
|
56
|
+
it {lambda{@mi00.get_info("seriesAB")}.should raise_error(MachineInfo::NoEntryError)}
|
48
57
|
end
|
49
58
|
|
50
59
|
context "no entry" do
|
51
|
-
it {lambda{@mi00.
|
60
|
+
it {lambda{@mi00.get_info("")}.should raise_error(MachineInfo::NoEntryError)}
|
52
61
|
end
|
53
62
|
end
|
54
63
|
|
@@ -0,0 +1,55 @@
|
|
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/machineinfo.rb"
|
7
|
+
|
8
|
+
class QueueSubmitter < ComputationManager
|
9
|
+
public :dump_qsub_str
|
10
|
+
end
|
11
|
+
|
12
|
+
#describe QueueSubmitter, "with chars to be escaped" do
|
13
|
+
describe QueueSubmitter do
|
14
|
+
describe "#dump_qsub_str" do
|
15
|
+
before do
|
16
|
+
opts = {
|
17
|
+
:d => "dir_name",
|
18
|
+
:c => "command_line",
|
19
|
+
:n => "Nodes",
|
20
|
+
:s => true,
|
21
|
+
:machineinfo => MachineInfo.new(
|
22
|
+
"fileserver" => "FS",
|
23
|
+
"Nodes" => { "speed_nodes" => 4, "economy_nodes" => 1, }
|
24
|
+
)
|
25
|
+
}
|
26
|
+
@qs00 = QueueSubmitter.new(opts)
|
27
|
+
|
28
|
+
@correct = [
|
29
|
+
"#! /bin/sh",
|
30
|
+
"#PBS -N dir_name",
|
31
|
+
"#PBS -l nodes=4:ppn=1:Nodes,walltime=168:00:00",
|
32
|
+
"#PBS -j oe",
|
33
|
+
"mkdir -p ${PBS_O_WORKDIR}",
|
34
|
+
"cp ${PBS_NODEFILE} ${PBS_O_WORKDIR}/pbs_nodefile",
|
35
|
+
"rsync -azq --delete FS:${PBS_O_WORKDIR}/ ${PBS_O_WORKDIR}",
|
36
|
+
"cd ${PBS_O_WORKDIR}",
|
37
|
+
"command_line",
|
38
|
+
"#rsync -azq --delete ${PBS_O_WORKDIR}/ FS:${PBS_O_WORKDIR}",
|
39
|
+
"#rm -rf ${PBS_O_WORKDIR}",
|
40
|
+
].join("\n")
|
41
|
+
end
|
42
|
+
|
43
|
+
context "speed mode" do
|
44
|
+
it { @qs00.dump_qsub_str.should == @correct}
|
45
|
+
|
46
|
+
it do
|
47
|
+
io = StringIO.new
|
48
|
+
@qs00.dump_qsub_str(io)
|
49
|
+
io.rewind
|
50
|
+
#pp io.readlines
|
51
|
+
io.readlines.join.chomp.should == @correct
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
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.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,55 +9,55 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &81878250 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 2.9.0
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *81878250
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rdoc
|
27
|
-
requirement: &
|
27
|
+
requirement: &81877750 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
|
-
- -
|
30
|
+
- - ! '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '3.12'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *81877750
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &81877070 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
|
-
- -
|
41
|
+
- - ! '>='
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 1.1.3
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *81877070
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: jeweler
|
49
|
-
requirement: &
|
49
|
+
requirement: &81876620 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.8.3
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *81876620
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: simplecov
|
60
|
-
requirement: &
|
60
|
+
requirement: &81875300 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,13 +65,14 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *81875300
|
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
|
72
72
|
abstract class that this gem provide would help the work.\n "
|
73
73
|
email: ippei94da@gmail.com
|
74
|
-
executables:
|
74
|
+
executables:
|
75
|
+
- submitqueue
|
75
76
|
extensions: []
|
76
77
|
extra_rdoc_files:
|
77
78
|
- LICENSE.txt
|
@@ -84,19 +85,21 @@ files:
|
|
84
85
|
- README.rdoc
|
85
86
|
- Rakefile
|
86
87
|
- VERSION
|
88
|
+
- bin/submitqueue
|
87
89
|
- comana.gemspec
|
88
90
|
- dot.machineinfo
|
89
91
|
- lib/comana.rb
|
90
92
|
- lib/comana/computationmanager.rb
|
91
93
|
- lib/comana/machineinfo.rb
|
94
|
+
- lib/comana/queuesubmitter.rb
|
92
95
|
- memo.txt
|
93
96
|
- spec/computationmanager_spec.rb
|
94
|
-
- spec/locked/comana_lock/dummy
|
95
97
|
- spec/locked/input_a
|
96
98
|
- spec/locked/input_b
|
97
|
-
- spec/
|
99
|
+
- spec/locked/lock_comana/dummy
|
98
100
|
- spec/locked_outputted/input_a
|
99
101
|
- spec/locked_outputted/input_b
|
102
|
+
- spec/locked_outputted/lock_comana/dummy
|
100
103
|
- spec/locked_outputted/output
|
101
104
|
- spec/machineinfo
|
102
105
|
- spec/machineinfo_spec.rb
|
@@ -105,6 +108,7 @@ files:
|
|
105
108
|
- spec/outputted/input_a
|
106
109
|
- spec/outputted/input_b
|
107
110
|
- spec/outputted/output
|
111
|
+
- spec/queuesubmitter_spec.rb
|
108
112
|
- spec/spec_helper.rb
|
109
113
|
homepage: http://github.com/ippei94da/comana
|
110
114
|
licenses:
|
@@ -121,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
121
125
|
version: '0'
|
122
126
|
segments:
|
123
127
|
- 0
|
124
|
-
hash:
|
128
|
+
hash: 362387791
|
125
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
130
|
none: false
|
127
131
|
requirements:
|
File without changes
|
File without changes
|