comana 0.0.3 → 0.0.4
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 +1 -3
- data/lib/comana.rb +10 -7
- data/spec/comana_spec.rb +11 -12
- metadata +12 -14
- data/spec/locked/lock +0 -0
- data/spec/locked_outputted/lock +0 -0
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/comana.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "comana"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["ippei94da"]
|
@@ -29,10 +29,8 @@ Gem::Specification.new do |s|
|
|
29
29
|
"spec/comana_spec.rb",
|
30
30
|
"spec/locked/input_a",
|
31
31
|
"spec/locked/input_b",
|
32
|
-
"spec/locked/lock",
|
33
32
|
"spec/locked_outputted/input_a",
|
34
33
|
"spec/locked_outputted/input_b",
|
35
|
-
"spec/locked_outputted/lock",
|
36
34
|
"spec/locked_outputted/output",
|
37
35
|
"spec/not_calculated/input_a",
|
38
36
|
"spec/not_calculated/input_b",
|
data/lib/comana.rb
CHANGED
@@ -35,8 +35,11 @@ class Comana
|
|
35
35
|
# If log of Comana exist, raise Comana::AlreadyStartedError,
|
36
36
|
# because the calculation has been done by other process already.
|
37
37
|
def calculate
|
38
|
-
|
39
|
-
|
38
|
+
begin
|
39
|
+
Dir.mkdir @lockdir
|
40
|
+
rescue Errno::EEXIST
|
41
|
+
raise AlreadyStartedError
|
42
|
+
end
|
40
43
|
send_command
|
41
44
|
end
|
42
45
|
|
@@ -50,7 +53,7 @@ class Comana
|
|
50
53
|
raise NotImplementedError, "#{self.class}::set_parameters need to be redefined"
|
51
54
|
|
52
55
|
# e.g.,
|
53
|
-
#@
|
56
|
+
#@lockdir = "comana_lock"
|
54
57
|
#@alive_time = 3600
|
55
58
|
#@outfiles = ["output_a", "ouput_b"] # Files only to output should be indicated.
|
56
59
|
end
|
@@ -66,10 +69,10 @@ class Comana
|
|
66
69
|
end
|
67
70
|
|
68
71
|
def started?
|
69
|
-
return true if File.exist?( "#{@dir}/#{@
|
70
|
-
|
71
|
-
|
72
|
-
end
|
72
|
+
return true if File.exist?( "#{@dir}/#{@lockdir}" )
|
73
|
+
#@outfiles.each do |file|
|
74
|
+
# return true if File.exist?( "#{@dir}/#{file}" )
|
75
|
+
#end
|
73
76
|
return false
|
74
77
|
end
|
75
78
|
|
data/spec/comana_spec.rb
CHANGED
@@ -2,9 +2,6 @@ require "fileutils"
|
|
2
2
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
3
3
|
|
4
4
|
NOW = Time.now
|
5
|
-
#CALC_DIR = "spec/dummy"
|
6
|
-
#LOCKFILE = "#{CALC_DIR}/lock"
|
7
|
-
#OUTFILES = ["#{CALC_DIR}/output_a", "#{CALC_DIR}/output_b"]
|
8
5
|
|
9
6
|
class Comana
|
10
7
|
public :latest_modified_time, :started?
|
@@ -14,7 +11,7 @@ describe Comana, "not calculated" do
|
|
14
11
|
class CalcYet < Comana
|
15
12
|
def finished? ; false ; end
|
16
13
|
def set_parameters
|
17
|
-
@
|
14
|
+
@lockdir = "lock"
|
18
15
|
@alive_time = 3600
|
19
16
|
@outfiles = ["output"]
|
20
17
|
end
|
@@ -25,8 +22,8 @@ describe Comana, "not calculated" do
|
|
25
22
|
|
26
23
|
File.utime(NOW - 1000 ,NOW - 1000, "#{calc_dir}/input_a")
|
27
24
|
File.utime(NOW - 2000 ,NOW - 2000, "#{calc_dir}/input_b")
|
28
|
-
@
|
29
|
-
FileUtils.rm(@
|
25
|
+
@lockdir = "#{calc_dir}/lockdir"
|
26
|
+
FileUtils.rm(@lockdir) if File.exist?(@lockdir)
|
30
27
|
end
|
31
28
|
|
32
29
|
it "should return the state" do
|
@@ -47,7 +44,7 @@ describe Comana, "not calculated" do
|
|
47
44
|
end
|
48
45
|
|
49
46
|
#after do
|
50
|
-
# FileUtils.rm(@
|
47
|
+
# FileUtils.rm(@lockdir) if File.exist?(@lockdir)
|
51
48
|
#end
|
52
49
|
end
|
53
50
|
|
@@ -55,7 +52,7 @@ describe Comana, "with lock" do
|
|
55
52
|
class CalcStarted < Comana
|
56
53
|
def finished? ; false ; end
|
57
54
|
def set_parameters
|
58
|
-
@
|
55
|
+
@lockdir = "lock"
|
59
56
|
@alive_time = 5000
|
60
57
|
@outfiles = ["output"]
|
61
58
|
end
|
@@ -77,7 +74,7 @@ describe Comana, "with output, without lock" do
|
|
77
74
|
class CalcStarted < Comana
|
78
75
|
def finished? ; false ; end
|
79
76
|
def set_parameters
|
80
|
-
@
|
77
|
+
@lockdir = "lock"
|
81
78
|
@alive_time = 5000
|
82
79
|
@outfiles = ["output"]
|
83
80
|
end
|
@@ -89,11 +86,12 @@ describe Comana, "with output, without lock" do
|
|
89
86
|
File.utime(NOW - 1000 ,NOW - 1000, "#{calc_dir}/input_a")
|
90
87
|
File.utime(NOW - 2000 ,NOW - 2000, "#{calc_dir}/input_b")
|
91
88
|
File.utime(NOW - 2000 ,NOW - 2000, "#{calc_dir}/output")
|
89
|
+
#File.utime(NOW - 9000 ,NOW - 9000, "#{calc_dir}/lock")
|
92
90
|
#File.open(OUTFILES[0], "w")
|
93
91
|
end
|
94
92
|
|
95
93
|
it "should return :started" do
|
96
|
-
@calc.state.should == :
|
94
|
+
@calc.state.should == :yet
|
97
95
|
end
|
98
96
|
|
99
97
|
end
|
@@ -102,7 +100,7 @@ describe Comana, "terminated" do
|
|
102
100
|
class CalcTerminated < Comana
|
103
101
|
def finished? ; false ; end
|
104
102
|
def set_parameters
|
105
|
-
@
|
103
|
+
@lockdir = "lock"
|
106
104
|
@alive_time = 500
|
107
105
|
@outfiles = ["output"]
|
108
106
|
end
|
@@ -115,6 +113,7 @@ describe Comana, "terminated" do
|
|
115
113
|
File.utime(NOW - 1000 ,NOW - 1000, "#{calc_dir}/input_a")
|
116
114
|
File.utime(NOW - 2000 ,NOW - 2000, "#{calc_dir}/input_b")
|
117
115
|
File.utime(NOW - 9000 ,NOW - 9000, "#{calc_dir}/output")
|
116
|
+
File.utime(NOW - 9000 ,NOW - 9000, "#{calc_dir}/lock")
|
118
117
|
end
|
119
118
|
|
120
119
|
it "should return the state" do
|
@@ -126,7 +125,7 @@ describe Comana, "finished" do
|
|
126
125
|
class CalcFinished < Comana
|
127
126
|
def finished? ; true ; end
|
128
127
|
def set_parameters
|
129
|
-
@
|
128
|
+
@lockdir = "lock"
|
130
129
|
@alive_time = 500
|
131
130
|
@outfiles = ["output"]
|
132
131
|
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.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-04-23 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &84974590 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.9.0
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *84974590
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rdoc
|
27
|
-
requirement: &
|
27
|
+
requirement: &84974230 !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: *84974230
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &84973850 !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: *84973850
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: jeweler
|
49
|
-
requirement: &
|
49
|
+
requirement: &84973550 !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: *84973550
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: simplecov
|
60
|
-
requirement: &
|
60
|
+
requirement: &84973190 !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: *84973190
|
69
69
|
description: ! "An aim of this gem is to provide a framework of\n managing scientific
|
70
70
|
computing.\n Researchers on computing have to check calculation and\n generate
|
71
71
|
new calculation and execute, repeatedly.\n The abstract class that this gem provide
|
@@ -89,10 +89,8 @@ files:
|
|
89
89
|
- spec/comana_spec.rb
|
90
90
|
- spec/locked/input_a
|
91
91
|
- spec/locked/input_b
|
92
|
-
- spec/locked/lock
|
93
92
|
- spec/locked_outputted/input_a
|
94
93
|
- spec/locked_outputted/input_b
|
95
|
-
- spec/locked_outputted/lock
|
96
94
|
- spec/locked_outputted/output
|
97
95
|
- spec/not_calculated/input_a
|
98
96
|
- spec/not_calculated/input_b
|
@@ -115,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
113
|
version: '0'
|
116
114
|
segments:
|
117
115
|
- 0
|
118
|
-
hash:
|
116
|
+
hash: -295869967
|
119
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
118
|
none: false
|
121
119
|
requirements:
|
data/spec/locked/lock
DELETED
File without changes
|
data/spec/locked_outputted/lock
DELETED
File without changes
|