rbbt-util 5.44.1 → 6.0.4

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.
Files changed (175) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/bin/rbbt +67 -90
  4. data/bin/rbbt_exec.rb +2 -2
  5. data/etc/app.d/base.rb +2 -2
  6. data/etc/app.d/semaphores.rb +3 -3
  7. data/lib/rbbt/annotations/annotated_array.rb +207 -207
  8. data/lib/rbbt/annotations/refactor.rb +27 -0
  9. data/lib/rbbt/annotations/util.rb +282 -282
  10. data/lib/rbbt/annotations.rb +343 -320
  11. data/lib/rbbt/association/database.rb +200 -225
  12. data/lib/rbbt/association/index.rb +294 -291
  13. data/lib/rbbt/association/item.rb +227 -227
  14. data/lib/rbbt/association/open.rb +35 -34
  15. data/lib/rbbt/association/util.rb +0 -169
  16. data/lib/rbbt/association.rb +2 -4
  17. data/lib/rbbt/entity/identifiers.rb +119 -118
  18. data/lib/rbbt/entity/refactor.rb +12 -0
  19. data/lib/rbbt/entity.rb +319 -315
  20. data/lib/rbbt/hpc/batch.rb +72 -53
  21. data/lib/rbbt/hpc/lsf.rb +2 -2
  22. data/lib/rbbt/hpc/orchestrate/batches.rb +2 -2
  23. data/lib/rbbt/hpc/orchestrate/chains.rb +25 -5
  24. data/lib/rbbt/hpc/orchestrate/rules.rb +2 -2
  25. data/lib/rbbt/hpc/orchestrate.rb +19 -13
  26. data/lib/rbbt/hpc/slurm.rb +18 -18
  27. data/lib/rbbt/knowledge_base/entity.rb +13 -5
  28. data/lib/rbbt/knowledge_base/query.rb +2 -2
  29. data/lib/rbbt/knowledge_base/registry.rb +32 -31
  30. data/lib/rbbt/knowledge_base/traverse.rb +1 -1
  31. data/lib/rbbt/knowledge_base.rb +1 -1
  32. data/lib/rbbt/monitor.rb +36 -25
  33. data/lib/rbbt/persist/refactor.rb +166 -0
  34. data/lib/rbbt/persist/tsv/tokyocabinet.rb +105 -105
  35. data/lib/rbbt/persist/tsv.rb +187 -185
  36. data/lib/rbbt/persist.rb +556 -551
  37. data/lib/rbbt/refactor.rb +20 -0
  38. data/lib/rbbt/resource/path/refactor.rb +178 -0
  39. data/lib/rbbt/resource/path.rb +317 -497
  40. data/lib/rbbt/resource/util.rb +0 -48
  41. data/lib/rbbt/resource.rb +3 -390
  42. data/lib/rbbt/tsv/accessor.rb +2 -838
  43. data/lib/rbbt/tsv/attach.rb +303 -299
  44. data/lib/rbbt/tsv/change_id.rb +244 -245
  45. data/lib/rbbt/tsv/csv.rb +87 -85
  46. data/lib/rbbt/tsv/dumper.rb +2 -100
  47. data/lib/rbbt/tsv/excel.rb +26 -24
  48. data/lib/rbbt/tsv/field_index.rb +4 -1
  49. data/lib/rbbt/tsv/filter.rb +3 -2
  50. data/lib/rbbt/tsv/index.rb +2 -284
  51. data/lib/rbbt/tsv/manipulate.rb +750 -747
  52. data/lib/rbbt/tsv/marshal.rb +3 -3
  53. data/lib/rbbt/tsv/matrix.rb +2 -2
  54. data/lib/rbbt/tsv/parallel/through.rb +2 -1
  55. data/lib/rbbt/tsv/parallel/traverse.rb +783 -781
  56. data/lib/rbbt/tsv/parser.rb +678 -678
  57. data/lib/rbbt/tsv/refactor.rb +195 -0
  58. data/lib/rbbt/tsv/stream.rb +253 -251
  59. data/lib/rbbt/tsv/util.rb +420 -420
  60. data/lib/rbbt/tsv.rb +210 -208
  61. data/lib/rbbt/util/R/eval.rb +4 -4
  62. data/lib/rbbt/util/R/plot.rb +62 -166
  63. data/lib/rbbt/util/R.rb +21 -18
  64. data/lib/rbbt/util/cmd.rb +2 -318
  65. data/lib/rbbt/util/color.rb +269 -269
  66. data/lib/rbbt/util/colorize.rb +89 -89
  67. data/lib/rbbt/util/concurrency/processes/refactor.rb +22 -0
  68. data/lib/rbbt/util/concurrency/processes/worker.rb +2 -2
  69. data/lib/rbbt/util/concurrency/processes.rb +389 -386
  70. data/lib/rbbt/util/config.rb +169 -167
  71. data/lib/rbbt/util/filecache.rb +1 -1
  72. data/lib/rbbt/util/iruby.rb +20 -0
  73. data/lib/rbbt/util/log/progress/report.rb +241 -241
  74. data/lib/rbbt/util/log/progress/util.rb +99 -99
  75. data/lib/rbbt/util/log/progress.rb +102 -102
  76. data/lib/rbbt/util/log/refactor.rb +49 -0
  77. data/lib/rbbt/util/log.rb +486 -532
  78. data/lib/rbbt/util/migrate.rb +2 -2
  79. data/lib/rbbt/util/misc/concurrent_stream.rb +248 -246
  80. data/lib/rbbt/util/misc/development.rb +12 -11
  81. data/lib/rbbt/util/misc/exceptions.rb +117 -112
  82. data/lib/rbbt/util/misc/format.rb +2 -230
  83. data/lib/rbbt/util/misc/indiferent_hash.rb +2 -107
  84. data/lib/rbbt/util/misc/inspect.rb +2 -476
  85. data/lib/rbbt/util/misc/lock.rb +109 -106
  86. data/lib/rbbt/util/misc/omics.rb +9 -1
  87. data/lib/rbbt/util/misc/pipes.rb +765 -793
  88. data/lib/rbbt/util/misc/refactor.rb +20 -0
  89. data/lib/rbbt/util/misc/ssw.rb +27 -17
  90. data/lib/rbbt/util/misc/system.rb +92 -105
  91. data/lib/rbbt/util/misc.rb +39 -20
  92. data/lib/rbbt/util/named_array/refactor.rb +4 -0
  93. data/lib/rbbt/util/named_array.rb +3 -220
  94. data/lib/rbbt/util/open/refactor.rb +7 -0
  95. data/lib/rbbt/util/open.rb +3 -857
  96. data/lib/rbbt/util/procpath.rb +6 -6
  97. data/lib/rbbt/util/python/paths.rb +27 -0
  98. data/lib/rbbt/util/python/run.rb +115 -0
  99. data/lib/rbbt/util/python/script.rb +110 -0
  100. data/lib/rbbt/util/python/util.rb +3 -3
  101. data/lib/rbbt/util/python.rb +22 -81
  102. data/lib/rbbt/util/semaphore.rb +152 -148
  103. data/lib/rbbt/util/simpleopt.rb +9 -8
  104. data/lib/rbbt/util/ssh/refactor.rb +19 -0
  105. data/lib/rbbt/util/ssh.rb +122 -118
  106. data/lib/rbbt/util/tar.rb +117 -115
  107. data/lib/rbbt/util/tmpfile.rb +69 -67
  108. data/lib/rbbt/util/version.rb +2 -0
  109. data/lib/rbbt/workflow/refactor/entity.rb +11 -0
  110. data/lib/rbbt/workflow/refactor/export.rb +66 -0
  111. data/lib/rbbt/workflow/refactor/inputs.rb +24 -0
  112. data/lib/rbbt/workflow/refactor/recursive.rb +64 -0
  113. data/lib/rbbt/workflow/refactor/task_info.rb +66 -0
  114. data/lib/rbbt/workflow/refactor.rb +150 -0
  115. data/lib/rbbt/workflow/remote_workflow/driver/rest.rb +1 -2
  116. data/lib/rbbt/workflow/remote_workflow/driver/ssh.rb +55 -32
  117. data/lib/rbbt/workflow/remote_workflow/remote_step/rest.rb +3 -1
  118. data/lib/rbbt/workflow/remote_workflow/remote_step/ssh.rb +14 -5
  119. data/lib/rbbt/workflow/remote_workflow/remote_step.rb +19 -7
  120. data/lib/rbbt/workflow/remote_workflow.rb +6 -1
  121. data/lib/rbbt/workflow/step/run.rb +766 -766
  122. data/lib/rbbt/workflow/step/save_load_inputs.rb +254 -254
  123. data/lib/rbbt/workflow/step.rb +2 -362
  124. data/lib/rbbt/workflow/task.rb +118 -118
  125. data/lib/rbbt/workflow/usage.rb +289 -287
  126. data/lib/rbbt/workflow/util/archive.rb +6 -5
  127. data/lib/rbbt/workflow/util/data.rb +1 -1
  128. data/lib/rbbt/workflow/util/orchestrator.rb +249 -246
  129. data/lib/rbbt/workflow/util/trace.rb +79 -44
  130. data/lib/rbbt/workflow.rb +4 -882
  131. data/lib/rbbt-util.rb +21 -13
  132. data/lib/rbbt.rb +16 -3
  133. data/python/rbbt/__init__.py +96 -4
  134. data/python/rbbt/workflow/remote.py +104 -0
  135. data/python/rbbt/workflow.py +64 -0
  136. data/python/test.py +10 -0
  137. data/share/Rlib/plot.R +37 -37
  138. data/share/Rlib/svg.R +22 -5
  139. data/share/install/software/lib/install_helpers +1 -1
  140. data/share/rbbt_commands/hpc/list +2 -3
  141. data/share/rbbt_commands/hpc/orchestrate +4 -4
  142. data/share/rbbt_commands/hpc/tail +2 -0
  143. data/share/rbbt_commands/hpc/task +10 -7
  144. data/share/rbbt_commands/lsf/list +2 -3
  145. data/share/rbbt_commands/lsf/orchestrate +4 -4
  146. data/share/rbbt_commands/lsf/tail +2 -0
  147. data/share/rbbt_commands/lsf/task +10 -7
  148. data/share/rbbt_commands/migrate +1 -1
  149. data/share/rbbt_commands/pbs/list +2 -3
  150. data/share/rbbt_commands/pbs/orchestrate +4 -4
  151. data/share/rbbt_commands/pbs/tail +2 -0
  152. data/share/rbbt_commands/pbs/task +10 -7
  153. data/share/rbbt_commands/resource/produce +8 -1
  154. data/share/rbbt_commands/slurm/list +2 -3
  155. data/share/rbbt_commands/slurm/orchestrate +4 -4
  156. data/share/rbbt_commands/slurm/tail +2 -0
  157. data/share/rbbt_commands/slurm/task +10 -7
  158. data/share/rbbt_commands/system/clean +5 -5
  159. data/share/rbbt_commands/system/status +5 -5
  160. data/share/rbbt_commands/tsv/get +2 -3
  161. data/share/rbbt_commands/tsv/info +10 -13
  162. data/share/rbbt_commands/tsv/keys +18 -14
  163. data/share/rbbt_commands/tsv/slice +2 -2
  164. data/share/rbbt_commands/tsv/transpose +6 -2
  165. data/share/rbbt_commands/workflow/info +20 -24
  166. data/share/rbbt_commands/workflow/list +1 -1
  167. data/share/rbbt_commands/workflow/prov +20 -13
  168. data/share/rbbt_commands/workflow/retry +43 -0
  169. data/share/rbbt_commands/workflow/server +12 -2
  170. data/share/rbbt_commands/workflow/task +80 -73
  171. data/share/rbbt_commands/workflow/write_info +26 -9
  172. data/share/software/opt/ssw/ssw.c +861 -0
  173. data/share/software/opt/ssw/ssw.h +130 -0
  174. data/share/workflow_config.ru +3 -3
  175. metadata +45 -6
@@ -1,185 +1,187 @@
1
- require 'rbbt/persist/tsv/adapter'
2
-
3
- require 'rbbt/persist/tsv/fix_width_table'
4
- require 'rbbt/persist/tsv/packed_index'
5
-
6
- begin
7
- require 'rbbt/persist/tsv/tokyocabinet'
8
- rescue Exception
9
- Log.warn "The tokyocabinet gem could not be loaded. Persistence using this engine will fail."
10
- end
11
-
12
- begin
13
- require 'rbbt/persist/tsv/lmdb'
14
- rescue Exception
15
- Log.debug "The lmdb gem could not be loaded. Persistence using this engine will fail."
16
- end
17
-
18
- begin
19
- require 'rbbt/persist/tsv/leveldb'
20
- rescue Exception
21
- Log.debug "The LevelDB gem could not be loaded. Persistence using this engine will fail."
22
- end
23
-
24
- begin
25
- require 'rbbt/persist/tsv/cdb'
26
- rescue Exception
27
- Log.debug "The CDB gem could not be loaded. Persistence using this engine will fail."
28
- end
29
-
30
- begin
31
- require 'rbbt/persist/tsv/kyotocabinet'
32
- rescue Exception
33
- Log.debug "The kyotocabinet gem could not be loaded. Persistence using this engine will fail."
34
- end
35
-
36
- module Persist
37
- CONNECTIONS = {}
38
-
39
- def self.get_filename(source)
40
- case
41
- when Path === source
42
- source
43
- when (source.respond_to?(:filename) and source.filename)
44
- source.filename
45
- when source.respond_to?(:cmd)
46
- "CMD-#{Misc.digest(source.cmd)}"
47
- when TSV === source
48
- "TSV[#{Misc.digest Misc.fingerprint(source)}]"
49
- end || source.object_id.to_s
50
- end
51
-
52
- def self.open_database(path, write, serializer = nil, type = "HDB", options = {})
53
- case type
54
- when "LevelDB"
55
- Persist.open_leveldb(path, write, serializer)
56
- when "CDB"
57
- Persist.open_cdb(path, write, serializer)
58
- when "LMDB"
59
- Persist.open_lmdb(path, write, serializer)
60
- when 'kch', 'kct'
61
- Persist.open_kyotocabinet(path, write, serializer, type)
62
- when 'fwt'
63
- value_size, range, update, in_memory, pos_function = Misc.process_options options.dup, :value_size, :range, :update, :in_memory, :pos_function
64
- if pos_function
65
- Persist.open_fwt(path, value_size, range, serializer, update, in_memory, &pos_function)
66
- else
67
- Persist.open_fwt(path, value_size, range, serializer, update, in_memory)
68
- end
69
- when 'pki'
70
- pattern, pos_function = Misc.process_options options.dup, :pattern, :pos_function
71
- if pos_function
72
- Persist.open_pki(path, write, pattern, &pos_function)
73
- else
74
- Persist.open_pki(path, write, pattern)
75
- end
76
- else
77
- Persist.open_tokyocabinet(path, write, serializer, type)
78
- end
79
- end
80
-
81
- def self.persist_tsv(source, filename = nil, options = {}, persist_options = {}, &block)
82
- persist_options[:prefix] ||= "TSV"
83
-
84
- if data = persist_options[:data]
85
- Log.debug "TSV persistence creating with data: #{ Misc.fingerprint(data) }"
86
- yield data
87
- return data
88
- end
89
-
90
- filename ||= get_filename(source)
91
-
92
- if not persist_options[:persist]
93
- data = {}
94
-
95
- yield(data)
96
-
97
- return data
98
- end
99
-
100
- path = persistence_path(filename, persist_options, options)
101
-
102
- if ENV["RBBT_UPDATE_TSV_PERSIST"] == 'true' and filename
103
- check_options = {:check => [filename]}
104
- else
105
- check_options = {}
106
- end
107
-
108
- if is_persisted?(path, check_options) and not persist_options[:update]
109
- path = path.find if Path === path
110
- Log.debug "TSV persistence up-to-date: #{ path }"
111
- if persist_options[:shard_function]
112
- return open_sharder(path, false, nil, persist_options[:engine], persist_options, &persist_options[:shard_function])
113
- else
114
- return open_database(path, false, nil, persist_options[:engine] || TokyoCabinet::HDB, persist_options)
115
- end
116
- end
117
-
118
- lock_filename = Persist.persistence_path(path, {:dir => TSV.lock_dir})
119
- Misc.lock lock_filename do
120
- begin
121
- if is_persisted?(path, check_options) and not persist_options[:update]
122
- path = path.find if Path === path
123
- Log.debug "TSV persistence (suddenly) up-to-date: #{ path }"
124
-
125
- if persist_options[:shard_function]
126
- return open_sharder(path, false, nil, persist_options[:engine], persist_options, &persist_options[:shard_function])
127
- else
128
- return open_database(path, false, nil, persist_options[:engine] || TokyoCabinet::HDB, persist_options)
129
- end
130
- end
131
- path = path.find if Path === path
132
-
133
- FileUtils.rm_rf path if File.exist? path
134
-
135
- Log.medium "TSV persistence creating: #{ path }"
136
-
137
- tmp_path = path + '.persist'
138
-
139
- data = if persist_options[:shard_function]
140
- open_sharder(tmp_path, true, persist_options[:serializer], persist_options[:engine], persist_options, &persist_options[:shard_function])
141
- else
142
- open_database(tmp_path, true, persist_options[:serializer], persist_options[:engine] || TokyoCabinet::HDB, persist_options)
143
- end
144
-
145
- if TSV === data and data.serializer.nil?
146
- data.serializer = :type
147
- end
148
-
149
- if persist_options[:persist] == :preload
150
- tmp_tsv = yield({})
151
- tmp_tsv.annotate data
152
- data.serializer = tmp_tsv.type
153
- data.write_and_read do
154
- tmp_tsv.each do |k,v|
155
- data[k] = v
156
- end
157
- end
158
- else
159
- data.write_and_read do
160
- yield data
161
- end
162
- end
163
-
164
- data.write_and_read do
165
- FileUtils.mv data.persistence_path, path if File.exist? data.persistence_path and not File.exist? path
166
- tsv = CONNECTIONS[path] = CONNECTIONS.delete tmp_path
167
- tsv.persistence_path = path
168
-
169
- tsv.fix_io if tsv.respond_to? :fix_io
170
- end
171
-
172
- data
173
- rescue Exception
174
- Log.error "Captured error during persist_tsv. Erasing: #{path}"
175
- FileUtils.rm_rf tmp_path if tmp_path and File.exist? tmp_path
176
- FileUtils.rm_rf path if path and File.exist? path
177
- raise $!
178
- end
179
- end
180
- end
181
-
182
- end
183
-
184
- require 'rbbt/persist/tsv/sharder'
185
-
1
+ require_relative '../refactor'
2
+ Rbbt.require_instead 'scout/persist/tsv'
3
+ #require 'rbbt/persist/tsv/adapter'
4
+ #
5
+ #require 'rbbt/persist/tsv/fix_width_table'
6
+ #require 'rbbt/persist/tsv/packed_index'
7
+ #
8
+ #begin
9
+ # require 'rbbt/persist/tsv/tokyocabinet'
10
+ #rescue Exception
11
+ # Log.warn "The tokyocabinet gem could not be loaded. Persistence using this engine will fail."
12
+ #end
13
+ #
14
+ #begin
15
+ # require 'rbbt/persist/tsv/lmdb'
16
+ #rescue Exception
17
+ # Log.debug "The lmdb gem could not be loaded. Persistence using this engine will fail."
18
+ #end
19
+ #
20
+ #begin
21
+ # require 'rbbt/persist/tsv/leveldb'
22
+ #rescue Exception
23
+ # Log.debug "The LevelDB gem could not be loaded. Persistence using this engine will fail."
24
+ #end
25
+ #
26
+ #begin
27
+ # require 'rbbt/persist/tsv/cdb'
28
+ #rescue Exception
29
+ # Log.debug "The CDB gem could not be loaded. Persistence using this engine will fail."
30
+ #end
31
+ #
32
+ #begin
33
+ # require 'rbbt/persist/tsv/kyotocabinet'
34
+ #rescue Exception
35
+ # Log.debug "The kyotocabinet gem could not be loaded. Persistence using this engine will fail."
36
+ #end
37
+ #
38
+ #module Persist
39
+ # CONNECTIONS = {}
40
+ #
41
+ # def self.get_filename(source)
42
+ # case
43
+ # when Path === source
44
+ # source
45
+ # when (source.respond_to?(:filename) and source.filename)
46
+ # source.filename
47
+ # when source.respond_to?(:cmd)
48
+ # "CMD-#{Misc.digest(source.cmd)}"
49
+ # when TSV === source
50
+ # "TSV[#{Misc.digest Misc.fingerprint(source)}]"
51
+ # end || source.object_id.to_s
52
+ # end
53
+ #
54
+ # def self.open_database(path, write, serializer = nil, type = "HDB", options = {})
55
+ # case type
56
+ # when "LevelDB"
57
+ # Persist.open_leveldb(path, write, serializer)
58
+ # when "CDB"
59
+ # Persist.open_cdb(path, write, serializer)
60
+ # when "LMDB"
61
+ # Persist.open_lmdb(path, write, serializer)
62
+ # when 'kch', 'kct'
63
+ # Persist.open_kyotocabinet(path, write, serializer, type)
64
+ # when 'fwt'
65
+ # value_size, range, update, in_memory, pos_function = Misc.process_options options.dup, :value_size, :range, :update, :in_memory, :pos_function
66
+ # if pos_function
67
+ # Persist.open_fwt(path, value_size, range, serializer, update, in_memory, &pos_function)
68
+ # else
69
+ # Persist.open_fwt(path, value_size, range, serializer, update, in_memory)
70
+ # end
71
+ # when 'pki'
72
+ # pattern, pos_function = Misc.process_options options.dup, :pattern, :pos_function
73
+ # if pos_function
74
+ # Persist.open_pki(path, write, pattern, &pos_function)
75
+ # else
76
+ # Persist.open_pki(path, write, pattern)
77
+ # end
78
+ # else
79
+ # Persist.open_tokyocabinet(path, write, serializer, type)
80
+ # end
81
+ # end
82
+ #
83
+ # def self.persist_tsv(source, filename = nil, options = {}, persist_options = {}, &block)
84
+ # persist_options[:prefix] ||= "TSV"
85
+ #
86
+ # if data = persist_options[:data]
87
+ # Log.debug "TSV persistence creating with data: #{ Misc.fingerprint(data) }"
88
+ # yield data
89
+ # return data
90
+ # end
91
+ #
92
+ # filename ||= get_filename(source)
93
+ #
94
+ # if not persist_options[:persist]
95
+ # data = {}
96
+ #
97
+ # yield(data)
98
+ #
99
+ # return data
100
+ # end
101
+ #
102
+ # path = persistence_path(filename, options)
103
+ #
104
+ # if ENV["RBBT_UPDATE_TSV_PERSIST"] == 'true' and filename
105
+ # check_options = {:check => [filename]}
106
+ # else
107
+ # check_options = {}
108
+ # end
109
+ #
110
+ # if is_persisted?(path, check_options) and not persist_options[:update]
111
+ # path = path.find if Path === path
112
+ # Log.debug "TSV persistence up-to-date: #{ path }"
113
+ # if persist_options[:shard_function]
114
+ # return open_sharder(path, false, nil, persist_options[:engine], persist_options, &persist_options[:shard_function])
115
+ # else
116
+ # return open_database(path, false, nil, persist_options[:engine] || TokyoCabinet::HDB, persist_options)
117
+ # end
118
+ # end
119
+ #
120
+ # lock_filename = Persist.persistence_path(path, {:dir => TSV.lock_dir})
121
+ # Misc.lock lock_filename do
122
+ # begin
123
+ # if is_persisted?(path, check_options) and not persist_options[:update]
124
+ # path = path.find if Path === path
125
+ # Log.debug "TSV persistence (suddenly) up-to-date: #{ path }"
126
+ #
127
+ # if persist_options[:shard_function]
128
+ # return open_sharder(path, false, nil, persist_options[:engine], persist_options, &persist_options[:shard_function])
129
+ # else
130
+ # return open_database(path, false, nil, persist_options[:engine] || TokyoCabinet::HDB, persist_options)
131
+ # end
132
+ # end
133
+ # path = path.find if Path === path
134
+ #
135
+ # FileUtils.rm_rf path if File.exist? path
136
+ #
137
+ # Log.medium "TSV persistence creating: #{ path }"
138
+ #
139
+ # tmp_path = path + '.persist'
140
+ #
141
+ # data = if persist_options[:shard_function]
142
+ # open_sharder(tmp_path, true, persist_options[:serializer], persist_options[:engine], persist_options, &persist_options[:shard_function])
143
+ # else
144
+ # open_database(tmp_path, true, persist_options[:serializer], persist_options[:engine] || TokyoCabinet::HDB, persist_options)
145
+ # end
146
+ #
147
+ # if TSV === data and data.serializer.nil?
148
+ # data.serializer = :type
149
+ # end
150
+ #
151
+ # if persist_options[:persist] == :preload
152
+ # tmp_tsv = yield({})
153
+ # tmp_tsv.annotate data
154
+ # data.serializer = tmp_tsv.type
155
+ # data.write_and_read do
156
+ # tmp_tsv.each do |k,v|
157
+ # data[k] = v
158
+ # end
159
+ # end
160
+ # else
161
+ # data.write_and_read do
162
+ # yield data
163
+ # end
164
+ # end
165
+ #
166
+ # data.write_and_read do
167
+ # FileUtils.mv data.persistence_path, path if File.exist? data.persistence_path and not File.exist? path
168
+ # tsv = CONNECTIONS[path] = CONNECTIONS.delete tmp_path
169
+ # tsv.persistence_path = path
170
+ #
171
+ # tsv.fix_io if tsv.respond_to? :fix_io
172
+ # end
173
+ #
174
+ # data
175
+ # rescue Exception
176
+ # Log.error "Captured error during persist_tsv. Erasing: #{path}"
177
+ # FileUtils.rm_rf tmp_path if tmp_path and File.exist? tmp_path
178
+ # FileUtils.rm_rf path if path and File.exist? path
179
+ # raise $!
180
+ # end
181
+ # end
182
+ # end
183
+ #
184
+ #end
185
+ #
186
+ #require 'rbbt/persist/tsv/sharder'
187
+ #