rbbt-util 5.5.33 → 5.5.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/rbbt/util/misc.rb +43 -12
- data/lib/rbbt/util/semaphore.rb +5 -2
- data/share/rbbt_commands/tsv/info +6 -2
- data/share/rbbt_commands/workflow/install +6 -1
- data/share/rbbt_commands/workflow/monitor +17 -13
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzliNGFhOTdhZmJjMzhmZDJhNzU4ZDUwZWQzNjgxNjE3NzQ3MTkyZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Y2M1ZTJmMjJkZjE4NGQxM2NhMGYyNDBlZjA0ODYxMWJhMGJjMWI3ZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODQ1OWQ0NmUwOTM1MDRjNTk5MGY5MTUxZjcyNTJjNzQ1N2M4NzMxNmVmMmVm
|
10
|
+
ZGI3NzFmN2I1MzliYmM4ZTE0NjZhZjJlMWUyYTVhZDZhZGQxN2IxMTIxZjkx
|
11
|
+
MzUyOWQwNTg4MmIxMzQyYjIxNTJmYjhiNGNjZDZiNzc3Y2RjODc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjBiYWZiNmYyYThiY2Q0YTM4NmE4NWZlZDRmMzI2YTM4ZmIwMmI4MmY3ZmY0
|
14
|
+
NWJhNDI0OTQxYTM4Y2UzOGYwZjY1N2M3ODAwNTk4MzgxMGMxOTY3NmQ0NzVi
|
15
|
+
OWM2Y2I1YzU3MjUwNWFlMWUyZmMyZTEzMGIyODg1YTg3YzZmYzI=
|
data/lib/rbbt/util/misc.rb
CHANGED
@@ -84,37 +84,68 @@ module Misc
|
|
84
84
|
[colors, used]
|
85
85
|
end
|
86
86
|
|
87
|
+
#def self.collapse_ranges_old(ranges)
|
88
|
+
# processed = []
|
89
|
+
# last = nil
|
90
|
+
# ranges.sort_by{|range| range.begin }.each do |range|
|
91
|
+
# rbegin = range.begin
|
92
|
+
# rend = range.end
|
93
|
+
# if last.nil? or rbegin > last
|
94
|
+
# processed << range
|
95
|
+
# last = rend
|
96
|
+
# else
|
97
|
+
# new_processed = []
|
98
|
+
# processed.each do |processed_range|
|
99
|
+
# if processed_range.end < rbegin
|
100
|
+
# new_processed << processed_range
|
101
|
+
# else
|
102
|
+
# eend = [rend, processed_range.end].max
|
103
|
+
# new_processed << (processed_range.begin..eend)
|
104
|
+
# break
|
105
|
+
# end
|
106
|
+
# end
|
107
|
+
# processed = new_processed
|
108
|
+
# last = rend if rend > last
|
109
|
+
# end
|
110
|
+
# end
|
111
|
+
#
|
112
|
+
# processed
|
113
|
+
#end
|
114
|
+
|
87
115
|
def self.collapse_ranges(ranges)
|
88
116
|
processed = []
|
89
117
|
last = nil
|
118
|
+
final = []
|
90
119
|
ranges.sort_by{|range| range.begin }.each do |range|
|
91
|
-
|
92
|
-
|
93
|
-
|
120
|
+
rbegin = range.begin
|
121
|
+
rend = range.end
|
122
|
+
if last.nil? or rbegin > last
|
123
|
+
processed << [rbegin, rend]
|
124
|
+
last = rend
|
94
125
|
else
|
95
|
-
|
96
|
-
processed.each do |
|
97
|
-
if
|
98
|
-
|
126
|
+
new_processed = []
|
127
|
+
processed.each do |pbegin,pend|
|
128
|
+
if pend < rbegin
|
129
|
+
final << [pbegin, pend]
|
99
130
|
else
|
100
|
-
eend = [
|
101
|
-
new_processed <<
|
131
|
+
eend = [rend, pend].max
|
132
|
+
new_processed << [pbegin, eend]
|
102
133
|
break
|
103
134
|
end
|
104
135
|
end
|
105
136
|
processed = new_processed
|
106
|
-
last =
|
137
|
+
last = rend if rend > last
|
107
138
|
end
|
108
139
|
end
|
109
140
|
|
110
|
-
processed
|
141
|
+
final.concat processed
|
142
|
+
final.collect{|b,e| (b..e)}
|
111
143
|
end
|
112
144
|
|
113
145
|
def self.total_length(ranges)
|
114
146
|
Misc.collapse_ranges(ranges).inject(0) do |total,range| total += range.end - range.begin + 1 end
|
115
147
|
end
|
116
148
|
|
117
|
-
|
118
149
|
def self.random_sample_in_range(total, size)
|
119
150
|
p = Set.new
|
120
151
|
|
data/lib/rbbt/util/semaphore.rb
CHANGED
@@ -66,8 +66,11 @@ void post_semaphore(char* name){
|
|
66
66
|
pids = elems.collect do |elem|
|
67
67
|
Process.fork do
|
68
68
|
RbbtSemaphore.wait_semaphore(file)
|
69
|
-
|
70
|
-
|
69
|
+
begin
|
70
|
+
yield elem
|
71
|
+
ensure
|
72
|
+
RbbtSemaphore.post_semaphore(file)
|
73
|
+
end
|
71
74
|
end
|
72
75
|
end
|
73
76
|
pids.each do |pid| Process.waitpid pid end
|
@@ -3,13 +3,17 @@
|
|
3
3
|
require 'rbbt-util'
|
4
4
|
require 'rbbt/util/simpleopt'
|
5
5
|
|
6
|
-
options = SOPT.get("-
|
6
|
+
options = SOPT.get("-tch--tokyocabinet:-tcb--tokyocabinet_bd")
|
7
7
|
|
8
8
|
file = ARGV.shift
|
9
9
|
|
10
|
-
|
10
|
+
case
|
11
|
+
when options[:tokyocabinet]
|
11
12
|
tsv = Persist.open_tokyocabinet(file, false)
|
12
13
|
puts tsv.summary
|
14
|
+
when options[:tokyocabinet_bd]
|
15
|
+
tsv = Persist.open_tokyocabinet(file, false, nil, TokyoCabinet::BDB)
|
16
|
+
puts tsv.summary
|
13
17
|
else
|
14
18
|
header = TSV.parse_header(Open.open(file))
|
15
19
|
|
@@ -14,7 +14,12 @@ workflow_dir = Rbbt.etc.workflow_dir.exists? ? Rbbt.etc.workflow_dir.read.strip
|
|
14
14
|
FileUtils.mkdir_p workflow_dir unless File.exists? workflow_dir
|
15
15
|
|
16
16
|
Misc.in_dir(workflow_dir) do
|
17
|
-
|
17
|
+
case
|
18
|
+
when File.exists? Misc.snake_case(workflow)
|
19
|
+
Misc.in_dir(Misc.snake_case(workflow)) do
|
20
|
+
`git pull`
|
21
|
+
end
|
22
|
+
when File.exists? workflow
|
18
23
|
Misc.in_dir(workflow) do
|
19
24
|
`git pull`
|
20
25
|
end
|
@@ -6,7 +6,7 @@ require 'rbbt/util/simpleopt'
|
|
6
6
|
require 'rbbt/workflow/step'
|
7
7
|
require 'rbbt/util/misc'
|
8
8
|
|
9
|
-
options = SOPT.get("-l--list:-z--zombies:-e--errors:-c--clean:-n--name:-a--all:-w--wipe:-f--file*:-q--quick")
|
9
|
+
options = SOPT.get("-l--list:-z--zombies:-e--errors:-c--clean:-n--name:-a--all:-w--wipe:-f--file*:-q--quick:-d--directory*")
|
10
10
|
|
11
11
|
YAML::ENGINE.yamler = 'syck' if defined? YAML::ENGINE and YAML::ENGINE.respond_to? :yamler
|
12
12
|
|
@@ -105,22 +105,26 @@ def clean_jobs(options)
|
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
|
-
|
109
|
-
|
110
108
|
$name = options.delete :name
|
111
109
|
$quick = options.delete :quick
|
112
|
-
|
113
|
-
|
114
|
-
if options[:
|
115
|
-
|
110
|
+
old_dir = Dir.pwd
|
111
|
+
begin
|
112
|
+
Dir.chdir options[:directory] if options[:directory]
|
113
|
+
case
|
114
|
+
when (options[:clean] and not options[:list])
|
115
|
+
if options[:file]
|
116
|
+
remove_job options[:file]
|
117
|
+
else
|
118
|
+
clean_jobs options
|
119
|
+
end
|
116
120
|
else
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
if options[:file]
|
121
|
-
info = Step::INFO_SERIALIAZER.load(Open.read(options[:file], :mode => 'rb'))
|
122
|
-
print_job options[:file], info
|
121
|
+
if options[:file]
|
122
|
+
info = Step::INFO_SERIALIAZER.load(Open.read(options[:file], :mode => 'rb'))
|
123
|
+
print_job options[:file], info
|
123
124
|
else
|
124
125
|
list_jobs options
|
125
126
|
end
|
127
|
+
end
|
128
|
+
ensure
|
129
|
+
Dir.chdir old_dir
|
126
130
|
end
|
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.5.
|
4
|
+
version: 5.5.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: 2013-11-
|
11
|
+
date: 2013-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -204,7 +204,8 @@ files:
|
|
204
204
|
- test/test_helper.rb
|
205
205
|
- test/test_rbbt.rb
|
206
206
|
homepage: http://github.com/mikisvaz/rbbt-util
|
207
|
-
licenses:
|
207
|
+
licenses:
|
208
|
+
- MIT
|
208
209
|
metadata: {}
|
209
210
|
post_install_message:
|
210
211
|
rdoc_options: []
|