rbbt-util 5.27.9 → 5.28.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/annotations/util.rb +2 -2
- data/lib/rbbt/resource/path.rb +4 -4
- data/lib/rbbt/resource/util.rb +4 -3
- data/lib/rbbt/tsv/parallel/traverse.rb +2 -0
- data/lib/rbbt/util/misc.rb +1 -0
- data/lib/rbbt/util/misc/development.rb +16 -4
- data/lib/rbbt/util/misc/inspect.rb +1 -1
- data/lib/rbbt/util/open.rb +6 -1
- data/share/rbbt_commands/app/start +8 -0
- data/share/rbbt_commands/tsv/uncollapse +0 -1
- data/share/rbbt_commands/workflow/server +4 -8
- data/share/workflow_config.ru +5 -1
- data/test/rbbt/test_resource.rb +3 -3
- data/test/rbbt/util/test_misc.rb +25 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fae2c7a6c6a64059a77fd43d0edf3c6b3a5835cea870b58ddf07a8e24deec18c
|
4
|
+
data.tar.gz: d92b6fbda894fd77dd5e69b391a1087e3401864f20a7422f92443fd01cc6b03b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d3e95466731e2b8f1af738d6d689b81145d462a3b2cc6b755533f1b7bccd413bc76e2af80f053e8685afe527a582905271b2661f132b271a53491b60f024005
|
7
|
+
data.tar.gz: ca684d7817e67d324ae6767c8b802e2065855915cc541db5f65b070ef47d7862e98b0acc4e991cef38bd65e97ac1224bdcd03e1e4cc1211e937023bd1757e4a8
|
@@ -74,7 +74,7 @@ module Annotated
|
|
74
74
|
|
75
75
|
object = case
|
76
76
|
when literal_pos
|
77
|
-
values[literal_pos]
|
77
|
+
values[literal_pos].tap{|o| o.force_encoding(Encoding.default_external)}
|
78
78
|
else
|
79
79
|
id.dup
|
80
80
|
end
|
@@ -119,7 +119,7 @@ module Annotated
|
|
119
119
|
fields = AnnotatedArray === annotations ? annotations.annotations : annotations.compact.first.annotations
|
120
120
|
fields << :annotation_types
|
121
121
|
|
122
|
-
when (fields == [:literal] and
|
122
|
+
when (fields == [:literal] and ! annotations.compact.empty?)
|
123
123
|
fields << :literal
|
124
124
|
|
125
125
|
when (fields == [:all] && Annotated === annotations)
|
data/lib/rbbt/resource/path.rb
CHANGED
@@ -13,7 +13,7 @@ module Path
|
|
13
13
|
string.resource = resource
|
14
14
|
string.search_paths = search_paths
|
15
15
|
string.search_order = search_order
|
16
|
-
string.libdir = libdir || Path.caller_lib_dir
|
16
|
+
string.libdir = libdir || Path.caller_lib_dir
|
17
17
|
string
|
18
18
|
end
|
19
19
|
|
@@ -52,11 +52,11 @@ module Path
|
|
52
52
|
def join(name)
|
53
53
|
raise "Invalid path: #{ self }" if self.nil?
|
54
54
|
new = if self.empty?
|
55
|
-
self.annotate name.to_s.dup
|
55
|
+
self.annotate name.to_s.dup.chomp
|
56
56
|
else
|
57
|
-
self.annotate File.join(self, name.to_s)
|
57
|
+
self.annotate File.join(self, name.to_s.chomp)
|
58
58
|
end
|
59
|
-
new.original = File.join(self.original, name.to_s) if self.original
|
59
|
+
new.original = File.join(self.original, name.to_s.chomp) if self.original
|
60
60
|
new
|
61
61
|
end
|
62
62
|
|
data/lib/rbbt/resource/util.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Path
|
2
2
|
|
3
|
-
def self.caller_lib_dir(file = nil, relative_to = 'lib')
|
3
|
+
def self.caller_lib_dir(file = nil, relative_to = ['lib', 'bin'])
|
4
4
|
file = caller.reject{|l|
|
5
5
|
l =~ /rbbt\/(?:resource\.rb|workflow\.rb)/ or
|
6
6
|
l =~ /rbbt\/resource\/path\.rb/ or
|
@@ -9,13 +9,14 @@ module Path
|
|
9
9
|
l =~ /progress-monitor\.rb/
|
10
10
|
}.first.sub(/\.rb[^\w].*/,'.rb') if file.nil?
|
11
11
|
|
12
|
+
relative_to = [relative_to] unless Array === relative_to
|
12
13
|
file = File.expand_path(file)
|
13
|
-
return Path.setup(file) if File.exist? File.join(file,
|
14
|
+
return Path.setup(file) if relative_to.select{|d| File.exist? File.join(file, d)}.any?
|
14
15
|
|
15
16
|
while file != '/'
|
16
17
|
dir = File.dirname file
|
17
18
|
|
18
|
-
return dir if File.exist? File.join(dir,
|
19
|
+
return dir if relative_to.select{|d| File.exist? File.join(dir, d)}.any?
|
19
20
|
|
20
21
|
file = File.dirname file
|
21
22
|
end
|
data/lib/rbbt/util/misc.rb
CHANGED
@@ -292,14 +292,21 @@ def self.add_libdir(dir=nil)
|
|
292
292
|
end
|
293
293
|
end
|
294
294
|
|
295
|
-
def self.bootstrap(elems, num =
|
295
|
+
def self.bootstrap(elems, num = nil, options = {}, &block)
|
296
296
|
IndiferentHash.setup options
|
297
|
+
|
298
|
+
num = Rbbt::Config.get :cpus, :default_bootstrap_cpus, :bootstrap_cpus if num == :current || num == nil if defined?(Rbbt::Config)
|
297
299
|
num = :current if num.nil?
|
298
300
|
cpus = case num
|
299
301
|
when :current
|
300
|
-
|
301
|
-
|
302
|
-
|
302
|
+
n = Etc.nprocessors
|
303
|
+
n = elems.length / 2 if n > elems.length/2
|
304
|
+
|
305
|
+
if $BOOTSTRAPPED_CURRENT && $BOOTSTRAPPED_CURRENT + n > Etc.nprocessors
|
306
|
+
1
|
307
|
+
else
|
308
|
+
n
|
309
|
+
end
|
303
310
|
when String
|
304
311
|
num.to_i
|
305
312
|
when Integer
|
@@ -318,7 +325,12 @@ def self.add_libdir(dir=nil)
|
|
318
325
|
respawn = options[:respawn] and options[:cpus] and options[:cpus].to_i > 1
|
319
326
|
|
320
327
|
index = (0..elems.length-1).to_a.collect{|v| v.to_s }
|
328
|
+
|
321
329
|
TSV.traverse index, options do |pos|
|
330
|
+
if num == :current
|
331
|
+
$BOOTSTRAPPED_CURRENT ||= n
|
332
|
+
$BOOTSTRAPPED_CURRENT += 0
|
333
|
+
end
|
322
334
|
elem = elems[pos.to_i]
|
323
335
|
elems.annotate elem if elems.respond_to? :annotate
|
324
336
|
res = begin
|
@@ -401,7 +401,7 @@ module Misc
|
|
401
401
|
|
402
402
|
def self.scan_version_text(text, cmd = nil)
|
403
403
|
cmd = "NOCMDGIVE" if cmd.nil? || cmd.empty?
|
404
|
-
m = text.match(/(?:version.*?|#{cmd}.*?|v)((?:\d+\.)*\d+(?:-[a-z_]+)?)/i)
|
404
|
+
m = text.match(/(?:version.*?|#{cmd}.*?|#{cmd.split(/[-_.]/).first}.*?|v)((?:\d+\.)*\d+(?:-[a-z_]+)?)/i)
|
405
405
|
return nil if m.nil?
|
406
406
|
m[1]
|
407
407
|
end
|
data/lib/rbbt/util/open.rb
CHANGED
@@ -94,7 +94,8 @@ module Open
|
|
94
94
|
end
|
95
95
|
|
96
96
|
begin
|
97
|
-
wget_options = options.
|
97
|
+
wget_options = options.dup
|
98
|
+
wget_options = wget_options.merge( '-O' => '-') unless options.include?('--output-document')
|
98
99
|
wget_options[:pipe] = pipe unless pipe.nil?
|
99
100
|
wget_options[:stderr] = stderr unless stderr.nil?
|
100
101
|
|
@@ -824,4 +825,8 @@ module Open
|
|
824
825
|
def self.broken_link?(path)
|
825
826
|
File.symlink?(path) && ! File.exists?(File.readlink(path))
|
826
827
|
end
|
828
|
+
|
829
|
+
def self.download(url, path)
|
830
|
+
Open.wget(url, "--output-document" => path)
|
831
|
+
end
|
827
832
|
end
|
@@ -15,6 +15,7 @@ $ rbbt app start [options]
|
|
15
15
|
-Ho--Host* Host name
|
16
16
|
-B--Bind* Bind IP
|
17
17
|
-p--port* TCP port
|
18
|
+
-w--workers* Number of workers for cluster mode (puma)
|
18
19
|
-s--server* Server type: thin, webrick, unicorn, etc
|
19
20
|
-f--finder Start server with finder functionality
|
20
21
|
-fs--file_server Activate file serving for resources
|
@@ -84,6 +85,12 @@ Misc.in_dir(app_dir) do
|
|
84
85
|
end
|
85
86
|
end
|
86
87
|
|
88
|
+
fixed_options = {}
|
89
|
+
options.each do |k,v| fixed_options[k.to_sym] = v end
|
90
|
+
options = fixed_options
|
91
|
+
|
92
|
+
options[:workers] = options[:workers].to_i if options[:workers]
|
93
|
+
|
87
94
|
case server
|
88
95
|
when 'passenger'
|
89
96
|
system ENV, "env RBBT_LOG=0 passenger start -R '#{config_ru_file}' -p #{options[:Port] || "2887"}"
|
@@ -91,6 +98,7 @@ Misc.in_dir(app_dir) do
|
|
91
98
|
system ENV, "puma '#{config_ru_file}' -p #{options[:Port] || "2887"} -w 3 -t 8:32 --preload"
|
92
99
|
else
|
93
100
|
options[:config] = config_ru_file
|
101
|
+
options[:threads] = "8:8"
|
94
102
|
Rack::Server.start(options)
|
95
103
|
end
|
96
104
|
end
|
@@ -123,15 +123,11 @@ TmpFile.with_file do |app_dir|
|
|
123
123
|
else
|
124
124
|
options[:config] = config_ru_file
|
125
125
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
clean_options[k.to_sym] = v
|
130
|
-
rescue
|
131
|
-
end
|
132
|
-
end
|
126
|
+
fixed_options = {}
|
127
|
+
options.each do |k,v| fixed_options[k.to_sym] = v end
|
128
|
+
options = fixed_options
|
133
129
|
|
134
|
-
Rack::Server.start(
|
130
|
+
Rack::Server.start(options)
|
135
131
|
end
|
136
132
|
end
|
137
133
|
end
|
data/share/workflow_config.ru
CHANGED
@@ -43,7 +43,11 @@ etc_dir = Rbbt.etc
|
|
43
43
|
load_file etc_dir['app.d/pre.rb'].find
|
44
44
|
|
45
45
|
app.get '/' do
|
46
|
-
|
46
|
+
begin
|
47
|
+
template_render('main', params, 'main', :cache_type => :asynchronous)
|
48
|
+
rescue TemplateMissing
|
49
|
+
redirect to(File.join('/', wf.to_s))
|
50
|
+
end
|
47
51
|
end
|
48
52
|
|
49
53
|
#{{{ BASE
|
data/test/rbbt/test_resource.rb
CHANGED
@@ -69,11 +69,11 @@ class TestTSV < Test::Unit::TestCase
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def test_libdir
|
72
|
-
assert File.exist?
|
73
|
-
assert File.exist?
|
72
|
+
assert File.exist?(TestResource[].share.Rlib["util.R"].find(:lib))
|
73
|
+
assert File.exist?(TestResource[].share.Rlib["util.R"].find)
|
74
74
|
end
|
75
75
|
|
76
|
-
def
|
76
|
+
def __test_server
|
77
77
|
require 'rbbt/sources/organism'
|
78
78
|
TmpFile.with_file :extension => 'gz' do |tmp|
|
79
79
|
Organism.get_from_server("Hsa/b37/known_sites/dbsnp_138.vcf.gz", tmp, 'http://rbbt.bsc.es')
|
data/test/rbbt/util/test_misc.rb
CHANGED
@@ -690,5 +690,30 @@ Written by Mike Haertel and others, see |
|
690
690
|
EOF
|
691
691
|
assert_equal "3.1", Misc.scan_version_text(txt, "grep")
|
692
692
|
end
|
693
|
+
|
694
|
+
def test_bootstrap_current_only_once
|
695
|
+
|
696
|
+
|
697
|
+
max = Etc.nprocessors * 10
|
698
|
+
TmpFile.with_file do |f|
|
699
|
+
RbbtSemaphore.with_semaphore(1) do |sem|
|
700
|
+
Misc.bootstrap (1..max).to_a do
|
701
|
+
Open.open(f, :mode => 'a') do |sin|
|
702
|
+
sin.puts Process.pid.to_s
|
703
|
+
end
|
704
|
+
Misc.bootstrap (1..10).to_a do
|
705
|
+
RbbtSemaphore.synchronize(sem) do
|
706
|
+
Open.open(f, :mode => 'a') do |sin|
|
707
|
+
sin.puts [Process.ppid.to_s, Process.pid.to_s] * ":"
|
708
|
+
end
|
709
|
+
end
|
710
|
+
end
|
711
|
+
end
|
712
|
+
end
|
713
|
+
assert_equal max * 10 + max, Open.read(f).split("\n").length
|
714
|
+
assert_equal Etc.nprocessors * 2, Open.read(f).split("\n").uniq.length
|
715
|
+
end
|
716
|
+
|
717
|
+
end
|
693
718
|
end
|
694
719
|
|
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.
|
4
|
+
version: 5.28.0
|
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-07-
|
11
|
+
date: 2020-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|