rbbt-util 5.9.5 → 5.9.6

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: 485bac99517b86329c91a69142f4b38c8405cc8f
4
- data.tar.gz: f8f7fee0f9f2ceccc294431d31d1f9e14983b903
3
+ metadata.gz: 00a031a315a0dd1407718fda1f7bac80a7188feb
4
+ data.tar.gz: a3c428d4dc3898f04842ce9f71bc272a1650525c
5
5
  SHA512:
6
- metadata.gz: 2b3897bc88326b032537c45579f6d6236da05b47683fd4d802cd61032c4d12c7cf35ee35898d05e19bb8a63d505c495a282206ab55a0740461b630c4cc303f92
7
- data.tar.gz: 15680565e5cf2e61dc0770ae9b8949d890a5c13dd27a93e60eabad2c4ad3a18754056f145edc72763630d573119f9b64b6773a8bb9de9397c565bc5f4e7acc6b
6
+ metadata.gz: e69d574630af05b253b9e87a99ddab01d89809e94f8ac4034d8d2b0ef88255d9cd0334680d5c7828eea1069f850554be66ee3e452972e62373ddb6745cebe5a1
7
+ data.tar.gz: 2f69eb892223f7512bd94e92d7bc5d59ba7974dbdf677d9c1ae7d9e0ba2d3c0fa28084643319f8bea8f5f50ceaa2c86d55255da95183c2c0ce93e036619de559
data/bin/rbbt CHANGED
@@ -2,9 +2,6 @@
2
2
 
3
3
  require 'rbbt'
4
4
  require 'rbbt/util/simpleopt'
5
- require 'highline'
6
-
7
- Log.tty_size = HighLine::SystemExtensions.terminal_size.first
8
5
 
9
6
  options = SOPT.setup <<EOF
10
7
  Ruby bioinformatics toolkit
data/lib/rbbt/util/log.rb CHANGED
@@ -16,6 +16,8 @@ module Log
16
16
  attr_accessor :logfile, :severity, :nocolor, :tty_size
17
17
  end
18
18
  self.nocolor = ENV["RBBT_NOCOLOR"] == 'true'
19
+ require 'highline'
20
+ self.tty_size = HighLine::SystemExtensions.terminal_size.first
19
21
 
20
22
 
21
23
  def self.with_severity(level)
@@ -54,7 +56,11 @@ module Log
54
56
  end
55
57
 
56
58
  def self.return_line
57
- "\033[1A"
59
+ nocolor ? "" : "\033[1A"
60
+ end
61
+
62
+ def self.clear_line(out = STDOUT)
63
+ out.puts Log.return_line << " " * Log.tty_size << Log.return_line unless nocolor
58
64
  end
59
65
 
60
66
  def self.highlight(str = nil)
@@ -16,8 +16,8 @@ class Hash
16
16
  end
17
17
  end
18
18
 
19
- class ParameterException < StandardError; end
20
- class FieldNotFoundError < StandardError;end
19
+ class ParameterException < Exception; end
20
+ class FieldNotFoundError < Exception;end
21
21
  class Aborted < Exception; end
22
22
  class TryAgain < Exception; end
23
23
  class ClosedStream < Exception; end
@@ -173,34 +173,6 @@ module Misc
173
173
  [colors, used]
174
174
  end
175
175
 
176
- #def self.collapse_ranges_old(ranges)
177
- # processed = []
178
- # last = nil
179
- # ranges.sort_by{|range| range.begin }.each do |range|
180
- # rbegin = range.begin
181
- # rend = range.end
182
- # if last.nil? or rbegin > last
183
- # processed << range
184
- # last = rend
185
- # else
186
- # new_processed = []
187
- # processed.each do |processed_range|
188
- # if processed_range.end < rbegin
189
- # new_processed << processed_range
190
- # else
191
- # eend = [rend, processed_range.end].max
192
- # new_processed << (processed_range.begin..eend)
193
- # break
194
- # end
195
- # end
196
- # processed = new_processed
197
- # last = rend if rend > last
198
- # end
199
- # end
200
- #
201
- # processed
202
- #end
203
-
204
176
  def self.collapse_ranges(ranges)
205
177
  processed = []
206
178
  last = nil
@@ -232,8 +232,6 @@ class Step
232
232
  else
233
233
  Log.medium "Aborting #{path}: #{ @pid }"
234
234
  begin
235
- Process.kill("TERM", @pid)
236
- sleep 1
237
235
  Process.kill("KILL", @pid)
238
236
  Process.waitpid @pid
239
237
  rescue Exception
@@ -284,9 +282,9 @@ class Step
284
282
  # placed. In that case, do not consider its dependencies
285
283
  return [] if self.done? and not Open.exists? self.info_file
286
284
 
287
- @dependencies.collect{|step|
285
+ dependencies.collect{|step|
288
286
  step.rec_dependencies
289
- }.flatten.concat @dependencies
287
+ }.flatten.concat dependencies
290
288
  end
291
289
 
292
290
  def recursive_clean
@@ -250,7 +250,7 @@ begin
250
250
  exit 0
251
251
  end
252
252
 
253
- if do_exec
253
+ if do_exec or (job.respond_to?(:is_exec) and job.is_exec)
254
254
  res = job.exec
255
255
  case
256
256
  when Array === res
@@ -283,36 +283,6 @@ begin
283
283
 
284
284
  job.fork
285
285
 
286
- puts
287
- puts
288
- size = Log.tty_size
289
- size = 100 if size.nil?
290
-
291
- while not job.done?
292
- message = (job.messages and job.messages.any?) ? job.messages.last.strip : "no message"
293
- status = job.status || "no status"
294
- if job.info and job.info.include? :issued
295
- issued = job.info[:issued]
296
- issued = Time.parse(issued) unless Time === issued
297
- time = Time.now - issued
298
- end
299
- puts Log.return_line << " " * size << Log.return_line
300
- puts Log.return_line << " " * size << Log.return_line
301
- puts "#{Log.color :blue, job.path}"
302
- puts "Waiting on #{Log.color :blue, job.info[:pid] || job.pid} (#{time ? time.to_i : '?'} sec. ago) " << [Log.color(:cyan, status.to_s),message.strip].compact*" "
303
- sleep 2
304
- end
305
- raise job.messages.last if job.error?
306
-
307
- if job.info and job.info.include? :issued
308
- issued = job.info[:issued]
309
- issued = Time.parse(issued) unless Time === issued
310
- time = Time.now - issued
311
- end
312
- puts Log.return_line << " " * size << Log.return_line
313
- puts Log.return_line << " " * size << Log.return_line
314
- puts job.path
315
- exit 0
316
286
  else
317
287
  job.run(true)
318
288
  res = job
@@ -337,6 +307,47 @@ begin
337
307
  else
338
308
  Log.low "Job name: #{job.name}"
339
309
  end
310
+
311
+ if do_fork
312
+ puts
313
+ space = 1
314
+ Log.tty_size ||= 100
315
+
316
+ while not job.done?
317
+ message = (job.messages and job.messages.any?) ? job.messages.last.strip : "no message"
318
+ status = job.status || "no status"
319
+ if job.info and job.info.include? :issued
320
+ issued = job.info[:issued]
321
+ issued = Time.parse(issued) unless Time === issued
322
+ time = Time.now - issued
323
+ end
324
+
325
+
326
+ space.times do
327
+ Log.clear_line
328
+ end
329
+
330
+ puts "#{Log.color :blue, job.path}"
331
+ str = "Waiting on #{Log.color :blue, job.info[:pid] || job.pid} (#{time ? time.to_i : '?'} sec. ago) " << [Log.color(:cyan, status.to_s),message.strip].compact*" "
332
+ puts Misc.format_paragraph str, Log.tty_size
333
+
334
+ space = 2 + Log.uncolor(str).length / Log.tty_size
335
+ sleep 2
336
+ end
337
+ raise job.messages.last if job.error?
338
+
339
+ if job.info and job.info.include? :issued
340
+ issued = job.info[:issued]
341
+ issued = Time.parse(issued) unless Time === issued
342
+ time = Time.now - issued
343
+ end
344
+
345
+ space.times do
346
+ Log.clear_line
347
+ end
348
+ out.puts job.path
349
+ exit 0
350
+ end
340
351
  rescue ParameterException
341
352
  SOPT.delete_inputs(workflow.rec_inputs(task.name))
342
353
  usage(workflow, task, $!)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.9.5
4
+ version: 5.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez