rbbt-util 5.9.8 → 5.9.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af7c97dc6faaad2d36d15d08bc43334030634194
4
- data.tar.gz: 619c854df951805baf6f4320ba2f9586debf4ef0
3
+ metadata.gz: 1b01c7fe766ec84aa4005a1454ba37c116cdab5e
4
+ data.tar.gz: fbdc4ffcdc4eecde849214ebbb2cb34c5707a133
5
5
  SHA512:
6
- metadata.gz: 76c32546b99a5d94e892f0748086c7adbfb9e5c7899da26e5c2a254981629b72f6c0cfc8647e3900505419550f95832e208174cc13b0b9c7f3dc9b200feca1ba
7
- data.tar.gz: 3a67acfe721834e9e9591163414ad364dabe183152bcfd7acf112bbe1e28ae368f5b85fdf2f480cd0f96e81adf3ae6fcdd03ca5a37087aa2c5592f80cf6bc173
6
+ metadata.gz: eb43c51791fba21ac08a2c446a5a8058b9bdae2af20bc9e2e33fb4ec243e4fb389ea4feda385bbc9073a6a981083609efed8263a40f673cf4490baa39c8d933c
7
+ data.tar.gz: eae2392ac690150d68bbc3a2d8b0f9d1bc64f4956f32016feede48833cad7e72c0cefff1a91e08b5329b32e6f75a3ed251f193a4a40b6b2d8af0c8113e447faa
@@ -23,7 +23,10 @@ module TSV
23
23
  when other.type == :single
24
24
  new_values = [other[key]]
25
25
  else
26
- new_values = other[key].values_at *field_positions
26
+ other_values = other[key]
27
+ new_values = field_positions.collect do |pos|
28
+ pos == :key ? key : other_values[pos]
29
+ end
27
30
  end
28
31
 
29
32
  new_values.collect!{|v| [v]} if type == :double and not other.type == :double
@@ -162,5 +162,6 @@ module TSV
162
162
  traverse_cpus cpus, obj, options, &block
163
163
  end
164
164
  end
165
+ into
165
166
  end
166
167
  end
data/lib/rbbt/tsv/util.rb CHANGED
@@ -83,11 +83,25 @@ module TSV
83
83
  case
84
84
  when Path === file
85
85
  file.open(open_options)
86
+ when file.respond_to?(:gets)
87
+ file.rewind if file.respond_to?(:rewind) and file.eof?
88
+ file
86
89
  when String === file
87
90
  Open.open(file, open_options)
88
- when file.respond_to?(:gets)
91
+ else
92
+ raise "Cannot get stream from: #{file.inspect}"
93
+ end
94
+ end
95
+ def self.get_stream(file, open_options = {})
96
+ case file
97
+ when Path
98
+ file.open(open_options)
99
+ when IO, StringIO
89
100
  file.rewind if file.respond_to?(:rewind) and file.eof?
90
101
  file
102
+ when String
103
+ raise "Could not open file given by String: #{Misc.fingerprint file}" unless File.exists? file
104
+ Open.open(file, open_options)
91
105
  else
92
106
  raise "Cannot get stream from: #{file.inspect}"
93
107
  end
@@ -123,14 +123,13 @@ class Step
123
123
  raise $!
124
124
  end
125
125
  }
126
-
127
- Log.info{"#{Log.color :magenta, "Starting task"} #{Log.color :yellow, task.name.to_s || ""} [#{Process.pid}]: #{ Log.color :blue, path }"}
128
- set_info :status, :started
129
126
 
130
- set_info :started, (start_time = Time.now)
131
-
132
127
  set_info :inputs, Misc.remove_long_items(Misc.zip2hash(task.inputs, @inputs)) unless task.inputs.nil?
133
128
 
129
+ #Log.info{"#{Log.color :magenta, "Starting task"} #{Log.color :yellow, task.name.to_s || ""} [#{Process.pid}]: #{ Log.color :blue, path }"}
130
+ set_info :started, (start_time = Time.now)
131
+ log :started, "#{Log.color :magenta, "Starting task"} #{Log.color :yellow, task.name.to_s || ""} [#{Process.pid}]"
132
+
134
133
  res = begin
135
134
  exec
136
135
  rescue Aborted
@@ -162,10 +161,9 @@ class Step
162
161
  raise $!
163
162
  end
164
163
 
165
- set_info :status, :done
166
164
  set_info :done, (done_time = Time.now)
167
- set_info :time_elapsed, done_time - start_time
168
- Log.info{"#{Log.color :magenta, "Completed task"} #{Log.color :yellow, task.name.to_s || ""} [#{Process.pid}]: #{ Log.color :blue, path }"}
165
+ set_info :time_elapsed, (time_elapsed = done_time - start_time)
166
+ log :done, "#{Log.color :magenta, "Completed task"} #{Log.color :yellow, task.name.to_s || ""} [#{Process.pid}] +#{time_elapsed.to_i}"
169
167
 
170
168
  res
171
169
  end
@@ -12,7 +12,7 @@ Take absolute value
12
12
 
13
13
  $ rbbt stat density <file>
14
14
 
15
- Display summary information. Works with Tokyocabinet HDB and DBD as well.
15
+ Display summary information. Works with Tokyocabinet HDB and BDB as well.
16
16
 
17
17
  -tch--tokyocabinet File is a TC HDB
18
18
  -tcb--tokyocabinet_bd File is a TC BDB
@@ -12,7 +12,7 @@ Calculate density
12
12
 
13
13
  $ rbbt stat density <file>
14
14
 
15
- Display summary information. Works with Tokyocabinet HDB and DBD as well.
15
+ Display summary information. Works with Tokyocabinet HDB and BDB as well.
16
16
 
17
17
  -tch--tokyocabinet File is a TC HDB
18
18
  -tcb--tokyocabinet_bd File is a TC BDB
@@ -12,7 +12,7 @@ Take logs
12
12
 
13
13
  $ rbbt stat density <file>
14
14
 
15
- Display summary information. Works with Tokyocabinet HDB and DBD as well.
15
+ Display summary information. Works with Tokyocabinet HDB and BDB as well.
16
16
 
17
17
  -tch--tokyocabinet File is a TC HDB
18
18
  -tcb--tokyocabinet_bd File is a TC BDB
@@ -10,7 +10,7 @@ Inspect a TSV file
10
10
 
11
11
  $ rbbt tsv info [options] file.tsv
12
12
 
13
- Display summary information. Works with Tokyocabinet HDB and DBD as well.
13
+ Display summary information. Works with Tokyocabinet HDB and BDB as well.
14
14
 
15
15
  -tch--tokyocabinet File is a TC HDB
16
16
  -tcb--tokyocabinet_bd File is a TC BDB
@@ -10,7 +10,7 @@ Slice column from tsv
10
10
 
11
11
  $ rbbt tsv slice [options] file.tsv -f "Field 1"
12
12
 
13
- Display summary informations. Works with Tokyocabinet HDB and DBD as well.
13
+ Display summary informations. Works with Tokyocabinet HDB and BDB as well.
14
14
 
15
15
  -tch--tokyocabinet File is a TC HDB
16
16
  -tcb--tokyocabinet_bd File is a TC BDB
@@ -10,7 +10,7 @@ Subset entries in a tsv
10
10
 
11
11
  $ rbbt tsv subset [options] file.tsv --subset key1,key2,key3
12
12
 
13
- Subsets entries from a TSV file from a given list. Works with Tokyocabinet HDB and DBD as well.
13
+ Subsets entries from a TSV file from a given list. Works with Tokyocabinet HDB and BDB as well.
14
14
 
15
15
  -tch--tokyocabinet File is a TC HDB
16
16
  -tcb--tokyocabinet_bd File is a TC BDB
@@ -224,8 +224,6 @@ workflow.workdir = Path.setup(File.expand_path(options.delete(:workdir))) if opt
224
224
 
225
225
  #- get job
226
226
 
227
- ddd job_options["watson"]
228
-
229
227
  job = workflow.job(task.name, name, job_options)
230
228
 
231
229
  # clean job
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.9.8
4
+ version: 5.9.10
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-03-21 00:00:00.000000000 Z
11
+ date: 2014-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake