rbbt-util 5.44.1 → 6.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/rbbt +67 -90
- data/etc/app.d/base.rb +2 -2
- data/etc/app.d/semaphores.rb +3 -3
- data/lib/rbbt/annotations/annotated_array.rb +207 -207
- data/lib/rbbt/annotations/refactor.rb +27 -0
- data/lib/rbbt/annotations/util.rb +282 -282
- data/lib/rbbt/annotations.rb +343 -320
- data/lib/rbbt/association/database.rb +200 -225
- data/lib/rbbt/association/index.rb +294 -291
- data/lib/rbbt/association/item.rb +227 -227
- data/lib/rbbt/association/open.rb +35 -34
- data/lib/rbbt/association/util.rb +0 -169
- data/lib/rbbt/association.rb +2 -4
- data/lib/rbbt/entity/identifiers.rb +119 -118
- data/lib/rbbt/entity/refactor.rb +12 -0
- data/lib/rbbt/entity.rb +319 -315
- data/lib/rbbt/hpc/batch.rb +72 -53
- data/lib/rbbt/hpc/lsf.rb +2 -2
- data/lib/rbbt/hpc/orchestrate/batches.rb +2 -2
- data/lib/rbbt/hpc/orchestrate/chains.rb +25 -5
- data/lib/rbbt/hpc/orchestrate/rules.rb +2 -2
- data/lib/rbbt/hpc/orchestrate.rb +19 -13
- data/lib/rbbt/hpc/slurm.rb +18 -18
- data/lib/rbbt/knowledge_base/entity.rb +13 -5
- data/lib/rbbt/knowledge_base/query.rb +2 -2
- data/lib/rbbt/knowledge_base/registry.rb +32 -31
- data/lib/rbbt/knowledge_base/traverse.rb +1 -1
- data/lib/rbbt/knowledge_base.rb +1 -1
- data/lib/rbbt/monitor.rb +36 -25
- data/lib/rbbt/persist/refactor.rb +166 -0
- data/lib/rbbt/persist/tsv/tokyocabinet.rb +105 -105
- data/lib/rbbt/persist/tsv.rb +187 -185
- data/lib/rbbt/persist.rb +556 -551
- data/lib/rbbt/refactor.rb +20 -0
- data/lib/rbbt/resource/path/refactor.rb +178 -0
- data/lib/rbbt/resource/path.rb +317 -497
- data/lib/rbbt/resource/util.rb +0 -48
- data/lib/rbbt/resource.rb +3 -390
- data/lib/rbbt/tsv/accessor.rb +2 -838
- data/lib/rbbt/tsv/attach.rb +303 -299
- data/lib/rbbt/tsv/change_id.rb +244 -245
- data/lib/rbbt/tsv/csv.rb +87 -85
- data/lib/rbbt/tsv/dumper.rb +2 -100
- data/lib/rbbt/tsv/excel.rb +26 -24
- data/lib/rbbt/tsv/field_index.rb +4 -1
- data/lib/rbbt/tsv/filter.rb +3 -2
- data/lib/rbbt/tsv/index.rb +2 -284
- data/lib/rbbt/tsv/manipulate.rb +750 -747
- data/lib/rbbt/tsv/marshal.rb +3 -3
- data/lib/rbbt/tsv/matrix.rb +2 -2
- data/lib/rbbt/tsv/parallel/through.rb +2 -1
- data/lib/rbbt/tsv/parallel/traverse.rb +783 -781
- data/lib/rbbt/tsv/parser.rb +678 -678
- data/lib/rbbt/tsv/refactor.rb +195 -0
- data/lib/rbbt/tsv/stream.rb +253 -251
- data/lib/rbbt/tsv/util.rb +420 -420
- data/lib/rbbt/tsv.rb +210 -208
- data/lib/rbbt/util/R/eval.rb +4 -4
- data/lib/rbbt/util/R/plot.rb +62 -166
- data/lib/rbbt/util/R.rb +21 -18
- data/lib/rbbt/util/cmd.rb +2 -318
- data/lib/rbbt/util/color.rb +269 -269
- data/lib/rbbt/util/colorize.rb +89 -89
- data/lib/rbbt/util/concurrency/processes/refactor.rb +22 -0
- data/lib/rbbt/util/concurrency/processes/worker.rb +2 -2
- data/lib/rbbt/util/concurrency/processes.rb +389 -386
- data/lib/rbbt/util/config.rb +169 -167
- data/lib/rbbt/util/iruby.rb +20 -0
- data/lib/rbbt/util/log/progress/report.rb +241 -241
- data/lib/rbbt/util/log/progress/util.rb +99 -99
- data/lib/rbbt/util/log/progress.rb +102 -102
- data/lib/rbbt/util/log/refactor.rb +49 -0
- data/lib/rbbt/util/log.rb +486 -532
- data/lib/rbbt/util/migrate.rb +1 -1
- data/lib/rbbt/util/misc/concurrent_stream.rb +248 -246
- data/lib/rbbt/util/misc/development.rb +12 -11
- data/lib/rbbt/util/misc/exceptions.rb +117 -112
- data/lib/rbbt/util/misc/format.rb +2 -230
- data/lib/rbbt/util/misc/indiferent_hash.rb +2 -107
- data/lib/rbbt/util/misc/inspect.rb +2 -476
- data/lib/rbbt/util/misc/lock.rb +109 -106
- data/lib/rbbt/util/misc/omics.rb +9 -1
- data/lib/rbbt/util/misc/pipes.rb +765 -793
- data/lib/rbbt/util/misc/refactor.rb +20 -0
- data/lib/rbbt/util/misc/ssw.rb +27 -17
- data/lib/rbbt/util/misc/system.rb +0 -15
- data/lib/rbbt/util/misc.rb +39 -20
- data/lib/rbbt/util/named_array/refactor.rb +4 -0
- data/lib/rbbt/util/named_array.rb +3 -220
- data/lib/rbbt/util/open/refactor.rb +7 -0
- data/lib/rbbt/util/open.rb +3 -857
- data/lib/rbbt/util/procpath.rb +6 -6
- data/lib/rbbt/util/python/paths.rb +27 -0
- data/lib/rbbt/util/python/run.rb +115 -0
- data/lib/rbbt/util/python/script.rb +110 -0
- data/lib/rbbt/util/python/util.rb +3 -3
- data/lib/rbbt/util/python.rb +22 -81
- data/lib/rbbt/util/semaphore.rb +152 -148
- data/lib/rbbt/util/simpleopt.rb +9 -8
- data/lib/rbbt/util/ssh/refactor.rb +19 -0
- data/lib/rbbt/util/ssh.rb +122 -118
- data/lib/rbbt/util/tar.rb +117 -115
- data/lib/rbbt/util/tmpfile.rb +69 -67
- data/lib/rbbt/util/version.rb +2 -0
- data/lib/rbbt/workflow/refactor/entity.rb +11 -0
- data/lib/rbbt/workflow/refactor/export.rb +66 -0
- data/lib/rbbt/workflow/refactor/inputs.rb +24 -0
- data/lib/rbbt/workflow/refactor/recursive.rb +64 -0
- data/lib/rbbt/workflow/refactor/task_info.rb +65 -0
- data/lib/rbbt/workflow/refactor.rb +153 -0
- data/lib/rbbt/workflow/remote_workflow/driver/ssh.rb +55 -32
- data/lib/rbbt/workflow/remote_workflow/remote_step/rest.rb +3 -1
- data/lib/rbbt/workflow/remote_workflow/remote_step/ssh.rb +14 -5
- data/lib/rbbt/workflow/remote_workflow/remote_step.rb +19 -7
- data/lib/rbbt/workflow/remote_workflow.rb +6 -1
- data/lib/rbbt/workflow/step/run.rb +766 -766
- data/lib/rbbt/workflow/step/save_load_inputs.rb +254 -254
- data/lib/rbbt/workflow/step.rb +2 -362
- data/lib/rbbt/workflow/task.rb +118 -118
- data/lib/rbbt/workflow/usage.rb +289 -287
- data/lib/rbbt/workflow/util/archive.rb +6 -5
- data/lib/rbbt/workflow/util/data.rb +1 -1
- data/lib/rbbt/workflow/util/orchestrator.rb +249 -246
- data/lib/rbbt/workflow/util/trace.rb +79 -44
- data/lib/rbbt/workflow.rb +4 -882
- data/lib/rbbt-util.rb +21 -13
- data/lib/rbbt.rb +16 -3
- data/python/rbbt/__init__.py +19 -1
- data/share/Rlib/plot.R +37 -37
- data/share/Rlib/svg.R +22 -5
- data/share/install/software/lib/install_helpers +1 -1
- data/share/rbbt_commands/hpc/list +2 -3
- data/share/rbbt_commands/hpc/orchestrate +4 -4
- data/share/rbbt_commands/hpc/tail +2 -0
- data/share/rbbt_commands/hpc/task +10 -7
- data/share/rbbt_commands/lsf/list +2 -3
- data/share/rbbt_commands/lsf/orchestrate +4 -4
- data/share/rbbt_commands/lsf/tail +2 -0
- data/share/rbbt_commands/lsf/task +10 -7
- data/share/rbbt_commands/migrate +1 -1
- data/share/rbbt_commands/pbs/list +2 -3
- data/share/rbbt_commands/pbs/orchestrate +4 -4
- data/share/rbbt_commands/pbs/tail +2 -0
- data/share/rbbt_commands/pbs/task +10 -7
- data/share/rbbt_commands/resource/produce +8 -1
- data/share/rbbt_commands/slurm/list +2 -3
- data/share/rbbt_commands/slurm/orchestrate +4 -4
- data/share/rbbt_commands/slurm/tail +2 -0
- data/share/rbbt_commands/slurm/task +10 -7
- data/share/rbbt_commands/system/clean +5 -5
- data/share/rbbt_commands/system/status +5 -5
- data/share/rbbt_commands/tsv/get +2 -3
- data/share/rbbt_commands/tsv/info +10 -13
- data/share/rbbt_commands/tsv/keys +18 -14
- data/share/rbbt_commands/tsv/slice +2 -2
- data/share/rbbt_commands/tsv/transpose +6 -2
- data/share/rbbt_commands/workflow/info +20 -24
- data/share/rbbt_commands/workflow/list +1 -1
- data/share/rbbt_commands/workflow/prov +20 -13
- data/share/rbbt_commands/workflow/server +11 -1
- data/share/rbbt_commands/workflow/task +76 -71
- data/share/rbbt_commands/workflow/write_info +26 -9
- data/share/software/opt/ssw/ssw.c +861 -0
- data/share/software/opt/ssw/ssw.h +130 -0
- data/share/workflow_config.ru +3 -3
- metadata +40 -2
data/lib/rbbt/tsv.rb
CHANGED
@@ -1,208 +1,210 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
require 'rbbt/
|
5
|
-
require 'rbbt/
|
6
|
-
|
7
|
-
|
8
|
-
require 'rbbt/
|
9
|
-
require 'rbbt/
|
10
|
-
|
11
|
-
require 'rbbt/tsv/
|
12
|
-
require 'rbbt/tsv/
|
13
|
-
require 'rbbt/tsv/
|
14
|
-
require 'rbbt/tsv/
|
15
|
-
require 'rbbt/tsv/
|
16
|
-
require 'rbbt/tsv/
|
17
|
-
require 'rbbt/tsv/
|
18
|
-
require 'rbbt/tsv/
|
19
|
-
require 'rbbt/tsv/
|
20
|
-
require 'rbbt/tsv/
|
21
|
-
require 'rbbt/tsv/
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
options
|
49
|
-
|
50
|
-
options
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
options
|
72
|
-
options
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
data.
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
data.
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
CMD.cmd("#{bin}
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
when
|
185
|
-
data.serializer =
|
186
|
-
when (parser.cast == :to_i and parser.type == :
|
187
|
-
data.serializer = :
|
188
|
-
when (parser.cast == :
|
189
|
-
data.serializer = :
|
190
|
-
when (parser.cast == :to_f and
|
191
|
-
data.serializer = :
|
192
|
-
|
193
|
-
data.serializer = :
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
data
|
207
|
-
|
208
|
-
|
1
|
+
require_relative 'refactor'
|
2
|
+
Rbbt.require_instead 'scout/tsv'
|
3
|
+
require_relative 'tsv/refactor'
|
4
|
+
#require 'rbbt/persist'
|
5
|
+
#require 'rbbt/persist/tsv'
|
6
|
+
#
|
7
|
+
#require 'rbbt/util/log'
|
8
|
+
#require 'rbbt/util/misc'
|
9
|
+
#require 'rbbt/util/named_array'
|
10
|
+
#
|
11
|
+
#require 'rbbt/tsv/util'
|
12
|
+
#require 'rbbt/tsv/serializers'
|
13
|
+
#require 'rbbt/tsv/parser'
|
14
|
+
#require 'rbbt/tsv/accessor'
|
15
|
+
#require 'rbbt/tsv/manipulate'
|
16
|
+
#require 'rbbt/tsv/index'
|
17
|
+
#require 'rbbt/tsv/attach'
|
18
|
+
#require 'rbbt/tsv/filter'
|
19
|
+
#require 'rbbt/tsv/field_index'
|
20
|
+
#require 'rbbt/tsv/parallel'
|
21
|
+
#require 'rbbt/tsv/stream'
|
22
|
+
#require 'rbbt/tsv/melt'
|
23
|
+
#require 'rbbt/tsv/matrix'
|
24
|
+
#require 'rbbt/tsv/marshal'
|
25
|
+
#
|
26
|
+
#module TSV
|
27
|
+
# class << self
|
28
|
+
# attr_accessor :lock_dir, :unnamed
|
29
|
+
#
|
30
|
+
# def lock_dir
|
31
|
+
# @lock_dir ||= Rbbt.tmp.tsv_open_locks.find
|
32
|
+
# end
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# def self.str2options(str)
|
36
|
+
# field_options,_sep, rest = str.partition("#")
|
37
|
+
# key, fields_str = field_options.split("~")
|
38
|
+
#
|
39
|
+
# fields = fields_str.nil? ? [] : fields_str.split(/,\s*/)
|
40
|
+
#
|
41
|
+
# rest = ":type=" << rest if rest =~ /^:?\w+$/
|
42
|
+
# rest_options = rest.nil? ? {} : Misc.string2hash(rest)
|
43
|
+
#
|
44
|
+
# {:key_field => key, :fields => fields}.merge(rest_options)
|
45
|
+
# end
|
46
|
+
#
|
47
|
+
# def self.setup(hash, type = nil, options = nil)
|
48
|
+
# type, options = nil, type if options.nil? and (Hash === type or (String === type and type.include? "~"))
|
49
|
+
# options = TSV.str2options(options) if String === options and options.include? "~"
|
50
|
+
# options ||= {}
|
51
|
+
# options[:type] ||= type unless type.nil?
|
52
|
+
#
|
53
|
+
# options = Misc.add_defaults options, :default_value => [], :unnamed => TSV.unnamed
|
54
|
+
# default_value = Misc.process_options options, :default_value
|
55
|
+
# hash = Misc.array2hash(hash, default_value) if Array === hash
|
56
|
+
# hash.extend TSV
|
57
|
+
#
|
58
|
+
# IndiferentHash.setup(options)
|
59
|
+
# ENTRIES.each do |entry|
|
60
|
+
# hash.send("#{ entry }=", options[entry.to_s]) if options.include? entry.to_s
|
61
|
+
# hash.send("#{ entry }=", options[entry.to_sym]) if options.include? entry.to_sym
|
62
|
+
# end
|
63
|
+
#
|
64
|
+
# hash.unnamed = options[:unnamed]
|
65
|
+
#
|
66
|
+
# hash
|
67
|
+
# end
|
68
|
+
#
|
69
|
+
# # options shift if type.nil?
|
70
|
+
# def self.open(source, type = nil, options = nil)
|
71
|
+
# type, options = nil, type if options.nil? and (Hash === type or (String === type and type.include? "~"))
|
72
|
+
# options = TSV.str2options(options) if String === options and options.include? "~"
|
73
|
+
# options ||= {}
|
74
|
+
# options[:type] ||= type unless type.nil?
|
75
|
+
#
|
76
|
+
# persist_options = Misc.pull_keys options, :persist
|
77
|
+
#
|
78
|
+
# raise "TSV source is nil" if source.nil?
|
79
|
+
#
|
80
|
+
# filename = get_filename source
|
81
|
+
# serializer = Misc.process_options options, :serializer
|
82
|
+
# unnamed = Misc.process_options options, :unnamed
|
83
|
+
# entity_options = Misc.process_options options, :entity_options
|
84
|
+
#
|
85
|
+
#
|
86
|
+
# Log.debug "TSV open: #{ filename } - #{Misc.fingerprint options }.#{unnamed ? " [unnamed]" : "[not unnamed]"}"
|
87
|
+
#
|
88
|
+
# data = nil
|
89
|
+
#
|
90
|
+
# lock_filename = filename.nil? ? nil : Persist.persistence_path(filename + '.open', {:dir => TSV.lock_dir})
|
91
|
+
# Misc.lock lock_filename do
|
92
|
+
# data = Persist.persist_tsv source, filename, options, persist_options do |data|
|
93
|
+
# if serializer
|
94
|
+
# data.extend TSV unless TSV === data
|
95
|
+
# data.serializer = serializer
|
96
|
+
# end
|
97
|
+
#
|
98
|
+
# tsv_grep = Misc.process_options options, :tsv_grep
|
99
|
+
# tsv_grep ||= Misc.process_options options, :grep
|
100
|
+
# open_options = Misc.pull_keys options, :open
|
101
|
+
#
|
102
|
+
# stream = get_stream source, options.merge(open_options)
|
103
|
+
# parse stream, data, options.merge(:tsv_grep => tsv_grep)
|
104
|
+
#
|
105
|
+
# if ! open_options[:noclose]
|
106
|
+
# stream.close unless stream.closed?
|
107
|
+
# stream.join if stream.respond_to?(:join)
|
108
|
+
# end
|
109
|
+
#
|
110
|
+
# data.filename = filename.to_s unless filename.nil?
|
111
|
+
#
|
112
|
+
# if data.identifiers.nil? and Path === filename and filename.identifier_file_path
|
113
|
+
# data.identifiers = filename.identifier_file_path.find if filename.identifier_file_path.exists?
|
114
|
+
# end
|
115
|
+
#
|
116
|
+
# data
|
117
|
+
# end
|
118
|
+
# end
|
119
|
+
#
|
120
|
+
#
|
121
|
+
# data.unnamed = unnamed unless unnamed.nil?
|
122
|
+
#
|
123
|
+
# data.entity_options = entity_options
|
124
|
+
#
|
125
|
+
# if Path === source && data.identifiers
|
126
|
+
# Path.setup(data.identifiers, source.pkgdir, source.resource)
|
127
|
+
# end
|
128
|
+
#
|
129
|
+
# if data.respond_to? :persistence_path
|
130
|
+
# data.read
|
131
|
+
# data
|
132
|
+
# else
|
133
|
+
# h = data.dup
|
134
|
+
# data.clear
|
135
|
+
# data.annotate h
|
136
|
+
# end
|
137
|
+
# end
|
138
|
+
#
|
139
|
+
# def self.parse_header(stream, options = {})
|
140
|
+
# case
|
141
|
+
# when Path === stream
|
142
|
+
# stream.open do |f|
|
143
|
+
# f.no_fail = true if ConcurrentStream === f
|
144
|
+
# Parser.new f, options
|
145
|
+
# end
|
146
|
+
# when (String === stream and stream.length < 300 and (Open.exists? stream or Open.remote? stream))
|
147
|
+
# Open.open(stream) do |f|
|
148
|
+
# f.no_fail = true if ConcurrentStream === f
|
149
|
+
# Parser.new f, options
|
150
|
+
# end
|
151
|
+
# else
|
152
|
+
# filename = stream.respond_to?(:filename) ? stream.filename : Misc.fingerprint(stream)
|
153
|
+
# Log.debug("Parsing header of open stream: #{filename}")
|
154
|
+
# Parser.new stream, options
|
155
|
+
# end
|
156
|
+
# end
|
157
|
+
#
|
158
|
+
# def self.parse(stream, data, options = {})
|
159
|
+
#
|
160
|
+
# parser = Misc.process_options options, :parser
|
161
|
+
# parser = TSV::Parser.new stream, options if parser.nil?
|
162
|
+
#
|
163
|
+
# # dump with tchmgr
|
164
|
+
# if defined? TokyoCabinet and TokyoCabinet::HDB === data and parser.straight and
|
165
|
+
# data.close
|
166
|
+
# begin
|
167
|
+
# bin = 'tchmgr'
|
168
|
+
# CMD.cmd("#{bin} version", :log => false)
|
169
|
+
# FileUtils.mkdir_p File.dirname(data.persistence_path)
|
170
|
+
# CMD.cmd("#{bin} importtsv '#{data.persistence_path}'", :in => stream, :log => false, :dont_close_in => true)
|
171
|
+
# rescue
|
172
|
+
# Log.debug("tchmgr importtsv failed for: #{data.persistence_path}")
|
173
|
+
# end
|
174
|
+
# data.write
|
175
|
+
# end
|
176
|
+
#
|
177
|
+
# # make TSV
|
178
|
+
# data.extend TSV unless TSV === data
|
179
|
+
# data.unnamed = true
|
180
|
+
#
|
181
|
+
# # choose serializer
|
182
|
+
# if data.serializer == :type
|
183
|
+
# data.serializer = case
|
184
|
+
# when parser.cast.nil?
|
185
|
+
# data.serializer = parser.type
|
186
|
+
# when (parser.cast == :to_i and (parser.type == :list or parser.type == :flat))
|
187
|
+
# data.serializer = :integer_array
|
188
|
+
# when (parser.cast == :to_i and parser.type == :single)
|
189
|
+
# data.serializer = :integer
|
190
|
+
# when (parser.cast == :to_f and parser.type == :single)
|
191
|
+
# data.serializer = :float
|
192
|
+
# when (parser.cast == :to_f and (parser.type == :list or parser.type == :flat))
|
193
|
+
# data.serializer = :float_array
|
194
|
+
# else
|
195
|
+
# data.serializer = :marshal
|
196
|
+
# end
|
197
|
+
# end
|
198
|
+
#
|
199
|
+
# parser.traverse(options) do |key,values|
|
200
|
+
# parser.add_to_data data, key, values
|
201
|
+
# end
|
202
|
+
#
|
203
|
+
# # setup the TSV
|
204
|
+
# parser.setup data
|
205
|
+
#
|
206
|
+
# data.unnamed = false
|
207
|
+
#
|
208
|
+
# data
|
209
|
+
# end
|
210
|
+
#end
|
data/lib/rbbt/util/R/eval.rb
CHANGED
@@ -27,7 +27,7 @@ module R
|
|
27
27
|
@@semfile
|
28
28
|
else
|
29
29
|
@@semfile = File.basename(socket_file) + '.sem'
|
30
|
-
|
30
|
+
ScoutSemaphore.create_semaphore(@@semfile,1)
|
31
31
|
@@semfile
|
32
32
|
end
|
33
33
|
end
|
@@ -42,7 +42,7 @@ module R
|
|
42
42
|
|
43
43
|
def self.clear
|
44
44
|
@@instance = nil
|
45
|
-
if defined? @@instance_process and @@instance_process and Misc.
|
45
|
+
if defined? @@instance_process and @@instance_process and Misc.pid_alive? @@instance_process
|
46
46
|
Log.warn "Clearing Rserver session #{SESSION}, PID #{@@instance_process}"
|
47
47
|
begin
|
48
48
|
Process.kill :INT, @@instance_process
|
@@ -59,7 +59,7 @@ module R
|
|
59
59
|
def self.instance
|
60
60
|
@@instance ||= begin
|
61
61
|
|
62
|
-
clear if File.exist? pid_file and ! Misc.
|
62
|
+
clear if File.exist? pid_file and ! Misc.pid_alive?(Open.read(pid_file).strip.to_i)
|
63
63
|
|
64
64
|
FileUtils.mkdir_p File.dirname(socket_file) unless File.directory?(File.dirname(socket_file))
|
65
65
|
FileUtils.mkdir_p workdir unless File.directory? workdir
|
@@ -120,7 +120,7 @@ module R
|
|
120
120
|
end
|
121
121
|
|
122
122
|
def self._eval(cmd)
|
123
|
-
|
123
|
+
ScoutSemaphore.synchronize(semfile) do
|
124
124
|
times = 1
|
125
125
|
begin
|
126
126
|
instance.eval(cmd)
|