rbbt-util 5.21.64 → 5.21.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rbbt/rest/client/step.rb +1 -0
- data/lib/rbbt/tsv.rb +2 -0
- data/lib/rbbt/tsv/attach.rb +2 -2
- data/lib/rbbt/util/misc/annotated_module.rb +58 -0
- data/lib/rbbt/workflow/annotate.rb +0 -31
- data/lib/rbbt/workflow/definition.rb +9 -6
- data/lib/rbbt/workflow/examples.rb +1 -1
- data/share/config.ru +4 -0
- data/test/rbbt/persist/test_tsv.rb +13 -0
- data/test/rbbt/persist/tsv/test_tokyocabinet.rb +1 -1
- data/test/rbbt/test_tsv.rb +1 -1
- data/test/rbbt/util/test_misc.rb +4 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ff21babc0504e17df0c48429ee4db81aebbac9a
|
4
|
+
data.tar.gz: 0c6ba9a55916f59bdc371510a696ec2a49582cbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b34c51ad0a84893b4d809234d99e935a2d58c88fe89e04b76f9dee30c49d39f04844a7ad02dea30ac18bd98be611e226f500e2bb95248778f4689e437620a873
|
7
|
+
data.tar.gz: 50cb3f8b234f73a38bc406a2d328fafd2b87b83e9121e39a3885b52727c8649bcb0c456ae334f5a617343e595532d685aa567ba462942cfdc39e46c855fce68d
|
@@ -22,6 +22,7 @@ class WorkflowRESTClient
|
|
22
22
|
|
23
23
|
def initialize(base_url, task = nil, base_name = nil, inputs = nil, result_type = nil, result_description = nil, is_exec = false, is_stream = false, stream_input = nil)
|
24
24
|
@base_url, @task, @base_name, @inputs, @result_type, @result_description, @is_exec, @is_stream, @stream_input = base_url, task, base_name, inputs, result_type, result_description, is_exec, is_stream, stream_input
|
25
|
+
@base_url = "http://" << @base_url unless @base_url =~ /^https?:\/\//
|
25
26
|
@mutex = Mutex.new
|
26
27
|
end
|
27
28
|
|
data/lib/rbbt/tsv.rb
CHANGED
data/lib/rbbt/tsv/attach.rb
CHANGED
@@ -192,7 +192,7 @@ module TSV
|
|
192
192
|
|
193
193
|
|
194
194
|
def attach(other, options = {})
|
195
|
-
options = Misc.add_defaults options, :in_namespace => false, :persist_input =>
|
195
|
+
options = Misc.add_defaults options, :in_namespace => false, :persist_input => false
|
196
196
|
fields, one2one, complete = Misc.process_options options, :fields, :one2one, :complete
|
197
197
|
in_namespace = options[:in_namespace]
|
198
198
|
|
@@ -202,7 +202,7 @@ module TSV
|
|
202
202
|
other.identifiers ||= other_identifier_file
|
203
203
|
end
|
204
204
|
|
205
|
-
fields = other.fields - [key_field].concat(self.fields) if fields.nil?
|
205
|
+
fields = other.fields - [key_field].concat(self.fields) if other.fields and (fields.nil? or fields == :all)
|
206
206
|
if in_namespace
|
207
207
|
fields = other.fields_in_namespace - [key_field].concat(self.fields) if fields.nil?
|
208
208
|
else
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module AnnotatedModule
|
2
|
+
|
3
|
+
def self.add_consummable_annotation(target, *annotations)
|
4
|
+
if annotations.length == 1 and Hash === annotations.first
|
5
|
+
annotations.first.each do |annotation, default|
|
6
|
+
target.send(:attr_accessor, annotation)
|
7
|
+
target.send(:define_method, "consume_#{annotation}") do
|
8
|
+
value = instance_variable_get("@#{annotation}") || default.dup
|
9
|
+
instance_variable_set("@#{annotation}", default.dup)
|
10
|
+
value
|
11
|
+
end
|
12
|
+
end
|
13
|
+
else
|
14
|
+
annotations.each do |annotation|
|
15
|
+
target.send(:attr_accessor, annotation)
|
16
|
+
target.send(:define_method, "consume_#{annotation}") do
|
17
|
+
value = instance_variable_get("@#{annotation}")
|
18
|
+
instance_variable_set("@#{annotation}", nil)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
module InputModule
|
28
|
+
AnnotatedModule.add_consummable_annotation(self,
|
29
|
+
:inputs => [],
|
30
|
+
:required_inputs => [],
|
31
|
+
:input_types => {},
|
32
|
+
:input_descriptions => {},
|
33
|
+
:input_defaults => {},
|
34
|
+
:input_options => {})
|
35
|
+
|
36
|
+
def input(name, type = nil, desc = nil, default = nil, options = nil)
|
37
|
+
name = name.to_sym
|
38
|
+
type = type.to_sym
|
39
|
+
|
40
|
+
@inputs = [] if @inputs.nil?
|
41
|
+
@input_types = {} if @input_types.nil?
|
42
|
+
@input_descriptions = {} if @input_descriptions.nil?
|
43
|
+
@input_defaults = {} if @input_defaults.nil?
|
44
|
+
@input_options = {} if @input_options.nil?
|
45
|
+
@required_inputs = [] if @required_inputs.nil?
|
46
|
+
|
47
|
+
required = Misc.process_options options, :required if options
|
48
|
+
required, default = true, nil if default == :required
|
49
|
+
@required_inputs << name if required
|
50
|
+
|
51
|
+
@inputs << name
|
52
|
+
@input_types[name] = type unless type.nil?
|
53
|
+
@input_descriptions[name] = desc unless desc.nil?
|
54
|
+
@input_defaults[name] = default unless default.nil?
|
55
|
+
@input_options[name] = options unless options.nil?
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
@@ -21,35 +21,4 @@ module AnnotatedModule
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
add_consummable_annotation(self,
|
25
|
-
:description => "",
|
26
|
-
:inputs => [],
|
27
|
-
:required_inputs => [],
|
28
|
-
:input_types => {},
|
29
|
-
:input_descriptions => {},
|
30
|
-
:input_defaults => {},
|
31
|
-
:input_options => {})
|
32
|
-
|
33
|
-
def input(name, type = nil, desc = nil, default = nil, options = nil)
|
34
|
-
name = name.to_sym
|
35
|
-
type = type.to_sym
|
36
|
-
|
37
|
-
@inputs = [] if @inputs.nil?
|
38
|
-
@input_types = {} if @input_types.nil?
|
39
|
-
@input_descriptions = {} if @input_descriptions.nil?
|
40
|
-
@input_defaults = {} if @input_defaults.nil?
|
41
|
-
@input_options = {} if @input_options.nil?
|
42
|
-
@required_inputs = [] if @required_inputs.nil?
|
43
|
-
|
44
|
-
required = Misc.process_options options, :required if options
|
45
|
-
required, default = true, nil if default == :required
|
46
|
-
@required_inputs << name if required
|
47
|
-
|
48
|
-
@inputs << name
|
49
|
-
@input_types[name] = type unless type.nil?
|
50
|
-
@input_descriptions[name] = desc unless desc.nil?
|
51
|
-
@input_defaults[name] = default unless default.nil?
|
52
|
-
@input_options[name] = options unless options.nil?
|
53
|
-
|
54
|
-
end
|
55
24
|
end
|
@@ -1,8 +1,7 @@
|
|
1
1
|
require 'rbbt-util'
|
2
|
-
require 'rbbt/
|
2
|
+
require 'rbbt/util/misc/annotated_module'
|
3
3
|
|
4
4
|
module Workflow
|
5
|
-
include AnnotatedModule
|
6
5
|
|
7
6
|
module DependencyBlock
|
8
7
|
attr_accessor :dependency
|
@@ -13,11 +12,15 @@ module Workflow
|
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
15
|
+
include InputModule
|
16
16
|
AnnotatedModule.add_consummable_annotation(self,
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
:dependencies => [],
|
18
|
+
:description => "",
|
19
|
+
:result_type => nil,
|
20
|
+
:result_description => "",
|
21
|
+
:extension => '')
|
22
|
+
|
23
|
+
|
21
24
|
def helper(name, &block)
|
22
25
|
helpers[name] = block
|
23
26
|
end
|
@@ -32,7 +32,7 @@ module Workflow
|
|
32
32
|
file = dir[input].find
|
33
33
|
file = dir.glob(input.to_s + ".*").first if file.nil? or not file.exists?
|
34
34
|
Log.debug "Trying #{ input }: #{file}"
|
35
|
-
next unless file.exists?
|
35
|
+
next unless file and file.exists?
|
36
36
|
|
37
37
|
case input_types[input]
|
38
38
|
when :tsv, :array, :text, :file
|
data/share/config.ru
CHANGED
@@ -70,6 +70,10 @@ load_file Rbbt.etc['app.d/preload.rb'].find_all
|
|
70
70
|
#{{{ SINATRA
|
71
71
|
load_file Rbbt.lib['sinatra.rb'].find_all
|
72
72
|
|
73
|
+
Entity.entity_list_cache = Rbbt.var.sinatra.app[app_name].find.entity_lists
|
74
|
+
Entity.entity_map_cache = Rbbt.var.sinatra.app[app_name].find.entity_maps
|
75
|
+
Entity.entity_property_cache = Rbbt.var.sinatra.app[app_name].find.entity_properties
|
76
|
+
|
73
77
|
#{{{ RUN
|
74
78
|
|
75
79
|
Sinatra::RbbtRESTMain.add_resource_path($app_dir.www.views.find, true)
|
@@ -72,4 +72,17 @@ class TestPersistTSV < Test::Unit::TestCase
|
|
72
72
|
engine = "LMDB"
|
73
73
|
run_bechmark(tsv_path, engine)
|
74
74
|
end
|
75
|
+
|
76
|
+
def test_tsv_persist
|
77
|
+
content =<<-EOF
|
78
|
+
#: :cast=:to_f
|
79
|
+
#Key Value1 Value2
|
80
|
+
k1 1.1 2.1
|
81
|
+
k2 1.2 2.2
|
82
|
+
EOF
|
83
|
+
TmpFile.with_file(content) do |tsv_file|
|
84
|
+
tsv = TSV.open(tsv_file, :sep => " ", :persist => true, :type => :double, :merge => true)
|
85
|
+
iii tsv["k1"]
|
86
|
+
end
|
87
|
+
end
|
75
88
|
end
|
data/test/rbbt/test_tsv.rb
CHANGED
@@ -350,7 +350,7 @@ b 2
|
|
350
350
|
EOF
|
351
351
|
|
352
352
|
TmpFile.with_file(content) do |filename|
|
353
|
-
tsv = TSV.open(filename, :key_field => "Value", :grep =>
|
353
|
+
tsv = TSV.open(filename, :key_field => "Value", :grep => '2')
|
354
354
|
assert(tsv.include?("2"))
|
355
355
|
assert(! tsv.include?("7"))
|
356
356
|
end
|
data/test/rbbt/util/test_misc.rb
CHANGED
@@ -444,6 +444,10 @@ eum fugiat quo voluptas nulla pariatur?"
|
|
444
444
|
ppp Misc.html_tag('textarea', "hola\nadios\nagain")
|
445
445
|
end
|
446
446
|
|
447
|
+
def test_link_title
|
448
|
+
ppp Misc.html_tag('a', "hola\nadios\nagain", :title => "Hola adios")
|
449
|
+
end
|
450
|
+
|
447
451
|
def __test_lock_fd
|
448
452
|
require 'rbbt/workflow'
|
449
453
|
Rbbt.var.jobs.Structure.neighbour_map.glob("*")[0..1000].each do |file|
|
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.21.
|
4
|
+
version: 5.21.66
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -281,6 +281,7 @@ files:
|
|
281
281
|
- lib/rbbt/util/log/progress/report.rb
|
282
282
|
- lib/rbbt/util/log/progress/util.rb
|
283
283
|
- lib/rbbt/util/misc.rb
|
284
|
+
- lib/rbbt/util/misc/annotated_module.rb
|
284
285
|
- lib/rbbt/util/misc/bgzf.rb
|
285
286
|
- lib/rbbt/util/misc/concurrent_stream.rb
|
286
287
|
- lib/rbbt/util/misc/development.rb
|