pione 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/History.txt +11 -0
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/bin/pione-log +5 -0
- data/example/CountChar/CountChar.pione +1 -1
- data/example/SieveOfEratosthenes/SieveOfEratosthenes.pione +39 -38
- data/lib/pione.rb +14 -35
- data/lib/pione/agent/input-generator.rb +38 -40
- data/lib/pione/agent/logger.rb +52 -19
- data/lib/pione/agent/rule-provider.rb +5 -8
- data/lib/pione/agent/task-worker.rb +25 -32
- data/lib/pione/agent/tuple-space-client.rb +22 -14
- data/lib/pione/command.rb +21 -0
- data/lib/pione/command/basic-command.rb +267 -84
- data/lib/pione/command/child-process.rb +21 -18
- data/lib/pione/command/daemon-process.rb +9 -8
- data/lib/pione/command/front-owner-command.rb +8 -25
- data/lib/pione/command/pione-broker.rb +27 -24
- data/lib/pione/command/pione-clean.rb +6 -6
- data/lib/pione/command/pione-client.rb +143 -128
- data/lib/pione/command/pione-log.rb +61 -0
- data/lib/pione/command/pione-relay-account-db.rb +40 -38
- data/lib/pione/command/pione-relay-client-db.rb +38 -42
- data/lib/pione/command/pione-relay.rb +19 -20
- data/lib/pione/command/pione-syntax-checker.rb +70 -45
- data/lib/pione/command/pione-task-worker.rb +56 -66
- data/lib/pione/command/pione-tuple-space-provider.rb +36 -45
- data/lib/pione/command/pione-tuple-space-receiver.rb +34 -32
- data/lib/pione/command/pione-tuple-space-viewer.rb +63 -47
- data/lib/pione/location.rb +10 -0
- data/lib/pione/location/basic-location.rb +272 -0
- data/lib/pione/location/dropbox-location.rb +139 -0
- data/lib/pione/location/ftp-location.rb +156 -0
- data/lib/pione/location/local-location.rb +116 -0
- data/lib/pione/log.rb +10 -0
- data/lib/pione/log/domain-info.rb +72 -0
- data/lib/pione/log/process-log.rb +176 -0
- data/lib/pione/log/process-record.rb +189 -0
- data/lib/pione/log/xes-log.rb +105 -0
- data/lib/pione/model/assignment.rb +88 -80
- data/lib/pione/model/binary-operator.rb +74 -68
- data/lib/pione/model/block.rb +218 -207
- data/lib/pione/model/boolean.rb +123 -112
- data/lib/pione/model/call-rule.rb +72 -65
- data/lib/pione/model/data-expr.rb +596 -290
- data/lib/pione/model/float.rb +108 -103
- data/lib/pione/model/integer.rb +133 -129
- data/lib/pione/model/message.rb +79 -72
- data/lib/pione/model/package.rb +42 -38
- data/lib/pione/model/parameters.rb +265 -236
- data/lib/pione/model/rule-expr.rb +247 -242
- data/lib/pione/model/rule-io.rb +137 -133
- data/lib/pione/model/rule.rb +307 -292
- data/lib/pione/model/string.rb +110 -99
- data/lib/pione/model/variable-table.rb +300 -271
- data/lib/pione/model/variable.rb +88 -83
- data/lib/pione/option.rb +13 -0
- data/lib/pione/option/child-process-option.rb +19 -0
- data/lib/pione/{command-option → option}/common-option.rb +6 -5
- data/lib/pione/option/option-interface.rb +73 -0
- data/lib/pione/{command-option → option}/presence-notifier-option.rb +4 -3
- data/lib/pione/option/task-worker-owner-option.rb +24 -0
- data/lib/pione/{command-option → option}/tuple-space-provider-option.rb +6 -4
- data/lib/pione/option/tuple-space-provider-owner-option.rb +18 -0
- data/lib/pione/option/tuple-space-receiver-option.rb +8 -0
- data/lib/pione/parser/common-parser.rb +3 -2
- data/lib/pione/parser/expr-parser.rb +6 -1
- data/lib/pione/patch/em-ftpd-patch.rb +21 -0
- data/lib/pione/patch/rinda-patch.rb +31 -23
- data/lib/pione/rule-handler/action-handler.rb +35 -25
- data/lib/pione/rule-handler/basic-handler.rb +92 -18
- data/lib/pione/rule-handler/flow-handler.rb +104 -98
- data/lib/pione/rule-handler/root-handler.rb +11 -0
- data/lib/pione/system/common.rb +10 -0
- data/lib/pione/system/file-cache.rb +103 -84
- data/lib/pione/system/global.rb +67 -12
- data/lib/pione/system/init.rb +20 -0
- data/lib/pione/transformer/expr-transformer.rb +6 -1
- data/lib/pione/tuple-space/data-finder.rb +33 -6
- data/lib/pione/tuple-space/tuple-space-receiver.rb +4 -3
- data/lib/pione/tuple-space/tuple-space-server-interface.rb +58 -13
- data/lib/pione/tuple-space/tuple-space-server.rb +13 -11
- data/lib/pione/tuple-space/update-criteria.rb +8 -7
- data/lib/pione/tuple/base-location-tuple.rb +9 -0
- data/lib/pione/tuple/basic-tuple.rb +7 -7
- data/lib/pione/tuple/data-tuple.rb +5 -2
- data/lib/pione/tuple/lift-tuple.rb +14 -0
- data/lib/pione/tuple/rule-tuple.rb +1 -1
- data/lib/pione/tuple/task-tuple.rb +5 -1
- data/lib/pione/version.rb +1 -1
- data/pione.gemspec +5 -1
- data/test/location/spec_basic-location.rb +35 -0
- data/test/location/spec_ftp-location.rb +100 -0
- data/test/location/spec_local-location.rb +99 -0
- data/test/log/data/sample.log +1003 -0
- data/test/log/spec_xes-log.rb +11 -0
- data/test/model/spec_data-expr.rb +249 -6
- data/test/model/spec_data-expr.yml +45 -0
- data/test/parser/spec_expr-parser.yml +4 -0
- data/test/spec_data-finder.rb +13 -7
- data/test/spec_data-finder.yml +42 -13
- data/test/system/spec_file-cache.rb +39 -0
- data/test/test-util.rb +226 -1
- data/test/transformer/spec_expr-transformer.rb +12 -1
- metadata +107 -24
- data/bin/pione-search-log +0 -30
- data/lib/pione/command-option/basic-option.rb +0 -42
- data/lib/pione/command-option/child-process-option.rb +0 -17
- data/lib/pione/command-option/daemon-option.rb +0 -12
- data/lib/pione/command-option/task-worker-owner-option.rb +0 -17
- data/lib/pione/command-option/tuple-space-provider-owner-option.rb +0 -16
- data/lib/pione/command-option/tuple-space-receiver-option.rb +0 -12
- data/lib/pione/command/tuple-space-provider-owner.rb +0 -6
- data/lib/pione/resource/basic-resource.rb +0 -92
- data/lib/pione/resource/dropbox-resource.rb +0 -106
- data/lib/pione/resource/ftp.rb +0 -84
- data/lib/pione/resource/local.rb +0 -113
- data/lib/pione/tuple/base-uri-tuple.rb +0 -9
- data/lib/pione/tuple/shift-tuple.rb +0 -13
- data/lib/pione/util/log.rb +0 -79
- data/test/spec_resource.rb +0 -73
data/lib/pione/system/global.rb
CHANGED
@@ -109,26 +109,81 @@ module Pione
|
|
109
109
|
Global.dot_pione_dir + "config.yml"
|
110
110
|
end
|
111
111
|
|
112
|
-
#
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
112
|
+
# @!method temporary_directory_root
|
113
|
+
#
|
114
|
+
# Temporary directory's root path. You can change temporary directories
|
115
|
+
# paths by setting this variable.
|
116
|
+
#
|
117
|
+
# @return [Pathname]
|
118
|
+
# root of all temporary directories
|
119
|
+
#
|
120
|
+
# @example
|
121
|
+
# Global.temporary_directory_root #=> "/tmp/pione"
|
122
|
+
define_item(:temporary_directory_root, true, Pathname.new(Dir.tmpdir) + "pione")
|
123
|
+
|
124
|
+
# @!method temporary_directory
|
125
|
+
#
|
126
|
+
# Temporary directory for various processings.
|
127
|
+
#
|
128
|
+
# @return [Pathname]
|
129
|
+
# temporary directory
|
130
|
+
#
|
131
|
+
# @example
|
132
|
+
# Global.temporary_directory #=> "/tmp/pione/misc_keita"
|
133
|
+
define_item(:temporary_directory, false) do
|
134
|
+
Global.temporary_directory_root + "misc_%s" % Etc.getlogin
|
117
135
|
end
|
118
136
|
|
119
|
-
#
|
137
|
+
# @!method working_directory_root
|
138
|
+
#
|
139
|
+
# Root of working directory. This directory is created by each user.
|
140
|
+
#
|
141
|
+
# @return [Pathname]
|
142
|
+
# root of working directory
|
143
|
+
#
|
144
|
+
# @example
|
145
|
+
# Global.working_directory_root #=> "/tmp/pione/working_keita"
|
146
|
+
define_item(:working_directory_root, false) do
|
147
|
+
dir = Global.temporary_directory_root + "working_%s" % Etc.getlogin
|
148
|
+
Pathname.new(dir).tap {|path| path.mkpath unless path.exist?}
|
149
|
+
end
|
150
|
+
|
151
|
+
# @!method working_directory
|
152
|
+
#
|
153
|
+
# Working directory for action rules.
|
154
|
+
#
|
155
|
+
# @return [Pathname]
|
156
|
+
# working directory
|
157
|
+
#
|
158
|
+
# @example
|
159
|
+
# Global.working_directory #=> "/tmp/pione/working_keita/d20130404-10000-1kg2ezo"
|
120
160
|
define_item(:working_directory, false) do
|
121
161
|
Pathname.new(Dir.mktmpdir(nil, Global.working_directory_root))
|
122
162
|
end
|
123
163
|
|
124
|
-
#
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
164
|
+
# @!method file_cache_directory_root
|
165
|
+
#
|
166
|
+
# Root of file cache directory. This directory is created by each user.
|
167
|
+
#
|
168
|
+
# @return [Pathname]
|
169
|
+
# root of file cache directory
|
170
|
+
#
|
171
|
+
# @example
|
172
|
+
# Global.file_cache_directory_root #=> "/tmp/pione/file-cache_keita"
|
173
|
+
define_item(:file_cache_directory_root, false) do
|
174
|
+
dir = Global.temporary_directory_root + "file-cache_%s" % Etc.getlogin
|
175
|
+
Pathname.new(dir).tap {|path| path.mkpath unless path.exist?}
|
129
176
|
end
|
130
177
|
|
131
|
-
#
|
178
|
+
# @!method file_cache_directory
|
179
|
+
#
|
180
|
+
# File cache directory.
|
181
|
+
#
|
182
|
+
# @return [Pathname]
|
183
|
+
# file cache directory
|
184
|
+
#
|
185
|
+
# @example
|
186
|
+
# Global.file_cache_directory #=> "/tmp/pione/file-cache_keita/d20130404-11086-qtu7h0"
|
132
187
|
define_item(:file_cache_directory, false) do
|
133
188
|
Pathname.new(Dir.mktmpdir(nil, Global.file_cache_directory_root))
|
134
189
|
end
|
data/lib/pione/system/init.rb
CHANGED
@@ -8,6 +8,26 @@ module Pione
|
|
8
8
|
# load configration file
|
9
9
|
System::Config.load(Global.config_path)
|
10
10
|
|
11
|
+
# make temporary directories
|
12
|
+
unless Global.temporary_directory_root.exist?
|
13
|
+
Global.temporary_directory_root.mkdir(0777)
|
14
|
+
end
|
15
|
+
unless Global.temporary_directory.exist?
|
16
|
+
Global.temporary_directory.mkdir(0700)
|
17
|
+
end
|
18
|
+
unless Global.working_directory_root.exist?
|
19
|
+
Global.working_directory_root.mkdir(0777)
|
20
|
+
end
|
21
|
+
unless Global.working_directory.exist?
|
22
|
+
Global.working_directory.mkdir(0700)
|
23
|
+
end
|
24
|
+
unless Global.file_cache_directory_root.exist?
|
25
|
+
Global.file_cache_directory_root.mkdir(0777)
|
26
|
+
end
|
27
|
+
unless Global.file_cache_directory.exist?
|
28
|
+
Global.file_cache_directory.mkdir(0700)
|
29
|
+
end
|
30
|
+
|
11
31
|
# relay client database
|
12
32
|
Global.relay_client_db = Relay::RelayClientDB.new(Global.relay_client_db_path)
|
13
33
|
|
@@ -55,7 +55,7 @@ module Pione
|
|
55
55
|
rule(:message =>
|
56
56
|
{ :message_name => simple(:name),
|
57
57
|
:message_parameters => sequence(:parameters) }) {
|
58
|
-
OpenStruct.new(name, parameters)
|
58
|
+
OpenStruct.new(name: name, parameters: parameters)
|
59
59
|
}
|
60
60
|
|
61
61
|
# Transform +:message+ with parameters as OpenStruct.
|
@@ -65,6 +65,11 @@ module Pione
|
|
65
65
|
OpenStruct.new(name: name, parameters: arg)
|
66
66
|
}
|
67
67
|
|
68
|
+
# data null
|
69
|
+
rule(:data_null => simple(:obj)) {
|
70
|
+
Model::DataExprNull.instance
|
71
|
+
}
|
72
|
+
|
68
73
|
# Extract the content of +:rule_expr+.
|
69
74
|
rule(:rule_expr => simple(:rule)) { rule }
|
70
75
|
|
@@ -55,18 +55,31 @@ module Pione
|
|
55
55
|
private
|
56
56
|
|
57
57
|
# Finds all data tuples by the expression from a tuple space server.
|
58
|
+
#
|
58
59
|
# @param [DataExpr] expr
|
59
60
|
# query expression of data
|
60
61
|
# @return [DataFinderResult]
|
61
62
|
# query result
|
62
|
-
# @api private
|
63
63
|
def find_by_expr(expr)
|
64
64
|
expr = DataExpr.new(expr) if expr.kind_of?(String)
|
65
65
|
query = Tuple[:data].new(name: expr, domain: @domain)
|
66
|
-
return tuple_space_server.read_all(query)
|
66
|
+
return tuple_space_server.read_all(query).map do |tuple|
|
67
|
+
tuple.update_criteria = expr.update_criteria; tuple
|
68
|
+
end
|
67
69
|
end
|
68
70
|
|
69
71
|
# Find input tuple combinatioins recursively.
|
72
|
+
#
|
73
|
+
# @param type [Symbol]
|
74
|
+
# input or output
|
75
|
+
# @param exprs [Array<DataExpr>]
|
76
|
+
# data expressions
|
77
|
+
# @param index
|
78
|
+
# index
|
79
|
+
# @param vtable [VariableTable]
|
80
|
+
# variable table
|
81
|
+
# @return [Array<DataFinderResult>]
|
82
|
+
# the result
|
70
83
|
def find_rec(type, exprs, index, vtable)
|
71
84
|
# return empty when we reach the recuirsion end
|
72
85
|
return [DataFinderResult.new([], vtable)] if exprs.empty?
|
@@ -78,12 +91,17 @@ module Pione
|
|
78
91
|
# find an input data by name from tuple space server
|
79
92
|
tuples = find_by_expr(head)
|
80
93
|
|
94
|
+
# the case for accepting noexistance data
|
95
|
+
if tuples.empty? and head.accept_nonexistence?
|
96
|
+
return find_rec_sub(type, tail, index, tuples, vtable)
|
97
|
+
end
|
98
|
+
|
81
99
|
# make combination results
|
82
100
|
prefix = (type == :input ? "I" : "O")
|
83
101
|
if head.all?
|
84
102
|
# case all modifier
|
85
103
|
new_vtable =
|
86
|
-
make_auto_variables_by_all(prefix, head, tuples, vtable)
|
104
|
+
make_auto_variables_by_all(prefix, head, tuples, vtable, index)
|
87
105
|
unless tuples.empty?
|
88
106
|
return find_rec_sub(type, tail, index, tuples, new_vtable)
|
89
107
|
end
|
@@ -111,7 +129,7 @@ module Pione
|
|
111
129
|
|
112
130
|
# Make auto-variables by the name modified 'all'.
|
113
131
|
# @api private
|
114
|
-
def make_auto_variables_by_all(prefix, expr, tuples, vtable)
|
132
|
+
def make_auto_variables_by_all(prefix, expr, tuples, vtable, index)
|
115
133
|
# create new table
|
116
134
|
new_vtable = VariableTable.new(vtable)
|
117
135
|
# variable
|
@@ -123,16 +141,25 @@ module Pione
|
|
123
141
|
io_list = RuleIOList.new
|
124
142
|
new_vtable.set!(var, list.add(io_list))
|
125
143
|
|
144
|
+
asterisk = []
|
145
|
+
|
126
146
|
# convert each tuples
|
127
147
|
tuples.each do |tuple, i|
|
148
|
+
asterisk << expr.match(tuple.name).to_a[1]
|
149
|
+
|
128
150
|
elt = RuleIOElement.new(PioneString.new(tuple.name))
|
129
|
-
elt.uri = PioneString.new(tuple.uri)
|
151
|
+
elt.uri = PioneString.new(tuple.location.uri)
|
130
152
|
elt.match = PioneList.new(
|
131
153
|
*expr.match(tuple.name).to_a.map{|m| PioneString.new(m)}
|
132
154
|
)
|
133
155
|
io_list.add!(elt)
|
134
156
|
end
|
135
157
|
|
158
|
+
# set special variable if index equals 1
|
159
|
+
if prefix == 'I' && index == 1
|
160
|
+
new_vtable.set(Variable.new("*"), PioneString.new(asterisk.join(":")))
|
161
|
+
end
|
162
|
+
|
136
163
|
return new_vtable
|
137
164
|
end
|
138
165
|
|
@@ -150,7 +177,7 @@ module Pione
|
|
150
177
|
list = new_vtable.get(var)
|
151
178
|
list = RuleIOList.new unless list
|
152
179
|
elt = RuleIOElement.new(PioneString.new(tuple.name))
|
153
|
-
elt.uri = PioneString.new(tuple.uri)
|
180
|
+
elt.uri = PioneString.new(tuple.location.uri.to_s)
|
154
181
|
elt.match = PioneList.new(*md.map{|d| PioneString.new(d)})
|
155
182
|
new_vtable.set!(var, list.add(elt))
|
156
183
|
|
@@ -46,7 +46,6 @@ module Pione
|
|
46
46
|
|
47
47
|
# Send empty tuple space server list.
|
48
48
|
def finalize
|
49
|
-
puts "finalize"
|
50
49
|
@terminated = true
|
51
50
|
@tuple_space_server_receiver.terminate
|
52
51
|
@socket.close
|
@@ -124,8 +123,10 @@ module Pione
|
|
124
123
|
broker.update_tuple_space_servers(tuple_space_servers)
|
125
124
|
true
|
126
125
|
rescue Exception => e
|
127
|
-
|
128
|
-
|
126
|
+
if Pione.debug_mode?
|
127
|
+
puts "[[[dead server]]]"
|
128
|
+
ErrorReport.print(e)
|
129
|
+
end
|
129
130
|
false
|
130
131
|
end
|
131
132
|
end
|
@@ -23,24 +23,69 @@ module Pione
|
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
|
-
#
|
27
|
-
#
|
28
|
-
|
29
|
-
|
26
|
+
# Read a tuple with no waiting time. If there are no matched tuples, return
|
27
|
+
# +nil+.
|
28
|
+
#
|
29
|
+
# @param tuple [BasicTuple]
|
30
|
+
# template tuple for query
|
31
|
+
# @return [BasicTuple, nil]
|
32
|
+
# query result
|
33
|
+
def read!(tuple)
|
34
|
+
begin
|
35
|
+
read(tuple, 0)
|
36
|
+
rescue Rinda::RequestExpiredError
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Take a tuple with no waiting time. If there are no matched tuples, return
|
42
|
+
# +nil+.
|
43
|
+
#
|
44
|
+
# @param tuple [BasicTuple]
|
45
|
+
# template tuple for query
|
46
|
+
# @return [BasicTuple, nil]
|
47
|
+
# query result
|
48
|
+
def take!(tuple)
|
49
|
+
begin
|
50
|
+
take(tuple, 0)
|
51
|
+
rescue Rinda::RequestExpiredError
|
52
|
+
nil
|
53
|
+
end
|
30
54
|
end
|
31
55
|
|
32
|
-
#
|
33
|
-
#
|
34
|
-
|
35
|
-
|
56
|
+
# Put a log tuple with the data as a process record into tuple space. The
|
57
|
+
# record's value of transition is "complete" by default and the timestamp
|
58
|
+
# set automatically.
|
59
|
+
#
|
60
|
+
# @param record [Log::ProcessRecord]
|
61
|
+
# process log record
|
62
|
+
# @return [void]
|
63
|
+
def process_log(record)
|
64
|
+
record = record.merge(transition: "complete") unless record.transition
|
65
|
+
write(Tuple[:log].new(record))
|
66
|
+
end
|
67
|
+
|
68
|
+
# Do the action with loggging.
|
69
|
+
#
|
70
|
+
# @param record [Log::ProcessRecord]
|
71
|
+
# process log record
|
72
|
+
# @yield
|
73
|
+
# the action
|
74
|
+
# @return [void]
|
75
|
+
def with_process_log(record)
|
76
|
+
process_log(record.merge(transition: "start"))
|
77
|
+
result = yield
|
78
|
+
process_log(record.merge(transition: "complete"))
|
79
|
+
return result
|
36
80
|
end
|
37
81
|
|
38
|
-
#
|
82
|
+
# Send a processing error.
|
83
|
+
#
|
84
|
+
# @param msg [String]
|
85
|
+
# error message
|
39
86
|
# @return [void]
|
40
|
-
def
|
41
|
-
|
42
|
-
yield msg
|
43
|
-
write(Tuple[:log].new(msg))
|
87
|
+
def processing_error(msg)
|
88
|
+
write(Tuple[:command].new(name: "terminate", args: {message: msg}))
|
44
89
|
end
|
45
90
|
|
46
91
|
# Set tuple space server which provides operations.
|
@@ -62,18 +62,17 @@ module Pione
|
|
62
62
|
|
63
63
|
@terminated = false
|
64
64
|
|
65
|
-
# base uri
|
66
|
-
if data.has_key?(:base_uri)
|
67
|
-
uri = data[:base_uri]
|
68
|
-
write(Tuple[:base_uri].new(uri: uri))
|
69
|
-
end
|
70
|
-
|
71
65
|
# start agents
|
72
66
|
@client_life_checker = Agent::TupleSpaceServerClientLifeChecker.start(self)
|
73
67
|
end
|
74
68
|
|
75
|
-
|
76
|
-
|
69
|
+
# Set base location.
|
70
|
+
#
|
71
|
+
# @param location [BasicLocation]
|
72
|
+
# base location
|
73
|
+
# @return [void]
|
74
|
+
def set_base_location(location)
|
75
|
+
write(Tuple[:base_location].new(location.as_directory))
|
77
76
|
end
|
78
77
|
|
79
78
|
def drburi
|
@@ -94,9 +93,12 @@ module Pione
|
|
94
93
|
Time.now
|
95
94
|
end
|
96
95
|
|
97
|
-
# Return common base
|
98
|
-
|
99
|
-
|
96
|
+
# Return common base location of the space.
|
97
|
+
#
|
98
|
+
# @return [BasicLocation]
|
99
|
+
# base location
|
100
|
+
def base_location
|
101
|
+
read(Tuple[:base_location].any).location
|
100
102
|
end
|
101
103
|
|
102
104
|
# Return the worker resource size of the server.
|
@@ -60,7 +60,7 @@ module Pione::UpdateCriteria
|
|
60
60
|
# true if inputs are newer than outputs
|
61
61
|
def exist_newer_input?(rule, inputs, outputs, vtable)
|
62
62
|
# get output oldest time
|
63
|
-
output_oldest_time = outputs.flatten.map{|output| output.time}.sort.last
|
63
|
+
output_oldest_time = outputs.flatten.select{|output| output.update_criteria == :care}.map{|output| output.time}.sort.last
|
64
64
|
|
65
65
|
# get input last time
|
66
66
|
input_last_time = inputs.flatten.map{|input| input.time}.sort.last
|
@@ -71,23 +71,24 @@ module Pione::UpdateCriteria
|
|
71
71
|
return output_oldest_time < input_last_time
|
72
72
|
end
|
73
73
|
|
74
|
-
#
|
74
|
+
# Return true if we need to update.
|
75
|
+
#
|
75
76
|
# @param [Rule] rule
|
76
77
|
# rule
|
77
|
-
# @param [Tuple::
|
78
|
+
# @param [Tuple::DataTuple] inputs
|
78
79
|
# input tuples
|
79
|
-
# @param [Tuple::
|
80
|
+
# @param [Tuple::DataTuple] outputs
|
80
81
|
# output tuples
|
81
82
|
# @param [VariableTable] vtable
|
82
83
|
# variable table
|
83
84
|
# @return [Boolean]
|
84
85
|
# true if inputs are newer than outputs
|
85
86
|
def satisfy?(rule, inputs, outputs, vtable)
|
86
|
-
|
87
|
+
CRITERIA.any?{|name| self.send(name, rule, inputs, outputs, vtable)}
|
87
88
|
end
|
88
89
|
|
89
|
-
#
|
90
|
-
|
90
|
+
# PIONE data update criteria
|
91
|
+
CRITERIA = [
|
91
92
|
:no_output_rules?,
|
92
93
|
:not_exist_output?,
|
93
94
|
:exist_newer_input?
|
@@ -21,8 +21,7 @@ module Pione
|
|
21
21
|
# message string with invalid data and tuple identifier
|
22
22
|
# @api private
|
23
23
|
def message
|
24
|
-
msg = @invalid_data.inspect
|
25
|
-
msg += " in %s" % @identifier if @identifier
|
24
|
+
msg = "Format error found in %s tuple: %s" % [@identifier, @invalid_data.inspect]
|
26
25
|
return msg
|
27
26
|
end
|
28
27
|
end
|
@@ -140,12 +139,13 @@ module Pione
|
|
140
139
|
position_of(:domain)
|
141
140
|
end
|
142
141
|
|
143
|
-
#
|
144
|
-
#
|
145
|
-
#
|
142
|
+
# Return location position of the format.
|
143
|
+
#
|
144
|
+
# @return [Integer or nil]
|
145
|
+
# position number of location field, or nil
|
146
146
|
# @api private
|
147
|
-
def
|
148
|
-
position_of(:
|
147
|
+
def location_position
|
148
|
+
position_of(:location)
|
149
149
|
end
|
150
150
|
|
151
151
|
private
|