class Pwrake::QueueArray
Public Class Methods
new(nproc)
click to toggle source
Calls superclass method
# File lib/pwrake/queue/queue_array.rb, line 8 def initialize(nproc) @nproc = nproc super() end
Public Instance Methods
find_rank(ncore)
click to toggle source
# File lib/pwrake/queue/queue_array.rb, line 34 def find_rank(ncore) if empty? return 0 end count = [] size.times do |i| tw = q_at(i) r = tw.rank c = (count[r]||0) + tw.use_cores(ncore) if c >= @nproc return r end count[r] = c end count.size - 1 end
shift(host_info, req_rank=0)
click to toggle source
# File lib/pwrake/queue/queue_array.rb, line 13 def shift(host_info, req_rank=0) i_tried = nil size.times do |i| tw = q_at(i) if tw.rank >= req_rank && tw.acceptable_for(host_info) if tw.tried_host?(host_info) i_tried ||= i else Log.debug "#{self.class}: task=#{tw.name} i=#{i}/#{size} rank=#{tw.rank}" return q_delete_at(i) end end end if i_tried tw = q_at(i_tried) Log.debug "#{self.class}(retry): task=#{tw.name} i=#{i_tried}/#{size} rank=#{tw.rank}" return q_delete_at(i_tried) end nil end