lib/rbbt/util/misc/development.rb in rbbt-util-5.17.35 vs lib/rbbt/util/misc/development.rb in rbbt-util-5.17.37
- old
+ new
@@ -7,10 +7,11 @@
def self.pre_fork
Persist::CONNECTIONS.values.each do |db|
db.close if db.write?
end
+ Log::ProgressBar::BARS.clear
ObjectSpace.each_object(Mutex) do |m|
begin
m.unlock
rescue ThreadError
end if m.locked?
@@ -295,24 +296,26 @@
else
raise "Parameter 'num' not understood: #{Misc.fingerprint num}"
end
- options = Misc.add_defaults options, :respawn => true, :cpus => cpus, :into => Set.new
+ #options = Misc.add_defaults options, :respawn => true, :cpus => cpus, :into => Set.new
+ options = Misc.add_defaults options, :respawn => true, :cpus => cpus
options = Misc.add_defaults options, :bar => "Bootstrap in #{ options[:cpus] } cpus: #{ Misc.fingerprint Annotated.purge(elems) }"
respawn = options[:respawn] and options[:cpus] and options[:cpus].to_i > 1
index = (0..elems.length-1).to_a.collect{|v| v.to_s }
TSV.traverse index, options do |pos|
elem = elems[pos.to_i]
elems.annotate elem if elems.respond_to? :annotate
begin
- yield elem
+ res = yield elem
rescue Interrupt
Log.warn "Process #{Process.pid} was aborted"
end
- raise RbbtProcessQueue::RbbtProcessQueueWorker::Respawn if respawn == :always and cpus > 1
- nil
+ res = nil unless options[:into]
+ raise RbbtProcessQueue::RbbtProcessQueueWorker::Respawn, res if respawn == :always and cpus > 1
+ res
end
end
def self.memory_use(pid=nil)
`ps -o rss -p #{pid || $$}`.strip.split.last.to_i