rbbt-util 5.21.66 → 5.21.67
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/association/database.rb +48 -13
- data/lib/rbbt/association/open.rb +9 -11
- data/lib/rbbt/tsv/manipulate.rb +9 -9
- data/lib/rbbt/workflow/accessor.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fdfbe2c9f05d2feec86f7af0493388d3fd82ae6
|
4
|
+
data.tar.gz: 76fdd311a0785941e491837ab1672c74ac4b1bf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ff39d846bfe555f00ae2643a8510636d626044b7c93186fb30d3d10141fa3c24777aa4426e4fea0ffc7ccdffeb89d70ff7138b757f9cd714bf7ebf681119089
|
7
|
+
data.tar.gz: 131a08fa2c1e7741e9542b508075021830dd708fd62f05e473b6f91c08a79670d669c2791daf31f1f4f11c351dd501702b2155f9b88dc39e686c552b91f21683
|
@@ -72,14 +72,26 @@ module Association
|
|
72
72
|
info_fields = field_pos.collect{|f| f == :key ? :key : all_fields[f]}
|
73
73
|
options = options.merge({:key_field => source_field, :fields => info_fields})
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
data = options[:data] || {}
|
76
|
+
TmpFile.with_file do |tmpfile|
|
77
|
+
tmp_data = Persist.open_database(tmpfile, true, :double, "HDB")
|
78
|
+
|
79
|
+
tsv.with_monitor(options[:monitor]) do
|
80
|
+
tsv = tsv.reorder source_field, fields, :persist => persist, :persist_data => tmp_data if true or source_field != tsv.key_field or (fields and tsv.fields != fields)
|
81
|
+
end
|
78
82
|
|
79
|
-
|
80
|
-
|
83
|
+
tsv.key_field = source_header
|
84
|
+
tsv.fields = field_headers
|
81
85
|
|
82
|
-
|
86
|
+
if source_format or target_format
|
87
|
+
tsv = translate tsv, source_format, target_format, :persist => true, :persist_data => data, :data => data
|
88
|
+
else
|
89
|
+
tsv.through do |k,v|
|
90
|
+
data[k] = v
|
91
|
+
end
|
92
|
+
tsv.annotate data
|
93
|
+
end
|
94
|
+
end
|
83
95
|
|
84
96
|
tsv
|
85
97
|
end
|
@@ -87,7 +99,7 @@ module Association
|
|
87
99
|
def self.open_stream(stream, options = {})
|
88
100
|
fields, persist = Misc.process_options options, :fields, :persist
|
89
101
|
|
90
|
-
parser = TSV::Parser.new stream, options.merge(:fields => nil, :key_field => nil)
|
102
|
+
parser = TSV::Parser.new stream, options.merge(:fields => nil, :key_field => nil, :type => :double)
|
91
103
|
|
92
104
|
key_field, *_fields = all_fields = parser.all_fields
|
93
105
|
|
@@ -128,13 +140,25 @@ module Association
|
|
128
140
|
open_options = options.merge(parser.options).merge(:parser => parser)
|
129
141
|
open_options = Misc.add_defaults open_options, :monitor => {:desc => "Parsing #{ Misc.fingerprint stream }"}
|
130
142
|
|
131
|
-
|
132
|
-
tsv
|
133
|
-
|
143
|
+
data = open_options[:data] || {}
|
144
|
+
tsv = nil
|
145
|
+
TmpFile.with_file do |tmpfile|
|
146
|
+
tmp_data = Persist.open_database(tmpfile, true, :double, "HDB")
|
147
|
+
|
148
|
+
tsv = TSV.parse parser.stream, tmp_data, open_options
|
149
|
+
tsv.key_field = source_header
|
150
|
+
tsv.fields = field_headers
|
134
151
|
|
135
|
-
|
152
|
+
if source_format or target_format
|
153
|
+
tsv = translate tsv, source_format, target_format, :persist => true, :persist_data => data, :data => data
|
154
|
+
else
|
155
|
+
tsv.through do |k,v|
|
156
|
+
data[k] = v
|
157
|
+
end
|
158
|
+
tsv.annotate data
|
159
|
+
end
|
136
160
|
|
137
|
-
|
161
|
+
end
|
138
162
|
|
139
163
|
tsv
|
140
164
|
end
|
@@ -148,7 +172,18 @@ module Association
|
|
148
172
|
open_stream(TSV.get_stream(file), options.dup)
|
149
173
|
when TSV
|
150
174
|
file = file.to_double unless file.type == :double
|
151
|
-
reorder_tsv(file, options.dup)
|
175
|
+
tsv = reorder_tsv(file, options.dup)
|
176
|
+
if options[:data]
|
177
|
+
data = options[:data]
|
178
|
+
tsv.with_unnamed do
|
179
|
+
tsv.with_monitor("Saving database #{Misc.fingerprint file}") do
|
180
|
+
tsv.through do |k,v|
|
181
|
+
data[k] = v
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
tsv
|
152
187
|
when IO
|
153
188
|
open_stream(file, options.dup)
|
154
189
|
else
|
@@ -22,19 +22,17 @@ module Association
|
|
22
22
|
file = file.call if Proc === file
|
23
23
|
|
24
24
|
options = options.dup
|
25
|
-
|
26
|
-
tsv = tsv.to_double unless tsv.type == :double
|
25
|
+
data.serializer = :double if data.respond_to? :serializer
|
27
26
|
|
28
|
-
tsv.
|
27
|
+
tsv = Association.database(file, options.merge(:persist => true, :unnamed => true, :data => data, :type => :double))
|
29
28
|
|
30
|
-
|
31
|
-
tsv.
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
29
|
+
#tsv.with_unnamed do
|
30
|
+
# tsv.with_monitor("Saving database #{Misc.fingerprint file}") do
|
31
|
+
# tsv.through do |k,v|
|
32
|
+
# data[k] = v
|
33
|
+
# end
|
34
|
+
# end
|
35
|
+
#end
|
38
36
|
|
39
37
|
data
|
40
38
|
end
|
data/lib/rbbt/tsv/manipulate.rb
CHANGED
@@ -249,10 +249,10 @@ module TSV
|
|
249
249
|
persist_options[:prefix] = "Reorder"
|
250
250
|
|
251
251
|
Persist.persist_tsv self, self.filename, self.options.merge({:key_field => new_key_field, :fields => new_fields}), persist_options do |data|
|
252
|
-
if data.respond_to? :persistence_path
|
253
|
-
|
254
|
-
|
255
|
-
end
|
252
|
+
#if data.respond_to? :persistence_path
|
253
|
+
# real_data = data
|
254
|
+
# data = {}
|
255
|
+
#end
|
256
256
|
|
257
257
|
new_key_field_name, new_field_names = nil, nil
|
258
258
|
with_unnamed do
|
@@ -304,11 +304,11 @@ module TSV
|
|
304
304
|
end
|
305
305
|
end
|
306
306
|
|
307
|
-
if real_data and real_data.respond_to? :persistence_path
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
end
|
307
|
+
#if real_data and real_data.respond_to? :persistence_path
|
308
|
+
# real_data.serializer = type if real_data.respond_to? :serializer
|
309
|
+
# real_data.merge!(data)
|
310
|
+
# data = real_data
|
311
|
+
#end
|
312
312
|
|
313
313
|
data.extend TSV unless TSV === data
|
314
314
|
self.annotate(data)
|
@@ -325,7 +325,7 @@ class Step
|
|
325
325
|
begin
|
326
326
|
klass = Kernel.const_get(ex_class)
|
327
327
|
ex = klass.new ex_message
|
328
|
-
|
328
|
+
ex.set_backtrace ex_backtrace unless ex_backtrace.nil? or ex_backtrace.empty?
|
329
329
|
ex
|
330
330
|
rescue
|
331
331
|
Log.exception $!
|
@@ -338,10 +338,11 @@ class Step
|
|
338
338
|
return true if aborted?
|
339
339
|
return false unless error?
|
340
340
|
begin
|
341
|
+
return true unless info[:exception]
|
341
342
|
klass = Kernel.const_get(info[:exception][:class])
|
342
343
|
not (RbbtException == klass or RbbtException === klass)
|
343
344
|
rescue Exception
|
344
|
-
|
345
|
+
true
|
345
346
|
end
|
346
347
|
end
|
347
348
|
|
@@ -350,6 +351,7 @@ class Step
|
|
350
351
|
end
|
351
352
|
|
352
353
|
def dirty?
|
354
|
+
return true if done? and not status == :done
|
353
355
|
dirty_files = rec_dependencies.collect{|dependency| dependency.path unless dependency.error? and not dependency.recoverable_error? }.compact.uniq.reject{|path| not (Path === path) or path.exists?}
|
354
356
|
if dirty_files.any?
|
355
357
|
true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.21.
|
4
|
+
version: 5.21.67
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|