rbbt-util 5.23.32 → 5.23.34

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b174e2fa2cbfa2a1548380710082c35a98e5d58e
4
- data.tar.gz: 74066e9c626e51bd9c625ed741cff14a177a9ea2
3
+ metadata.gz: bb30046034803f9f8fa05cc114a25b41fbff60bb
4
+ data.tar.gz: 27fdf9b8cee90400d5929d3282fbcb4d7bf3d638
5
5
  SHA512:
6
- metadata.gz: 0f5757b41d2605ff9da15ec39716ab47170675380a9f83e7ed729d50e93f29d74af3f49d6b6dd25a8376922b993216aed0d3db1802339ee793560e21dcde7ee5
7
- data.tar.gz: 80e8eab073f7704254b0358381bca50f0d2694b23e9af7e550ed3b75f511702e3a1a36a23f71bb27d2e84b6373379993bdbd8dd00ef40ab34ed95ce5a1fd46d8
6
+ metadata.gz: 1482ca219811bca9d8f6aad254cb8d3429c4506d3941a6b3e666ac4b92cea248a319e87a6280566466cfc4b1adeb397c96d8852ffc754d0b613a3f1b5a4ce503
7
+ data.tar.gz: 3d56953e218a3c0bcd256d35e053d27fe0f3ce2bdc410462a47ec93815c88d125107e85603c29824e2897f6f15639ef3ed088736dd13dac61254e3ad0650828f
data/lib/rbbt/util/log.rb CHANGED
@@ -114,7 +114,7 @@ module Log
114
114
  HIGHLIGHT = "\033[1m"
115
115
 
116
116
  def self.uncolor(str)
117
- Term::ANSIColor.uncolor(str)
117
+ "" << Term::ANSIColor.uncolor(str)
118
118
  end
119
119
 
120
120
  def self.reset_color
data/lib/rbbt/workflow.rb CHANGED
@@ -487,13 +487,12 @@ module Workflow
487
487
  Rbbt.var.jobs[end_part].find
488
488
  end
489
489
 
490
-
491
490
  def self.__load_step(path)
492
491
  step = Step.new path
493
492
  relocated = false
494
493
  step.dependencies = (step.info[:dependencies] || []).collect do |task,name,dep_path|
495
494
  if Open.exists?(dep_path)
496
- Workflow.load_step dep_path
495
+ Workflow._load_step dep_path
497
496
  else
498
497
  new_path = relocate(path, dep_path)
499
498
  relocated = true if Open.exists?(new_path)
@@ -502,7 +501,42 @@ module Workflow
502
501
  end
503
502
  step.relocated = relocated
504
503
  step.load_inputs_from_info
504
+ step
505
+ end
506
+
507
+ def self.fast_load_step(path)
508
+ return load_step(path)
509
+ step = Step.new path
510
+ step.dependencies = nil
511
+ class << step
512
+ def dependencies
513
+ @dependencies ||= (self.info[:dependencies] || []).collect do |task,name,dep_path|
514
+ dep = if Open.exists?(dep_path)
515
+ relocate = false
516
+ Workflow.fast_load_step dep_path
517
+ else
518
+ new_path = Workflow.relocate(path, dep_path)
519
+ relocated = true if Open.exists?(new_path)
520
+ Workflow.fast_load_step new_path
521
+ end
522
+ dep.relocated = relocated
523
+ dep
524
+ end
525
+ @dependencies
526
+ end
527
+
528
+ def inputs
529
+ self.load_inputs_from_info unless @inputs
530
+ @inputs
531
+ end
505
532
 
533
+ def dirty?
534
+ false
535
+ end
536
+ def updated?
537
+ true
538
+ end
539
+ end
506
540
  step
507
541
  end
508
542
 
@@ -529,13 +563,20 @@ module Workflow
529
563
  task = task_for path
530
564
  return remote_tasks[task].load_id(id) if remote_tasks and remote_tasks.include? task
531
565
  return Workflow.load_step path
532
- #step = Step.new path, tasks[task.to_sym]
533
- #step.load_inputs_from_info
534
- #set_step_dependencies(step)
535
- #step
536
566
  end
537
567
 
538
568
 
569
+ def fast_load_id(id)
570
+ path = if Path === workdir
571
+ workdir[id].find
572
+ else
573
+ File.join(workdir, id)
574
+ end
575
+ task = task_for path
576
+ return remote_tasks[task].load_id(id) if remote_tasks and remote_tasks.include? task
577
+ return Workflow.fast_load_step path
578
+ end
579
+
539
580
  def load_name(task, name)
540
581
  return remote_tasks[task].load_step(path) if remote_tasks and remote_tasks.include? task
541
582
  task = tasks[task.to_sym] if String === task or Symbol === task
@@ -222,6 +222,7 @@ class Step
222
222
  end
223
223
 
224
224
  def message(message)
225
+ message = Log.uncolor(message)
225
226
  set_info(:messages, (messages || []) << message)
226
227
  end
227
228
 
@@ -456,12 +457,13 @@ class Step
456
457
  end
457
458
 
458
459
  def nopid?
459
- pid = info[:pid]
460
- pid.nil? && ! (status.nil? || status.nil? || status == :aborted || status == :done || status == :error)
460
+ pid = info[:pid] || Open.exists?(pid_file)
461
+ ! pid && ! (status.nil? || status == :aborted || status == :done || status == :error)
461
462
  end
462
463
 
463
464
  def aborted?
464
- status == :aborted || (status != :noinfo && nopid?)
465
+ status = self.status
466
+ status == :aborted || ((status != :noinfo && status != :setup && status != :noinfo) && nopid?)
465
467
  end
466
468
 
467
469
  # {{{ INFO
@@ -58,6 +58,9 @@ class Step
58
58
  @info_mutex = Mutex.new
59
59
  @inputs = inputs
60
60
  NamedArray.setup @inputs, task.inputs.collect{|s| s.to_s} if task and task.respond_to? :inputs and task.inputs
61
+ if Open.exists?(info_file) and (info[:path] != path)
62
+ @relocated = true
63
+ end
61
64
  end
62
65
 
63
66
  def workflow
@@ -315,7 +315,6 @@ class Step
315
315
  canfail_paths += dep.canfail_paths
316
316
  next unless ComputeDependency === dep && dep.canfail?
317
317
  canfail_paths << dep.path
318
- iii dep.path
319
318
  canfail_paths += dep.rec_dependencies.collect{|d| d.path }
320
319
  end
321
320
  canfail_paths
@@ -218,6 +218,7 @@ class Step
218
218
  merge_info({
219
219
  :issued => (issue_time = Time.now),
220
220
  :name => name,
221
+ :pid => Process.pid.to_s,
221
222
  :clean_name => clean_name,
222
223
  :workflow => (@workflow || @task.workflow).to_s,
223
224
  :task_name => @task.name,
@@ -636,7 +637,7 @@ class Step
636
637
  end
637
638
 
638
639
  def soft_grace
639
- until done? or Open.exist?(info_file)
640
+ until done? or (Open.exist?(info_file) && info[:status] != :noinfo)
640
641
  sleep 1
641
642
  end
642
643
  self
data/share/Rlib/util.R CHANGED
@@ -711,6 +711,13 @@ rbbt.plot.venn <- function(data, a, ...) {
711
711
  return(out)
712
712
  }
713
713
 
714
+ rbbt.plot.pca <- function(data, center = TRUE, scale. = TRUE, ...) {
715
+ rbbt.require('vqv/ggbiplot')
716
+ data <- rbbt.impute(data)
717
+ pca <- prcomp(data, center=center, scale.=scale.)
718
+ ggbiplot(pca, ...)
719
+ }
720
+
714
721
 
715
722
  rbbt.plot.text_scatter <- function(formula, data) {
716
723
  plot(formula, data=data, cex = 0)
@@ -94,14 +94,15 @@ TSV.traverse jobs, :_bar => "Checking job status" do |file,i|
94
94
  {:status => :noinfo}
95
95
  end
96
96
 
97
- pid = info[:pid]
97
+ done = Open.exists?(file)
98
+ pid = info[:pid] || (Open.exists?(file + '.pid') && Open.read(file + '.pid')) unless done
98
99
 
99
100
  status = info[:status].to_s
100
101
  if status != "noinfo"
101
- status = :missing if status == "done" and not File.exist? file
102
+ status = :missing if status == "done" and not done
102
103
  status = :nopid if status != "done" and pid.nil?
103
104
  status = :dead if status != "done" and pid and not Misc.pid_exists?(pid)
104
- status = :sync if status != "done" and File.exist? file
105
+ status = :sync if status != "done" and done
105
106
  end
106
107
 
107
108
  status = :dirty if info[:status].to_s == "done" and dirty and Workflow.load_step(file).dirty?
@@ -126,6 +127,7 @@ TSV.traverse jobs, :_bar => "Checking job status" do |file,i|
126
127
 
127
128
  if (force and status !~ /done/) or
128
129
  status =~ /\b(old|dirty|nopid|error|missing|aborted|dead|sync)$/ or
130
+ (status == "noinfo" and not done) or
129
131
  status == ""
130
132
 
131
133
  puts " Removing #{ file } - #{status}"
@@ -399,7 +399,7 @@ begin
399
399
 
400
400
  if options.delete(:printpath)
401
401
  job.join
402
- raise job.messages.last if job.error? or job.aborted?
402
+ raise job.messages.last if job.error? or job.aborted? and job.messages
403
403
  if Open.remote? job.path
404
404
  puts job.url + Log.color(:blue, "?_format=raw")
405
405
  else
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.23.32
4
+ version: 5.23.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-23 00:00:00.000000000 Z
11
+ date: 2018-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake