Ñò i'dWc@sDdZddkZddkZddkZdefd„ƒYZdS(s,Progress monitor for the transfer checkpointiÿÿÿÿNt ProgressMoncBsVeZdZddddd dd„Zddd„Zdd„Zd„Zd „ZRS( s[The ProgressMon class contains methods to monitor the progress of the transfer. igà?cCsL||_||_||_||_||_||_d|_t|_ dS(N( t distrosizetinitpcttendpcttdonetloggert sleep_fortNonetthread1tFalsetprog_init_completed(tselfRRRRRR((s ../prog.pyt__init__%s       idcCsu||_||_||_t|_tid|id|fƒ|_|ii ƒx|i pt i dƒqUWdS(sQStart a thread to monitor the progress populating a file system. Input: filesys - file system to monitor distrosize - full distro size in kilobytes initpct - base percent value from which to start calculating endpct - percentage value at which to stop calculating ttargettargsgà?N( RRRR Rt threadingtThreadt_ProgressMon__progressthreadRtstartR ttimetsleep(R tfilesysRRR((s ../prog.pyt startmonitor0s      ixcCs8|ii|ƒ|iiƒo|iidƒndS(sEWait until the thread whose join() method is called terminates. Input: timeout - number of second to wait for the thread to terminate. If it is desired to block until the thread terminates, timeout=None should be used. s-Progress monitoring thread is not terminated.N(RtjointisAliveRtdebug(R ttimeout((s ../prog.pytwaitBs cCsFy,ti|ƒ}|i|i|idSWntj onXdS(s±Find the current size of the specified file system. Input: filesystem - filesystem to find size of. Returns: size of the filesystem in kilobytes. iN(toststatvfstf_blockstf_bfreetf_frsizetOSError(R t filesystemtstat((s ../prog.pyt__fssizeQs c Cs‰d}y(x!|djo|i|ƒ}q WWn$tj o}t|_|‚nX|i|i}d}t|_xto|iodSti |i ƒ|i|ƒ}|djoqwn||}|djoqwn|d|i }|||i |i} | |ijp |djo |i} n| |jo#|i i dt| ƒƒ| }n| |ijp |iodSqwWdS(svMonitor the progress in populating the file system. Input: filesystem - the file system to monitor iÿÿÿÿNiidsTransferring contents(Rt_ProgressMon__fssizet ExceptiontTrueR RRRRRRRRtreport_progresstint( R R"tinitsizetexttotpcttprevpcttfssztfsgaint actualpcttpct((s ../prog.pyt__progressthread]s>           N( t__name__t __module__t__doc__RR RRR%R(((s ../prog.pyR!s   (R5RRRtobjectR(((s ../prog.pyts