@gen.engine
def DetermineStartDate(client, job, callback):
 start_date = options.options.start_date
 if options.options.smart_scan:
  last_run = (yield gen.Task(job.FindLastSuccess, with_payload_key='stats.last_day'))
  if (last_run is None):
   logging.info('No previous successful scan found, rerun with --start_date')
   callback(None)
   return
  last_run_start = last_run['start_time']
  if ((last_run_start + (options.options.hours_between_runs * constants.SECONDS_PER_HOUR)) > time.time()):
   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)))
   callback(None)
   return
  last_day = last_run['stats.last_day']
  start_time = (util.ISO8601ToUTCTimestamp(last_day) + constants.SECONDS_PER_DAY)
  start_date = util.TimestampUTCToISO8601(start_time)
  logging.info(('Last successful run (%s) scanned up to %s, setting start date to %s' % (time.asctime(time.localtime(last_run_start)), last_day, start_date)))
 callback(start_date)

@ gen . engine def DetermineStartDate ( client , job , callback ) : start_date = options . options . start_date if options . options . smart_scan : last_run = ( yield gen . Task ( job . FindLastSuccess , with_payload_key = 'stats.last_day' ) ) if ( last_run is None ) : logging . info ( 'No previous successful scan found, rerun with --start_date' ) callback ( None ) return last_run_start = last_run [ 'start_time' ] if ( ( last_run_start + ( options . options . hours_between_runs * constants . SECONDS_PER_HOUR ) ) > time . time ( ) ) : 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 ) ) ) callback ( None ) return last_day = last_run [ 'stats.last_day' ] start_time = ( util . ISO8601ToUTCTimestamp ( last_day ) + constants . SECONDS_PER_DAY ) start_date = util . TimestampUTCToISO8601 ( start_time ) logging . info ( ( 'Last successful run (%s) scanned up to %s, setting start date to %s' % ( time . asctime ( time . localtime ( last_run_start ) ) , last_day , start_date ) ) ) callback ( start_date )
if smart_scan is true .