rbbt-util 5.28.10 → 5.29.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,6 +17,7 @@ $ rbbt workflow info <job-result>
17
17
  -a--all Print all info entries
18
18
  -r--recursive Print recursive input values
19
19
  -o--original Print original object
20
+ -w--width* Screen width
20
21
  EOF
21
22
 
22
23
  SOPT.usage if options[:help]
@@ -24,6 +25,7 @@ SOPT.usage if options[:help]
24
25
  file = ARGV.shift
25
26
  all = options.delete :all
26
27
  recursive = options.delete :recursive
28
+ width = (options.delete(:width) || 80).to_i
27
29
 
28
30
  def get_step(file)
29
31
  file = file.sub(/\.(info|files)/,'')
@@ -86,6 +88,7 @@ pid = info[:pid]
86
88
  exception = info[:exception]
87
89
  rest = info.keys - [:inputs, :dependencies, :status, :time_elapsed, :messages, :backtrace, :exception, :pid, :archived_info]
88
90
 
91
+
89
92
  puts Log.color(:magenta, "File") << ": " << step.path
90
93
  puts Log.color(:magenta, "Status") << ": " << status_msg(status) << ((step.aborted? || step.error?) && step.recoverable_error? ? " (recoverable)" : "" ) << (step.dirty? ? " (dirty)" : "")
91
94
  puts Log.color(:magenta, "Pid") << ": " << pid_msg(pid, status.to_s == "done")
@@ -96,14 +99,14 @@ if inputs and inputs.any?
96
99
  inputs.each do |input,value|
97
100
  case value
98
101
  when nil
99
- puts Misc.format_definition_list_item(" " + input.to_s, 'nil', 80, 20, :blue)
102
+ puts Misc.format_definition_list_item(" " + input.to_s, 'nil', width, 20, :blue)
100
103
  when Array
101
- puts Misc.format_definition_list_item(" " + input.to_s, (value.length > 6 ? value[0..5]*"\n" << "\n" << "..." : value * "\n" ), 80, 20, :blue)
104
+ puts Misc.format_definition_list_item(" " + input.to_s, (value.length > 6 ? value[0..5]*"\n" << "\n" << "..." : value * "\n" ), width, 20, :blue)
102
105
  when TrueClass, FalseClass
103
- puts Misc.format_definition_list_item(" " + input.to_s, value.to_s, 80, 20, :blue)
106
+ puts Misc.format_definition_list_item(" " + input.to_s, value.to_s, width, 20, :blue)
104
107
  else
105
108
  text = value.to_s.split("\n")[0..5].compact * "\n\n"
106
- puts Misc.format_definition_list_item(" " + input.to_s, text, 80, 20, :blue)
109
+ puts Misc.format_definition_list_item(" " + input.to_s, text, width, 20, :blue)
107
110
  end
108
111
  end
109
112
  end
@@ -162,16 +165,16 @@ if recursive
162
165
  inputs.each do |input,value|
163
166
  case value
164
167
  when nil
165
- puts Misc.format_definition_list_item(" " << input.to_s, 'nil', 80, 20, :blue)
168
+ puts Misc.format_definition_list_item(" " << input.to_s, 'nil', width, 20, :blue)
166
169
  when Array
167
- puts Misc.format_definition_list_item(" " << input.to_s, (value.length > 6 ? (value[0..5])*"\n\n" << "\n\n" << "..." : value * "\n\n" ), 80, 20, :blue).gsub("\n\n","\n")
170
+ puts Misc.format_definition_list_item(" " << input.to_s, (value.length > 6 ? (value[0..5])*"\n\n" << "\n\n" << "..." : value * "\n\n" ), width, 20, :blue).gsub("\n\n","\n")
168
171
  when TrueClass, FalseClass
169
- puts Misc.format_definition_list_item(" " << input.to_s, value.to_s, 80, 20, :blue)
172
+ puts Misc.format_definition_list_item(" " << input.to_s, value.to_s, width, 20, :blue)
170
173
  else
171
- lines = value.to_s.split("\n").collect{|l| l.length >= 60 ? l[0..45] + " ..." : l }
174
+ lines = value.to_s.split("\n").collect{|l| l.length >= width - 5 ? l[0..width - 5] + " ..." : l }
172
175
  text = lines[0..5].compact * "\n\n"
173
176
  text << "\n\n...\n\n" if lines.length > 6
174
- puts Misc.format_definition_list_item(" " << input.to_s, text, 80, 20, :blue).gsub("\n\n","\n")
177
+ puts Misc.format_definition_list_item(" " << input.to_s, text, width, 20, :blue).gsub("\n\n","\n")
175
178
  end
176
179
  end
177
180
  end
@@ -24,6 +24,7 @@ $ rbbt workflow prov <job-result>
24
24
  -i--inputs* List of inputs to print
25
25
  -if--info_fields* List of info fields to print
26
26
  -t--touch Update modification times to be consistent
27
+ -e--expand_repeats Show all the dependency tree even if reapeated dependencies have already been seen before
27
28
  EOF
28
29
 
29
30
  SOPT.usage if options[:help]
@@ -130,6 +131,6 @@ if options[:plot]
130
131
  end
131
132
 
132
133
  else
133
- puts Step.prov_report(step).strip
134
+ puts Step.prov_report(step, 0, nil, [], options[:expand_repeats]).strip
134
135
  end
135
136
 
@@ -156,6 +156,15 @@ for this dependency
156
156
  Open.read(file).reverse
157
157
  end
158
158
 
159
+ task :create_file => :text do |file|
160
+ Open.write(file('a'), "A")
161
+ Open.write(file('b'), "B")
162
+ "DONE"
163
+ end
164
+
165
+ dep_task :reverse_step_file, TestWF, :reverse_file do |jobname, options, dependencies|
166
+ dep = dependencies.flatten.first
167
+ end
159
168
 
160
169
  end
161
170
 
@@ -377,9 +386,9 @@ class TestWorkflow < Test::Unit::TestCase
377
386
  job.run
378
387
  Misc.with_env "RBBT_UPDATE", 'true' do
379
388
  assert job.checks.select{|d| d.task_name.to_s == "t1" }.any?
380
- job = TestWF.job(:t3)
381
- job.step(:t1).clean
382
- assert job.checks.select{|d| d.task_name.to_s == "t1" }.empty?
389
+ #job = TestWF.job(:t3)
390
+ #job.step(:t1).clean
391
+ #assert job.checks.select{|d| d.task_name.to_s == "t1" }.empty?
383
392
  job = TestWF.job(:t3).recursive_clean
384
393
  job.run
385
394
  assert job.checks.select{|d| d.task_name.to_s == "t1" }.any?
@@ -418,7 +427,7 @@ class TestWorkflow < Test::Unit::TestCase
418
427
  TmpFile.with_file do |dir|
419
428
  Path.setup(dir)
420
429
  Step.save_job_inputs(job, dir)
421
- assert_equal Dir.glob(dir + "/*"), [dir.file.find + '.read']
430
+ assert_equal Dir.glob(dir + "/*"), [dir.file.find + '.yaml']
422
431
  inputs = Workflow.load_inputs(dir, [:file], :file => :file)
423
432
  assert_equal inputs, {:file => 'code'}
424
433
  end
@@ -440,4 +449,27 @@ class TestWorkflow < Test::Unit::TestCase
440
449
  end
441
450
  end
442
451
  end
452
+
453
+ def test_input_step_file_check
454
+ job = TestWF.job(:t3).recursive_clean
455
+ job.run
456
+ Misc.with_env "RBBT_UPDATE", 'true' do
457
+ assert job.checks.select{|d| d.task_name.to_s == "t1" }.any?
458
+ #job = TestWF.job(:t3)
459
+ #job.step(:t1).clean
460
+ #assert job.checks.select{|d| d.task_name.to_s == "t1" }.empty?
461
+ job = TestWF.job(:t3).recursive_clean
462
+ job.run
463
+ assert job.checks.select{|d| d.task_name.to_s == "t1" }.any?
464
+ job = TestWF.job(:t3)
465
+ sleep 1
466
+ Open.touch job.step(:t1).path
467
+ Misc.with_env "RBBT_UPDATE", "false" do
468
+ assert job.updated?
469
+ end
470
+ Misc.with_env "RBBT_UPDATE", "true" do
471
+ assert ! job.updated?
472
+ end
473
+ end
474
+ end
443
475
  end
@@ -566,7 +566,7 @@ row2,CC
566
566
  tsv3.keys.each{|k| tsv3[k] = nil if tsv3[k] == ""}
567
567
  end
568
568
 
569
- assert_equal tsv1.attach(tsv2, :complete => true).attach(tsv3, :complete => true)["row1"], [nil, "B", nil]
569
+ assert_equal [nil, "B", nil], tsv1.attach(tsv2, :complete => true).attach(tsv3, :complete => true)["row1"]
570
570
  end
571
571
 
572
572
  def test_attach_index_both_non_key
@@ -597,10 +597,10 @@ A Id3
597
597
 
598
598
  tsv1 = tsv2 = nil
599
599
 
600
- tsv1 = Rbbt.tmp.test.test1.data.tsv :double, :sep => /\s+/
601
- tsv2 = Rbbt.tmp.test.test2.data.tsv :double, :sep => /\s+/
600
+ tsv1 = Rbbt.tmp.test.test1.data.produce(true).tsv :double, :sep => /\s+/
601
+ tsv2 = Rbbt.tmp.test.test2.data.produce(true).tsv :double, :sep => /\s+/
602
602
 
603
- tsv2.identifiers = Rbbt.tmp.test.test2.identifiers.produce.find #.to_s
603
+ tsv2.identifiers = Rbbt.tmp.test.test2.identifiers.produce(true).produce.find #.to_s
604
604
 
605
605
  tsv1.attach tsv2, :fields => ["ValueE"] #, :persist_input => true
606
606
  Log.tsv tsv1
@@ -627,12 +627,92 @@ E B
627
627
 
628
628
  tsv1 = tsv2 = nil
629
629
 
630
- tsv1 = Rbbt.tmp.test.test1.data.tsv :double, :sep => /\s+/
631
- tsv2 = Rbbt.tmp.test.test2.data.tsv :double, :sep => /\s+/
630
+ tsv1 = Rbbt.tmp.test.test1.data.produce(true).tsv :double, :sep => /\s+/
631
+ tsv2 = Rbbt.tmp.test.test2.data.produce(true).tsv :double, :sep => /\s+/
632
632
 
633
633
  tsv1.attach tsv2, :fields => ["ValueE"] #, :persist_input => true
634
634
  Log.tsv tsv1
635
635
 
636
636
  end
637
+
638
+ def test_attach_complete
639
+ content1 =<<-EOF
640
+ #: :sep=/\\s+/
641
+ #Id ValueA
642
+ row1 a|aa|aaa
643
+ row2 A
644
+ EOF
645
+
646
+ content2 =<<-EOF
647
+ #: :sep=/\\s+/
648
+ #Id ValueB
649
+ row1 b
650
+ row3 C
651
+ EOF
652
+ Rbbt.claim Rbbt.tmp.test.test1.data, :string, content1
653
+ Rbbt.claim Rbbt.tmp.test.test2.data, :string, content2
654
+
655
+ tsv1 = tsv2 = nil
656
+
657
+ tsv1 = Rbbt.tmp.test.test1.data.produce(true).tsv :double, :sep => /\s+/
658
+ tsv2 = Rbbt.tmp.test.test2.data.produce(true).tsv :double, :sep => /\s+/
659
+
660
+ tsv1.attach tsv2, :complete => true
661
+ assert_equal [[], ["C"]], tsv1["row3"]
662
+
663
+ tsv1 = Rbbt.tmp.test.test1.data.produce(true).tsv :double, :sep => /\s+/
664
+ tsv2 = Rbbt.tmp.test.test2.data.produce(true).tsv :double, :sep => /\s+/
665
+
666
+ ppp tsv1.attach tsv2, :complete => ["AA"]
667
+ tsv1.attach tsv2, :complete => ["AA"]
668
+ assert_equal [["AA"], ["C"]], tsv1["row3"]
669
+ end
670
+
671
+ def test_attach_complete_identifiers
672
+ content1 =<<-EOF
673
+ #: :sep=/\\s+/
674
+ #Id ValueA
675
+ row1 a|aa|aaa
676
+ row2 A
677
+ EOF
678
+
679
+ content2 =<<-EOF
680
+ #: :sep=/\\s+/
681
+ #Id2 ValueB
682
+ ROW_1 b
683
+ ROW_2 C
684
+ EOF
685
+
686
+ identifiers =<<-EOF
687
+ #: :sep=/\\s+/
688
+ #Id Id2
689
+ row1 ROW_1
690
+ row2 ROW_2
691
+ row3 ROW_3
692
+ EOF
693
+ Rbbt.claim Rbbt.tmp.test.test1.data, :string, content1
694
+ Rbbt.claim Rbbt.tmp.test.test2.data, :string, content2
695
+ Rbbt.claim Rbbt.tmp.test.identifiers.data, :string, identifiers
696
+
697
+ tsv1 = tsv2 = nil
698
+
699
+ tsv1 = Rbbt.tmp.test.test1.data.produce(true).tsv :double, :sep => /\s+/
700
+ tsv2 = Rbbt.tmp.test.test2.data.produce(true).tsv :double, :sep => /\s+/
701
+ ids = Rbbt.tmp.test.identifiers.data.produce(true).tsv :double, :sep => /\s+/
702
+
703
+ tsv1.identifiers = ids
704
+
705
+ tsv1.attach tsv2
706
+ assert_equal [["A"], ["C"]], tsv1["row2"]
707
+
708
+ tsv1 = Rbbt.tmp.test.test1.data.produce(true).tsv :double, :sep => /\s+/
709
+ tsv2 = Rbbt.tmp.test.test2.data.produce(true).tsv :double, :sep => /\s+/
710
+ ids = Rbbt.tmp.test.identifiers.data.produce(true).tsv :double, :sep => /\s+/
711
+
712
+ tsv1.identifiers = ids
713
+
714
+ tsv1.attach tsv2, :complete => true
715
+ assert_equal [["A"], ["C"]], tsv1["row2"]
716
+ end
637
717
  end
638
718
 
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.28.10
4
+ version: 5.29.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-17 00:00:00.000000000 Z
11
+ date: 2021-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -211,6 +211,8 @@ files:
211
211
  - lib/rbbt/entity/identifiers.rb
212
212
  - lib/rbbt/fix_width_table.rb
213
213
  - lib/rbbt/hpc.rb
214
+ - lib/rbbt/hpc/orchestrate.rb
215
+ - lib/rbbt/hpc/slurm.rb
214
216
  - lib/rbbt/knowledge_base.rb
215
217
  - lib/rbbt/knowledge_base/enrichment.rb
216
218
  - lib/rbbt/knowledge_base/entity.rb
@@ -376,6 +378,9 @@ files:
376
378
  - share/rbbt_commands/resource/produce
377
379
  - share/rbbt_commands/resource/read
378
380
  - share/rbbt_commands/rsync
381
+ - share/rbbt_commands/slurm/list
382
+ - share/rbbt_commands/slurm/orchestrate
383
+ - share/rbbt_commands/slurm/task
379
384
  - share/rbbt_commands/stat/abs
380
385
  - share/rbbt_commands/stat/boxplot
381
386
  - share/rbbt_commands/stat/compare_lists
@@ -430,7 +435,6 @@ files:
430
435
  - share/rbbt_commands/workflow/remote/list
431
436
  - share/rbbt_commands/workflow/remote/remove
432
437
  - share/rbbt_commands/workflow/server
433
- - share/rbbt_commands/workflow/slurm
434
438
  - share/rbbt_commands/workflow/task
435
439
  - share/rbbt_commands/workflow/trace
436
440
  - share/unicorn.rb