class ATU::ClientRet

Attributes

job_id[RW]

Public Class Methods

check_job_done() click to toggle source
# File lib/woolen_common/ruby_proxy/client.rb, line 18
def check_job_done
    # 60 * 10 / 0.5  10分钟内跑不完认为任务结束
    start_time = Time.now.to_i
    cnt = 0
    loop do
        if RubyProxy::DRbClient.client.is_job_done?(self.job_id)
            debug "job[#{job_id}] done"
            return true
        else
            cnt += 1
            if cnt % 20 == 1
                debug "job[#{job_id}] is still running"
            end
            sleep 0.5
            if Time.now.to_i - start_time > ATUConfig.timeout
                warn "the time to check job done is over #{ATUConfig.timeout} sec"
                return false
            end
        end
    end
end
get_job_ret() click to toggle source
# File lib/woolen_common/ruby_proxy/client.rb, line 40
def get_job_ret
    if check_job_done
        return RubyProxy::DRbClient.client.get_the_job_ret(self.job_id)
    end
    nil
end