#NEWLINE# @ gen . engine #NEWLINE# def RunOnce( client , job , callback ) : #NEWLINE# #INDENT# 'Get list of files and call processing function.' #NEWLINE# logs_paths = logs_util . ServerLogsPaths ( 'viewfinder' , 'full' ) #NEWLINE# merged_store = ObjectStore . GetInstance ( logs_paths . MERGED_LOGS_BUCKET ) #NEWLINE# start_date = options . options . start_date #NEWLINE# if options . options . smart_scan : #NEWLINE# #INDENT# last_run = ( yield gen . Task ( job . FindLastSuccess , with_payload_key = 'stats.last_day' ) ) #NEWLINE# if ( last_run is None ) : #NEWLINE# #INDENT# logging . info ( 'No previous successful scan found, rerun with --start_date' ) #NEWLINE# callback ( None ) #NEWLINE# return #NEWLINE# #UNINDENT# last_run_start = start_date [ 'start_time' ] #NEWLINE# if ( util . HoursSince ( last_run_start ) < options . options . hours_between_runs ) : #NEWLINE# #INDENT# logging . info ( ( 'Last successful run started at %s, less than %d hours ago; skipping.' % ( time . asctime ( time . localtime ( last_run_start ) ) , options . options . hours_between_runs ) ) ) #NEWLINE# callback ( None ) #NEWLINE# return #NEWLINE# #UNINDENT# last_day = last_run [ 'stats.last_day' ] #NEWLINE# start_time = ( util . ISO8601ToUTCTimestamp ( last_day , hour = 12 ) - constants . SECONDS_PER_DAY ) #NEWLINE# start_date = util . TimestampUTCToISO8601 ( start_time ) #NEWLINE# logging . info ( ( 'Last successful analyze_logs run (%s) scanned up to %s, setting analysis start date to %s' % ( time . asctime ( time . localtime ( last_run_start ) ) , last_day , start_date ) ) ) #NEWLINE# #UNINDENT# files = ( yield gen . Task ( GetMergedLogsFileList , merged_store , logs_paths , start_date ) ) #NEWLINE# last_day = ( yield gen . Task ( ProcessFiles , merged_store , logs_paths , files ) ) #NEWLINE# callback ( last_day ) #NEWLINE# return