#NEWLINE# def ache_log_statistics( crawl ) : #NEWLINE# #INDENT# harvest_path = os . path . join ( crawl . get_crawl_path ( ) , 'data_monitor/harvestinfo.csv' ) #NEWLINE# proc = subprocess . Popen ( [ 'tail' , '-n' , '1' , harvest_path ] , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) #NEWLINE# ( stdout , stderr ) = proc . communicate ( ) #NEWLINE# if ( stderr and ( b'No such file or directory' not in stderr ) ) : #NEWLINE# #INDENT# raise AcheException ( stderr ) #NEWLINE# #UNINDENT# harvest_stats = stdout . decode ( ) #NEWLINE# if ( not harvest_stats ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# ( relevant , crawled ) = tuple ( harvest_stats . split ( '\t' ) [ : 2 ] ) #NEWLINE# crawl . harvest_rate = ( '%.2f' % ( float ( relevant ) / float ( crawled ) ) ) #NEWLINE# crawl . pages_crawled = crawled #NEWLINE# crawl . save ( )