rbbt-util 5.13.7 → 5.13.8
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.
- checksums.yaml +4 -4
- data/lib/rbbt/tsv/parallel/traverse.rb +1 -1
- data/lib/rbbt/tsv/parser.rb +0 -1
- data/lib/rbbt/workflow/accessor.rb +1 -1
- data/lib/rbbt/workflow/step/run.rb +6 -6
- data/share/rbbt_commands/tsv/read +64 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7281b74a41b34bf9cc71d351b6ca175a40f8aeb
|
4
|
+
data.tar.gz: 6f31f788281e74e00b594e9ff0303ccf0cddb491
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7faad521cd49f6079fc8db95d49ad2d60dfda58f0ba99ee2f7249dcc519b3967df2c1a8cbe09f6de6af8d31c219233b3181ca7b70b859383885f335d7e13d80d
|
7
|
+
data.tar.gz: c218eb43aaaee50d7fb41c08d55b99b5615243e7c9f38bf6d1c499ee1766486c0f4e1cd21edd01389525747714f50669c35d6a120aab7e01c1011dd1410fd216
|
data/lib/rbbt/tsv/parser.rb
CHANGED
@@ -496,7 +496,6 @@ module TSV
|
|
496
496
|
desc = monitor[:desc] if monitor.include? :desc
|
497
497
|
step = monitor[:step] if monitor.include? :step
|
498
498
|
end
|
499
|
-
#progress_monitor = Progress::Bar.new(size, 0, step, desc)
|
500
499
|
progress_monitor = Log::ProgressBar.new(size, :desc => desc)
|
501
500
|
else
|
502
501
|
progress_monitor = nil
|
@@ -15,7 +15,7 @@ class Step
|
|
15
15
|
Log.medium "Not duplicating stream #{ Misc.fingerprint(stream) }"
|
16
16
|
STREAM_CACHE[stream] = stream
|
17
17
|
when File
|
18
|
-
if
|
18
|
+
if Open.exists? current.filename
|
19
19
|
Log.medium "Reopening file #{ Misc.fingerprint(current) }"
|
20
20
|
Open.open(current.filename)
|
21
21
|
else
|
@@ -136,7 +136,7 @@ class Step
|
|
136
136
|
@seen.each do |dependency|
|
137
137
|
next if dependency == self
|
138
138
|
next unless dependencies.include? dependency
|
139
|
-
Log.info "#{Log.color :
|
139
|
+
Log.info "#{Log.color :cyan, "dependency"} #{Log.color :yellow, task.name.to_s || ""} => #{Log.color :yellow, dependency.task_name.to_s || ""} -- #{Log.color :blue, dependency.path}"
|
140
140
|
begin
|
141
141
|
if dependency.streaming?
|
142
142
|
next if dependency.running?
|
@@ -184,7 +184,7 @@ class Step
|
|
184
184
|
|
185
185
|
Open.rm info_file if Open.exists? info_file
|
186
186
|
|
187
|
-
log :setup, "#{Log.color :
|
187
|
+
log :setup, "#{Log.color :magenta, "Task"} #{Log.color :yellow, task.name.to_s || ""}"
|
188
188
|
|
189
189
|
merge_info({
|
190
190
|
:pid => Process.pid,
|
@@ -234,12 +234,12 @@ class Step
|
|
234
234
|
case result
|
235
235
|
when IO
|
236
236
|
|
237
|
-
log :streaming, "#{Log.color :magenta, "Streaming
|
237
|
+
log :streaming, "#{Log.color :magenta, "Streaming IO"} #{Log.color :yellow, task.name.to_s || ""} [#{Process.pid}]"
|
238
238
|
ConcurrentStream.setup result do
|
239
239
|
begin
|
240
240
|
set_info :done, (done_time = Time.now)
|
241
241
|
set_info :time_elapsed, (time_elapsed = done_time - start_time)
|
242
|
-
log :done, "#{Log.color :red, "Completed
|
242
|
+
log :done, "#{Log.color :red, "Completed"} #{Log.color :yellow, task.name.to_s || ""} [#{Process.pid}] +#{time_elapsed.to_i} -- #{path}"
|
243
243
|
rescue
|
244
244
|
Log.exception $!
|
245
245
|
ensure
|
@@ -256,7 +256,7 @@ class Step
|
|
256
256
|
end
|
257
257
|
end
|
258
258
|
when TSV::Dumper
|
259
|
-
log :streaming, "#{Log.color :magenta, "Streaming
|
259
|
+
log :streaming, "#{Log.color :magenta, "Streaming TSV::Dumper"} #{Log.color :yellow, task.name.to_s || ""} [#{Process.pid}]"
|
260
260
|
ConcurrentStream.setup result.stream do
|
261
261
|
begin
|
262
262
|
set_info :done, (done_time = Time.now)
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rbbt-util'
|
4
|
+
require 'rbbt/util/simpleopt'
|
5
|
+
|
6
|
+
options = SOPT.setup <<EOF
|
7
|
+
Read a TSV file and dump it
|
8
|
+
|
9
|
+
$ rbbt tsv read [options] <filename.tsv|->
|
10
|
+
|
11
|
+
Use - to read from STDIN
|
12
|
+
|
13
|
+
-k--key_field* Key field
|
14
|
+
-f--fields* Fields
|
15
|
+
-t--type* Type
|
16
|
+
-m--merge* Merge from multiple rows
|
17
|
+
-h--help Print this help
|
18
|
+
|
19
|
+
EOF
|
20
|
+
rbbt_usage and exit 0 if options[:help]
|
21
|
+
|
22
|
+
file = ARGV.shift
|
23
|
+
|
24
|
+
file = STDIN if file == '-'
|
25
|
+
|
26
|
+
parser = TSV::Parser.new TSV.get_stream(file), options
|
27
|
+
|
28
|
+
dumper = TSV::Dumper.new parser.options
|
29
|
+
|
30
|
+
options[:merge] = false if options[:merge] == "false"
|
31
|
+
|
32
|
+
Thread.new do
|
33
|
+
line = parser.first_line
|
34
|
+
bar = Log::ProgressBar.new
|
35
|
+
while line
|
36
|
+
bar.tick
|
37
|
+
|
38
|
+
line = Misc.fixutf8(line)
|
39
|
+
line = parser.process line
|
40
|
+
raise SKIP_LINE if line.empty?
|
41
|
+
parts = parser.chop_line line
|
42
|
+
key, values = parser.get_values parts
|
43
|
+
values = parser.cast_values values if parser.cast?
|
44
|
+
|
45
|
+
if Array === key
|
46
|
+
key.each do |k|
|
47
|
+
dumper.add k, values
|
48
|
+
end
|
49
|
+
line = parser.stream.gets
|
50
|
+
else
|
51
|
+
dumper.add key, values
|
52
|
+
line = parser.stream.gets
|
53
|
+
end
|
54
|
+
end
|
55
|
+
dumper.close
|
56
|
+
end
|
57
|
+
|
58
|
+
dumper.init
|
59
|
+
stream = dumper.stream
|
60
|
+
stream = TSV.collapse_stream(dumper.stream).stream if options[:merge]
|
61
|
+
|
62
|
+
while line = stream.gets
|
63
|
+
puts line
|
64
|
+
end
|
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.13.
|
4
|
+
version: 5.13.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -250,6 +250,7 @@ files:
|
|
250
250
|
- share/rbbt_commands/tsv/get
|
251
251
|
- share/rbbt_commands/tsv/info
|
252
252
|
- share/rbbt_commands/tsv/json
|
253
|
+
- share/rbbt_commands/tsv/read
|
253
254
|
- share/rbbt_commands/tsv/slice
|
254
255
|
- share/rbbt_commands/tsv/sort
|
255
256
|
- share/rbbt_commands/tsv/subset
|