rbbt-util 5.20.9 → 5.20.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rbbt +1 -1
  3. data/bin/rbbt_query.rb +1 -1
  4. data/lib/rbbt/association/index.rb +3 -3
  5. data/lib/rbbt/fix_width_table.rb +4 -4
  6. data/lib/rbbt/persist/tsv.rb +4 -4
  7. data/lib/rbbt/persist/tsv/cdb.rb +3 -3
  8. data/lib/rbbt/persist/tsv/fix_width_table.rb +2 -2
  9. data/lib/rbbt/persist/tsv/kyotocabinet.rb +2 -2
  10. data/lib/rbbt/persist/tsv/leveldb.rb +2 -2
  11. data/lib/rbbt/persist/tsv/lmdb.rb +2 -2
  12. data/lib/rbbt/persist/tsv/packed_index.rb +2 -2
  13. data/lib/rbbt/persist/tsv/sharder.rb +4 -4
  14. data/lib/rbbt/persist/tsv/tokyocabinet.rb +2 -2
  15. data/lib/rbbt/resource.rb +6 -6
  16. data/lib/rbbt/resource/path.rb +7 -7
  17. data/lib/rbbt/resource/util.rb +9 -9
  18. data/lib/rbbt/rest/client/step.rb +8 -4
  19. data/lib/rbbt/tsv/attach.rb +21 -19
  20. data/lib/rbbt/tsv/parallel/traverse.rb +2 -2
  21. data/lib/rbbt/tsv/util.rb +1 -1
  22. data/lib/rbbt/util/R.rb +1 -1
  23. data/lib/rbbt/util/R/eval.rb +10 -10
  24. data/lib/rbbt/util/R/model.rb +2 -2
  25. data/lib/rbbt/util/docker.rb +3 -3
  26. data/lib/rbbt/util/filecache.rb +2 -2
  27. data/lib/rbbt/util/misc/development.rb +6 -4
  28. data/lib/rbbt/util/misc/lock.rb +1 -1
  29. data/lib/rbbt/util/misc/multipart_payload.rb +1 -1
  30. data/lib/rbbt/util/misc/pipes.rb +8 -8
  31. data/lib/rbbt/util/misc/system.rb +3 -3
  32. data/lib/rbbt/util/open.rb +9 -9
  33. data/lib/rbbt/util/simpleDSL.rb +2 -2
  34. data/lib/rbbt/util/tar.rb +1 -1
  35. data/lib/rbbt/util/tmpfile.rb +2 -2
  36. data/lib/rbbt/workflow.rb +26 -12
  37. data/lib/rbbt/workflow/accessor.rb +4 -4
  38. data/lib/rbbt/workflow/step/dependencies.rb +1 -1
  39. data/lib/rbbt/workflow/step/run.rb +6 -6
  40. data/share/rbbt_commands/app/install +2 -2
  41. data/share/rbbt_commands/app/start +1 -1
  42. data/share/rbbt_commands/log +5 -1
  43. data/share/rbbt_commands/resource/exists +1 -1
  44. data/share/rbbt_commands/study/task +3 -3
  45. data/share/rbbt_commands/system/clean +2 -2
  46. data/share/rbbt_commands/system/deleted_files +1 -1
  47. data/share/rbbt_commands/system/status +3 -3
  48. data/share/rbbt_commands/tsv/info +1 -1
  49. data/share/rbbt_commands/tsv/subset +1 -1
  50. data/share/rbbt_commands/workflow/example +1 -1
  51. data/share/rbbt_commands/workflow/install +3 -3
  52. data/share/rbbt_commands/workflow/monitor +6 -6
  53. data/share/rbbt_commands/workflow/prov +2 -2
  54. data/share/rbbt_commands/workflow/server +2 -2
  55. data/share/rbbt_commands/workflow/task +3 -3
  56. data/test/rbbt/test_resource.rb +2 -2
  57. data/test/rbbt/workflow/test_step.rb +3 -6
  58. metadata +2 -3
  59. data/lib/rbbt/util/misc/progress.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0dfd6e2f34b010a55ef904fe69c5d2f5d5c85363
4
- data.tar.gz: b1b7fd04c9c94d2ec1a1c16cc4e883536f7a3500
3
+ metadata.gz: 2c424ed8cfdf95b53803cbc976261f9542eda87d
4
+ data.tar.gz: 1ed15794721f06807a43e2158ec5186cdfaa6462
5
5
  SHA512:
6
- metadata.gz: e75cedcb0a224bdd4eb897578ed8bd08ef68b6b0c2196fb37bc31855457045d93dffa82d271ccaa47285df1b6395cd87b97a190f49cd4943a934f0ee903abb4e
7
- data.tar.gz: dbf542a2d17b31f6975e8d3bc1fa53739d1fcc95c9aa9f805b2609833aff38fb8d0f8851ee90791434066e9165eaab4f636632868cdab7916cb43a9dc56da8a2
6
+ metadata.gz: 3006d04121e96c3a1a290520a7749615a602718843c09bca87533f2f07cf412918eee6a48eedee4c12c88f751cb203ca9a996b8c6b08f0ad821ac2f56b64b35f
7
+ data.tar.gz: 7ca5624085d95696df0d2693e384031d7c82fc38372721fb5978c96e9e4d132abb71f9dde3f942d0f2abcf10d2b4f3f82f4fa5feab97396d23474f2ba42f9b17
data/bin/rbbt CHANGED
@@ -208,7 +208,7 @@ begin
208
208
  load dir[$command].find
209
209
  exit 0
210
210
  end
211
- when File.exists?($command)
211
+ when File.exist?($command)
212
212
  load $command
213
213
  exit 0
214
214
  else
data/bin/rbbt_query.rb CHANGED
@@ -8,7 +8,7 @@ options = SOPT.get("-i--identifiers*:-f--format*:-o--organism*:-p--persistence:-
8
8
 
9
9
  file = ARGV[0]
10
10
 
11
- if not File.exists? file
11
+ if not File.exist? file
12
12
  base, path = file.match(/([^.]*)\.(.*)/).values_at 1, 2
13
13
  require 'rbbt/sources/' << base.to_s.downcase
14
14
  klass = Misc.string2const base
@@ -128,13 +128,13 @@ module Association
128
128
  raise "Can only reverse a TokyoCabinet::BDB dataset at the time"
129
129
  end
130
130
 
131
- if File.exists?(reverse_filename)
131
+ if File.exist?(reverse_filename)
132
132
  new = Persist.open_tokyocabinet(reverse_filename, false, serializer, TokyoCabinet::BDB)
133
133
  raise "Index has no info: #{reverse_filename}" if new.key_field.nil?
134
134
  Association::Index.setup new
135
135
  new
136
136
  else
137
- FileUtils.mkdir_p File.dirname(reverse_filename) unless File.exists?(File.dirname(reverse_filename))
137
+ FileUtils.mkdir_p File.dirname(reverse_filename) unless File.exist?(File.dirname(reverse_filename))
138
138
 
139
139
  new = Persist.open_tokyocabinet(reverse_filename, true, serializer, TokyoCabinet::BDB)
140
140
 
@@ -161,7 +161,7 @@ module Association
161
161
  new
162
162
  rescue Exception
163
163
  Log.error "Deleting after error reversing database: #{ reverse_filename }"
164
- FileUtils.rm reverse_filename if File.exists? reverse_filename
164
+ FileUtils.rm reverse_filename if File.exist? reverse_filename
165
165
  raise $!
166
166
  end
167
167
  end
@@ -4,7 +4,7 @@ class FixWidthTable
4
4
  def initialize(filename, value_size = nil, range = nil, update = false, in_memory = true)
5
5
  @filename = filename
6
6
 
7
- if update or %w(memory stringio).include?(filename.to_s.downcase) or not File.exists?(filename)
7
+ if update or %w(memory stringio).include?(filename.to_s.downcase) or not File.exist?(filename)
8
8
  Log.debug "FixWidthTable create: #{ filename }"
9
9
  @value_size = value_size
10
10
  @range = range
@@ -15,8 +15,8 @@ class FixWidthTable
15
15
  @filename = :memory
16
16
  @file = StringIO.new
17
17
  else
18
- FileUtils.rm @filename if File.exists? @filename
19
- FileUtils.mkdir_p File.dirname(@filename) unless File.exists? @filename
18
+ FileUtils.rm @filename if File.exist? @filename
19
+ FileUtils.mkdir_p File.dirname(@filename) unless File.exist? @filename
20
20
  @file = File.open(@filename, 'wb')
21
21
  end
22
22
 
@@ -57,7 +57,7 @@ class FixWidthTable
57
57
  def self.get(filename, value_size = nil, range = nil, update = false)
58
58
  return self.new(filename, value_size, range, update) if filename == :memory
59
59
  case
60
- when (!File.exists?(filename) or update or not Persist::CONNECTIONS.include?(filename))
60
+ when (!File.exist?(filename) or update or not Persist::CONNECTIONS.include?(filename))
61
61
  Persist::CONNECTIONS[filename] = self.new(filename, value_size, range, update)
62
62
  end
63
63
 
@@ -129,7 +129,7 @@ module Persist
129
129
  end
130
130
  path = path.find if Path === path
131
131
 
132
- FileUtils.rm_rf path if File.exists? path
132
+ FileUtils.rm_rf path if File.exist? path
133
133
 
134
134
  Log.medium "TSV persistence creating: #{ path }"
135
135
 
@@ -149,7 +149,7 @@ module Persist
149
149
  yield data
150
150
  end
151
151
 
152
- FileUtils.mv data.persistence_path, path if File.exists? data.persistence_path and not File.exists? path
152
+ FileUtils.mv data.persistence_path, path if File.exist? data.persistence_path and not File.exist? path
153
153
  tsv = CONNECTIONS[path] = CONNECTIONS.delete tmp_path
154
154
  tsv.persistence_path = path
155
155
 
@@ -158,8 +158,8 @@ module Persist
158
158
  data
159
159
  rescue Exception
160
160
  Log.error "Captured error during persist_tsv. Erasing: #{path}"
161
- FileUtils.rm_rf tmp_path if tmp_path and File.exists? tmp_path
162
- FileUtils.rm_rf path if path and File.exists? path
161
+ FileUtils.rm_rf tmp_path if tmp_path and File.exist? tmp_path
162
+ FileUtils.rm_rf path if path and File.exist? path
163
163
  raise $!
164
164
  end
165
165
  end
@@ -6,7 +6,7 @@ module Persist
6
6
  include Persist::TSVAdapter
7
7
 
8
8
  def self.open(path, write)
9
- write = true unless File.exists? path
9
+ write = true unless File.exist? path
10
10
 
11
11
  database = CONNECTIONS[path] ||= begin
12
12
  file = File.open(path, 'w')
@@ -126,9 +126,9 @@ module Persist
126
126
 
127
127
 
128
128
  def self.open_cdb(path, write, serializer = nil)
129
- write = true unless File.exists? path
129
+ write = true unless File.exist? path
130
130
 
131
- FileUtils.mkdir_p File.dirname(path) unless File.exists?(File.dirname(path))
131
+ FileUtils.mkdir_p File.dirname(path) unless File.exist?(File.dirname(path))
132
132
 
133
133
  database = Persist::CDBAdapter.open(path, write)
134
134
 
@@ -25,7 +25,7 @@ module Persist
25
25
  end
26
26
 
27
27
  def metadata
28
- return {} unless File.exists? metadata_file
28
+ return {} unless File.exist? metadata_file
29
29
  Open.open(metadata_file, :mode => "rb") do |f|
30
30
  Marshal.load(f)
31
31
  end
@@ -96,7 +96,7 @@ module Persist
96
96
  end
97
97
 
98
98
  def self.open_fwt(path, value_size, range = false, serializer = nil, update = false, in_memory = false, &pos_function)
99
- FileUtils.mkdir_p File.dirname(path) unless File.exists?(File.dirname(path))
99
+ FileUtils.mkdir_p File.dirname(path) unless File.exist?(File.dirname(path))
100
100
 
101
101
  database = Persist::FWTAdapter.open(path, value_size, range, update, in_memory, &pos_function)
102
102
 
@@ -78,9 +78,9 @@ module Persist
78
78
 
79
79
 
80
80
  def self.open_kyotocabinet(path, write, serializer = nil, kyotocabinet_class= 'kch')
81
- write = true unless File.exists? path
81
+ write = true unless File.exist? path
82
82
 
83
- FileUtils.mkdir_p File.dirname(path) unless File.exists?(File.dirname(path))
83
+ FileUtils.mkdir_p File.dirname(path) unless File.exist?(File.dirname(path))
84
84
 
85
85
  database = Persist::KCAdapter.open(path, write, kyotocabinet_class)
86
86
 
@@ -104,9 +104,9 @@ module Persist
104
104
 
105
105
 
106
106
  def self.open_leveldb(path, write, serializer = nil)
107
- write = true unless File.exists? path
107
+ write = true unless File.exist? path
108
108
 
109
- FileUtils.mkdir_p File.dirname(path) unless File.exists?(File.dirname(path))
109
+ FileUtils.mkdir_p File.dirname(path) unless File.exist?(File.dirname(path))
110
110
 
111
111
  database = Persist::LevelDBAdapter.open(path, write)
112
112
 
@@ -45,9 +45,9 @@ module Persist
45
45
  end
46
46
 
47
47
  def self.open_lmdb(path, write, serializer = nil)
48
- write = true unless File.exists? path
48
+ write = true unless File.exist? path
49
49
 
50
- FileUtils.mkdir_p File.dirname(path) unless File.exists?(File.dirname(path))
50
+ FileUtils.mkdir_p File.dirname(path) unless File.exist?(File.dirname(path))
51
51
 
52
52
  database = Persist::LMDBAdapter.open(path, write)
53
53
 
@@ -25,7 +25,7 @@ module Persist
25
25
  end
26
26
 
27
27
  def metadata
28
- return {} unless File.exists? metadata_file
28
+ return {} unless File.exist? metadata_file
29
29
  Open.open(metadata_file, :mode => "rb") do |f|
30
30
  Marshal.load(f)
31
31
  end
@@ -96,7 +96,7 @@ module Persist
96
96
  end
97
97
 
98
98
  def self.open_pki(path, write, pattern, &pos_function)
99
- FileUtils.mkdir_p File.dirname(path) unless File.exists?(File.dirname(path))
99
+ FileUtils.mkdir_p File.dirname(path) unless File.exist?(File.dirname(path))
100
100
 
101
101
  database = Persist::PKIAdapter.open(path, write, pattern, &pos_function)
102
102
 
@@ -58,12 +58,12 @@ module Persist
58
58
  if shard == 'metadata'
59
59
  database ||= begin
60
60
  path = File.join(persistence_path, 'shard-' << shard.to_s)
61
- (writable or File.exists?(path)) ? Persist.open_database(path, writable, :clean, "HDB", @options) : nil
61
+ (writable or File.exist?(path)) ? Persist.open_database(path, writable, :clean, "HDB", @options) : nil
62
62
  end
63
63
  else
64
64
  database ||= begin
65
65
  path = File.join(persistence_path, 'shard-' << shard.to_s)
66
- (writable or File.exists?(path)) ? Persist.open_database(path, writable, :clean, db_type, @options) : nil
66
+ (writable or File.exist?(path)) ? Persist.open_database(path, writable, :clean, db_type, @options) : nil
67
67
  end
68
68
  end
69
69
  if database
@@ -243,9 +243,9 @@ module Persist
243
243
  end
244
244
 
245
245
  def self.open_sharder(path, write, serializer = nil, type = TokyoCabinet::HDB, options, &shard_function)
246
- write = true unless File.exists? path
246
+ write = true unless File.exist? path
247
247
 
248
- FileUtils.mkdir_p File.dirname(path) unless File.exists?(File.dirname(path))
248
+ FileUtils.mkdir_p File.dirname(path) unless File.exist?(File.dirname(path))
249
249
 
250
250
  database = Persist::SharderAdapter.open(path, write, type, options, &shard_function)
251
251
 
@@ -74,9 +74,9 @@ module Persist
74
74
  end
75
75
 
76
76
  def self.open_tokyocabinet(path, write, serializer = nil, tokyocabinet_class = TokyoCabinet::HDB)
77
- write = true unless File.exists? path
77
+ write = true unless File.exist? path
78
78
 
79
- FileUtils.mkdir_p File.dirname(path) unless File.exists?(File.dirname(path))
79
+ FileUtils.mkdir_p File.dirname(path) unless File.exist?(File.dirname(path))
80
80
 
81
81
  database = Persist::TCAdapter.open(path, write, serializer, tokyocabinet_class)
82
82
 
data/lib/rbbt/resource.rb CHANGED
@@ -92,7 +92,7 @@ module Resource
92
92
  when Net::HTTPRedirection, Net::HTTPFound
93
93
  location = response['location']
94
94
  Log.debug("Feching directory from: #{location}. Into: #{final_path}")
95
- FileUtils.mkdir_p final_path unless File.exists? final_path
95
+ FileUtils.mkdir_p final_path unless File.exist? final_path
96
96
  TmpFile.with_file do |tmp_dir|
97
97
  Misc.in_dir tmp_dir do
98
98
  CMD.cmd('tar xvfz -', :in => Open.open(location, :nocache => true))
@@ -110,7 +110,7 @@ module Resource
110
110
  rescue
111
111
  Log.warn "Could not retrieve (#{self.to_s}) #{ path } from #{ remote_server }"
112
112
  Log.error $!.message
113
- FileUtils.rm_rf final_path if File.exists? final_path
113
+ FileUtils.rm_rf final_path if File.exist? final_path
114
114
  return false
115
115
  end
116
116
  end
@@ -133,12 +133,12 @@ module Resource
133
133
  final_path = path
134
134
  end
135
135
 
136
- if not File.exists? final_path or force
136
+ if not File.exist? final_path or force
137
137
  Log.medium "Producing: #{ final_path }"
138
138
  lock_filename = Persist.persistence_path(final_path, {:dir => Resource.lock_dir})
139
139
  Misc.lock lock_filename do
140
- FileUtils.rm_rf final_path if force and File.exists? final_path
141
- if not File.exists? final_path or force
140
+ FileUtils.rm_rf final_path if force and File.exist? final_path
141
+ if not File.exist? final_path or force
142
142
  (remote_server and get_from_server(path, final_path)) or
143
143
  begin
144
144
  case type
@@ -192,7 +192,7 @@ source "$INSTALL_HELPER_FILE"
192
192
  raise "Could not produce #{ resource }. (#{ type }, #{ content })"
193
193
  end
194
194
  rescue
195
- FileUtils.rm_rf final_path if File.exists? final_path
195
+ FileUtils.rm_rf final_path if File.exist? final_path
196
196
  raise $!
197
197
  end
198
198
  end
@@ -85,7 +85,7 @@ module Path
85
85
  STANDARD_SEARCH = %w(current user local global lib cache bulk)
86
86
 
87
87
  search_path_file = File.join(ENV['HOME'], '.rbbt/etc/search_paths')
88
- if File.exists?(search_path_file)
88
+ if File.exist?(search_path_file)
89
89
  YAML.load(File.open(search_path_file)).each do |where, location|
90
90
  SEARCH_PATHS[where.to_sym] = location
91
91
  end
@@ -112,13 +112,13 @@ module Path
112
112
  w = w.to_sym
113
113
  next unless paths.include? w
114
114
  path = find(w, caller_lib, paths)
115
- return path if File.exists? path
115
+ return path if File.exist? path
116
116
  end
117
117
  (SEARCH_PATHS.keys - STANDARD_SEARCH).each do |w|
118
118
  w = w.to_sym
119
119
  next unless paths.include? w
120
120
  path = find(w, caller_lib, paths)
121
- return path if File.exists? path
121
+ return path if File.exist? path
122
122
  end
123
123
 
124
124
  if paths.include? :default
@@ -147,8 +147,8 @@ module Path
147
147
  sub('{PATH}', self).
148
148
  sub('{LIBDIR}', libdir) #, @pkgdir, @resource, @search_paths
149
149
 
150
- path = path + '.gz' if File.exists? path + '.gz'
151
- path = path + '.bgz' if File.exists? path + '.bgz'
150
+ path = path + '.gz' if File.exist? path + '.gz'
151
+ path = path + '.bgz' if File.exist? path + '.bgz'
152
152
 
153
153
  self.annotate path
154
154
  end
@@ -325,7 +325,7 @@ module Path
325
325
  relative_file = self.sub(/(.*\/)doc\//, '\1').sub(lib_dir + "/",'')
326
326
  file = File.join(lib_dir, relative_file)
327
327
 
328
- if not File.exists?(file)
328
+ if not File.exist?(file)
329
329
  file= Dir.glob(file.sub(/\.[^\.\/]+$/, '.*')).first
330
330
  end
331
331
 
@@ -333,7 +333,7 @@ module Path
333
333
  else
334
334
  relative_file = self.sub(/^doc\//, '\1')
335
335
 
336
- if not File.exists?(relative_file)
336
+ if not File.exist?(relative_file)
337
337
  relative_file = Dir.glob(relative_file.sub(/\.[^\.\/]+$/, '.*')).first
338
338
  end
339
339
 
@@ -9,12 +9,12 @@ module Path
9
9
  }.first.sub(/\.rb[^\w].*/,'.rb') if file.nil?
10
10
 
11
11
  file = File.expand_path(file)
12
- return Path.setup(file) if File.exists? File.join(file, relative_to)
12
+ return Path.setup(file) if File.exist? File.join(file, relative_to)
13
13
 
14
14
  while file != '/'
15
15
  dir = File.dirname file
16
16
 
17
- return Path.setup(dir) if File.exists? File.join(dir, relative_to)
17
+ return Path.setup(dir) if File.exist? File.join(dir, relative_to)
18
18
 
19
19
  file = File.dirname file
20
20
  end
@@ -38,12 +38,12 @@ module Resource
38
38
 
39
39
  Misc.env_add 'PATH', bin_dir
40
40
 
41
- FileUtils.mkdir_p opt_dir unless File.exists? opt_dir
41
+ FileUtils.mkdir_p opt_dir unless File.exist? opt_dir
42
42
 
43
43
  %w(.ld-paths .pkgconfig-paths .aclocal-paths .java-classpaths).each do |file|
44
44
  filename = File.join(opt_dir, file)
45
45
  begin
46
- FileUtils.touch filename unless File.exists? filename
46
+ FileUtils.touch filename unless File.exist? filename
47
47
  rescue
48
48
  Log.warn("Could not touch #{ filename }")
49
49
  end
@@ -52,25 +52,25 @@ module Resource
52
52
  Open.read(File.join opt_dir, '.ld-paths').split(/\n/).each do |line|
53
53
  Misc.env_add('LD_LIBRARY_PATH',line.chomp)
54
54
  Misc.env_add('LD_RUN_PATH',line.chomp)
55
- end if File.exists? File.join(opt_dir, '.ld-paths')
55
+ end if File.exist? File.join(opt_dir, '.ld-paths')
56
56
 
57
57
  Open.read(File.join opt_dir, '.pkgconfig-paths').split(/\n/).each do |line|
58
58
  Misc.env_add('PKG_CONFIG_PATH',line.chomp)
59
- end if File.exists? File.join(opt_dir, '.pkgconfig-paths')
59
+ end if File.exist? File.join(opt_dir, '.pkgconfig-paths')
60
60
 
61
61
  Open.read(File.join opt_dir, '.aclocal-paths').split(/\n/).each do |line|
62
62
  Misc.env_add('ACLOCAL_FLAGS', "-I#{File.join(opt_dir, line.chomp)}", ' ')
63
- end if File.exists? File.join(opt_dir, '.aclocal-paths')
63
+ end if File.exist? File.join(opt_dir, '.aclocal-paths')
64
64
 
65
65
  Open.read(File.join opt_dir, '.java-classpaths').split(/\n/).each do |line|
66
66
  Misc.env_add('CLASSPATH', "#{File.join(opt_dir,'java', 'lib', line.chomp)}")
67
- end if File.exists? File.join(opt_dir, '.java-classpaths')
67
+ end if File.exist? File.join(opt_dir, '.java-classpaths')
68
68
 
69
69
  Dir.glob(File.join opt_dir, 'jars', '*').each do |file|
70
70
  Misc.env_add('CLASSPATH', "#{File.expand_path(file)}")
71
71
  end
72
72
 
73
- if File.exists?(File.join(opt_dir, '.post_install')) and File.directory?(File.join(opt_dir, '.post_install'))
73
+ if File.exist?(File.join(opt_dir, '.post_install')) and File.directory?(File.join(opt_dir, '.post_install'))
74
74
  Dir.glob(File.join(opt_dir, '.post_install','*')).each do |file|
75
75
  begin
76
76
  begin
@@ -250,12 +250,16 @@ class WorkflowRESTClient
250
250
  sin.write c
251
251
  end
252
252
 
253
- post_thread = Thread.new do
253
+ post_thread = Thread.new(Thread.current) do |parent|
254
254
  bl = lambda do |rok|
255
- rok.read_body do |c,_a, _b|
256
- sin.write c
255
+ if Net::HTTPOK === rok
256
+ rok.read_body do |c,_a, _b|
257
+ sin.write c
258
+ end
259
+ sin.close
260
+ else
261
+ parent.raise "Error in RestClient: " << rok.message
257
262
  end
258
- sin.close
259
263
  end
260
264
 
261
265
  Log.debug{ "RestClient execute: #{ url } - #{Misc.fingerprint task_params}" }
@@ -9,7 +9,7 @@ module TSV
9
9
  sep = options[:sep]
10
10
 
11
11
  is = case
12
- when (String === input and not input.index("\n") and input.length < 250 and File.exists?(input))
12
+ when (String === input and not input.index("\n") and input.length < 250 and File.exist?(input))
13
13
  CMD.cmd("env LC_ALL=C sort -k1,1 -t'#{sep}' #{ input } | grep -v '^#{sep}' ", :pipe => true)
14
14
  when (String === input or StringIO === input)
15
15
  CMD.cmd("env LC_ALL=C sort -k1,1 -t'#{sep}' | grep -v '^#{sep}'", :in => input, :pipe => true)
@@ -68,7 +68,7 @@ module TSV
68
68
  sep = options[:sep] || "\t"
69
69
 
70
70
  case
71
- when (String === file1 and not file1 =~ /\n/ and file1.length < 250 and File.exists?(file1))
71
+ when (String === file1 and not file1 =~ /\n/ and file1.length < 250 and File.exist?(file1))
72
72
  size = CMD.cmd("wc -c '#{file1}'").read.to_f if monitor
73
73
  file1 = CMD.cmd("env LC_ALL=C sort -k1,1 -t'#{sep}' #{ file1 } | grep -v '^#{sep}' ", :pipe => true)
74
74
  when (String === file1 or StringIO === file1)
@@ -80,7 +80,7 @@ module TSV
80
80
  end
81
81
 
82
82
  case
83
- when (String === file2 and not file2 =~ /\n/ and file2.length < 250 and File.exists?(file2))
83
+ when (String === file2 and not file2 =~ /\n/ and file2.length < 250 and File.exist?(file2))
84
84
  file2 = CMD.cmd("env LC_ALL=C sort -k1,1 -t'#{sep}' #{ file2 } | grep -v '^#{sep}' ", :pipe => true)
85
85
  when (String === file2 or StringIO === file2)
86
86
  file2 = CMD.cmd("env LC_ALL=C sort -k1,1 -t'#{sep}' | grep -v '^#{sep}'", :in => file2, :pipe => true)
@@ -174,6 +174,23 @@ module TSV
174
174
  CMD.cmd("paste #{ files.collect{|f| "'#{f}'"} * " "} -d'#{delim}' |sed 's/#{delim}[^\\t]*//g'", :pipe => true)
175
175
  end
176
176
 
177
+ def merge_different_fields(other, options = {})
178
+ TmpFile.with_file do |output|
179
+ TSV.merge_different_fields(self, other, output, options)
180
+ tsv = TSV.open output, options
181
+ tsv.key_field = self.key_field unless self.key_field.nil?
182
+ tsv.fields = self.fields + other.fields unless self.fields.nil? or other.fields.nil?
183
+ tsv
184
+ end
185
+ end
186
+
187
+ def merge_zip(other)
188
+ other.each do |k,v|
189
+ self.zip_new k, v
190
+ end
191
+ end
192
+
193
+
177
194
  def attach(other, options = {})
178
195
  options = Misc.add_defaults options, :in_namespace => false, :persist_input => true
179
196
  fields, one2one, complete = Misc.process_options options, :fields, :one2one, :complete
@@ -257,20 +274,5 @@ module TSV
257
274
  self.fields.each_with_index{|field,i| detached_fields << i if file_fields.include? field.fullname}
258
275
  reorder :key, detached_fields
259
276
  end
260
-
261
- def merge_different_fields(other, options = {})
262
- TmpFile.with_file do |output|
263
- TSV.merge_different_fields(self, other, output, options)
264
- tsv = TSV.open output, options
265
- tsv.key_field = self.key_field unless self.key_field.nil?
266
- tsv.fields = self.fields + other.fields unless self.fields.nil? or other.fields.nil?
267
- tsv
268
- end
269
- end
270
-
271
- def merge_zip(other)
272
- other.each do |k,v|
273
- self.zip_new k, v
274
- end
275
- end
277
+
276
278
  end