rbbt-util 5.33.20 → 5.34.1

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
  SHA256:
3
- metadata.gz: 87f3c2c6750c49c90cce3fd4f8e24d270d471538f65374e388ec6ac83bf7134c
4
- data.tar.gz: fb4909c5ef2ab2a751271f1f49db270ea1f91c4a84ed26504ddebebf23aae75a
3
+ metadata.gz: dce81f37830228a43c702909b856ebf661002d17b49614d67b6c04e16d339d4b
4
+ data.tar.gz: d7cb5ef82e50da2287c4bf9cf3912d66e36c27bb72a1c1c702d86cf7d1e8df78
5
5
  SHA512:
6
- metadata.gz: 39ca36640608cc39e279e0402f55749d5851b3713ee1fabe1eac414ae8ec5bf8f3a7741a71551142aede5ba27c9143b54972720fe321c563ac47b5db4a868da6
7
- data.tar.gz: a7f50b0bb6829c781c9b8081b63464997f1d2aa1e8ab68871af6d13799867f4f136385b704e1bf5badce2ed03171db421ba5f9452d491b02c96aa8fe36d8eeea
6
+ metadata.gz: fd9ad6b40180ef8cdc5a8e8335f291e557543f14cdd0cbc6760e7dd6f1327a5a73b5be92b1c037ccd46bca8596c86e7bf6eb7221989e9edac52ad34e81ad4e45
7
+ data.tar.gz: 72798bb53863c93aa768edc6c523d34e682dc374ebf4fe0307590faddb9022237a49f0556de364e7139345b35504b6d19b9c134abf8d0ae751a38c1d2c0331f7
@@ -31,6 +31,7 @@ module HPC
31
31
  options.delete "detach"
32
32
  options.delete "jobname"
33
33
  options.delete "load_inputs"
34
+ options.delete "provenance"
34
35
 
35
36
  Log.high "Prepare for exec"
36
37
  prepare_for_execution(job)
@@ -56,7 +56,8 @@ module Misc
56
56
  ":" << obj.to_s
57
57
  when String
58
58
  if obj.length > 100
59
- "'" << obj.slice(0,30) << "<...#{obj.length}...>" << obj.slice(-10,30)<< "'"
59
+ digest = Misc.digest(obj)
60
+ "'" << obj.slice(0,30) << "<...#{obj.length} - #{digest[0..4]}...>" << obj.slice(-10,30)<< "'"
60
61
  else
61
62
  "'" << obj << "'"
62
63
  end
@@ -92,7 +92,6 @@ module Misc
92
92
  ConcurrentStream.setup sout, :pids => [pid]
93
93
  else
94
94
 
95
-
96
95
  ConcurrentStream.setup sin, :pair => sout
97
96
  ConcurrentStream.setup sout, :pair => sin
98
97
 
@@ -782,4 +781,13 @@ module Misc
782
781
  ConcurrentStream.setup out, :threads => monitor_thread
783
782
  end
784
783
 
784
+ def self.open_gz_pipe
785
+ sout = Misc.open_pipe do |sin|
786
+ yield sin
787
+ sin.close
788
+ end
789
+
790
+ Open.gzip(sout)
791
+ end
792
+
785
793
  end
@@ -678,7 +678,7 @@ module Open
678
678
  if Open.exists? notification_file
679
679
  key = Open.read(notification_file).strip
680
680
  key = nil if key.empty?
681
- if key.include?("@")
681
+ if key && key.include?("@")
682
682
  to = from = key
683
683
  subject = "Wrote " << file
684
684
  message = "Content attached"
@@ -748,6 +748,7 @@ module Open
748
748
  raise $!
749
749
  end
750
750
  content.close
751
+ content.join if content.respond_to? :join
751
752
  end
752
753
  end
753
754
 
data/lib/rbbt/workflow.rb CHANGED
@@ -414,7 +414,7 @@ module Workflow
414
414
  end if task.required_inputs
415
415
 
416
416
  if missing_inputs.length == 1
417
- raise ParameterException, "Input #{missing_inputs.first} is required but was not provided or is nil"
417
+ raise ParameterException, "Input '#{missing_inputs.first}' is required but was not provided or is nil"
418
418
  end
419
419
 
420
420
  if missing_inputs.length > 1
@@ -542,8 +542,17 @@ module Workflow
542
542
  step_path = step_path.call if Proc === step_path
543
543
  persist = input_values.nil? ? false : true
544
544
  persist = false
545
+
546
+ if ! (Path === step_path ? step_path.find : File.exists?(step_path)) && step_path.split("/").length == 3 && File.exists?(new_path = Rbbt.var.jobs[step_path].find)
547
+ step_path = new_path
548
+ end
549
+
545
550
  key = Path === step_path ? step_path.find : step_path
546
551
 
552
+ if ! File.exists?(step_path) && step_path.split("/").length == 3 && File.exists?(new_path = Rbbt.var.jobs[step_path].find)
553
+ step_path = new_path
554
+ end
555
+
547
556
  step = Step.new step_path, task, input_values, dependencies
548
557
 
549
558
  set_step_dependencies(step) unless dependencies
@@ -703,7 +712,15 @@ module Workflow
703
712
 
704
713
  def self.load_step(path)
705
714
  path = Path.setup(path.dup) unless Path === path
706
- path = path.find
715
+
716
+ if ! (Path === path ? path.exists? : File.exists?(path)) && path.split("/").length == 3
717
+ new_path = Rbbt.var.jobs[path]
718
+ if new_path.exists? || new_path.set_extension('info').exists?
719
+ path = new_path
720
+ end
721
+ end
722
+
723
+ path = path.find if Path === path
707
724
 
708
725
  begin
709
726
  _load_step(path)
@@ -356,5 +356,5 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
356
356
  end
357
357
 
358
358
  puts
359
- puts "Found #{count} jobs"
359
+ puts Log.color :clear, "Found #{count} jobs"
360
360
 
@@ -356,5 +356,5 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
356
356
  end
357
357
 
358
358
  puts
359
- puts "Found #{count} jobs"
359
+ puts Log.color :clear, "Found #{count} jobs"
360
360
 
@@ -356,5 +356,5 @@ workdir.glob("**/command.batch").sort_by{|f| File.mtime(f)}.each do |fcmd|
356
356
  end
357
357
 
358
358
  puts
359
- puts "Found #{count} jobs"
359
+ puts Log.color :clear, "Found #{count} jobs"
360
360
 
@@ -36,7 +36,7 @@ file = ARGV.shift
36
36
 
37
37
  $seen = []
38
38
  def get_step(file)
39
- file = File.expand_path(file)
39
+ file = File.expand_path(file) if File.exists?(file)
40
40
  file = file.sub(/\.(info|files)$/,'')
41
41
  $seen << file
42
42
  Workflow.load_step file
@@ -469,7 +469,7 @@ begin
469
469
  end
470
470
 
471
471
  if options.delete(:printpath)
472
- job.join
472
+ job.join if job.running?
473
473
  raise job.messages.last if (job.error? || job.aborted?) && job.messages
474
474
  if Open.remote? job.path
475
475
  puts job.url + Log.color(:blue, "?_format=raw")
@@ -284,4 +284,41 @@ line4
284
284
  end
285
285
  end
286
286
  end
287
+
288
+ def test_gz_pipe
289
+ text =<<-EOF
290
+ line1
291
+ line2
292
+ line3
293
+ line4
294
+ EOF
295
+
296
+ TmpFile.with_file nil, :extension => 'txt.gz' do |file|
297
+ sout = Misc.open_gz_pipe do |sin|
298
+ text.split("\n").each do |line|
299
+ sin.puts line
300
+ end
301
+ end
302
+
303
+ Open.mkdir File.basename(file)
304
+ thr1 = Misc.consume_stream(sout, true, file)
305
+ thr1.join
306
+ assert Open.gzip?(file)
307
+ assert_equal text, Open.read(file)
308
+ end
309
+ end
310
+
311
+ def test_open_pipe_error
312
+ sout = Misc.open_pipe do |sin|
313
+ 10.times do |i|
314
+ sin.puts "line #{i}"
315
+ end
316
+ raise
317
+ end
318
+
319
+ TmpFile.with_file do |tmp|
320
+ #Misc.consume_stream(sout, false, tmp)
321
+ Open.write(tmp, sout)
322
+ end
323
+ end
287
324
  end
@@ -186,6 +186,6 @@ class TestOpen < Test::Unit::TestCase
186
186
  end
187
187
 
188
188
  end
189
-
189
+
190
190
  end
191
191
 
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.33.20
4
+ version: 5.34.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: 2022-05-30 00:00:00.000000000 Z
11
+ date: 2022-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake