@@ -0,0 +1,2689 @@
+import sys%0Aimport MySQLdb%0Aimport traceback%0Aimport time%0A%0Adef failure_report(args):%0A  mr_unit = MySQLdb.connect(host='172.16.2.178', user='root', passwd=args%5B1%5D, db='mr_unit')%0A  mr_unit.autocommit(False)%0A  cursor = mr_unit.cursor()%0A%0A  # the jenkins job is scheduled to run every morning at 8 am (local). By default, we report the failures starting from%0A  # 8 pm (local) of the previous day.%0A  try:%0A    start_time = args%5B2%5D%0A  except IndexError:%0A    yesterday = time.localtime(time.time() - 24 * 60 * 60)%0A    start_time = time.mktime(yesterday) - yesterday.tm_hour*60*60 - yesterday.tm_min*60 - yesterday.tm_sec + 20*60*60%0A%0A  try:%0A    end_time = args%5B3%5D%0A  except IndexError:%0A    end_time = time.time()%0A%0A  try:%0A    cursor.execute('select * from perf where (%60start_time%60 %3E %7B0%7D and %60end_time%60 %3C %7B1%7D and '%0A                   '%60pass%60 = 0);'.format(start_time, end_time))%0A    failures = cursor.fetchall()%0A  except:%0A    cursor.close()%0A    traceback.print_exc()%0A    print %22Failed to retrieve failures from the perf table in mr_unit database for the period from %7B0%7D to %7B1%7D%22%5C%0A      .format(time.strftime('%25Y-%25m-%25d:%25H:%25M:%25S', time.localtime(start_time)),%0A              time.strftime('%25Y-%25m-%25d:%25H:%25M:%25S', time.localtime(end_time)))%0A    raise%0A  cursor.close()%0A%0A  print %22***********************************************************************%22%0A  print %22Failures for the period from %7B0%7D to %7B1%7D%22.format(time.strftime('%25Y-%25m-%25d:%25H:%25M:%25S', time.localtime(start_time)),%0A                                                         time.strftime('%25Y-%25m-%25d:%25H:%25M:%25S', time.localtime(end_time)))%0A  print %22***********************************************************************%5Cn%22%0A%0A  for idx, failure in enumerate(failures):%0A    print '%5CnFAILURE %7B0%7D'.format(idx+1)%0A    print '------------------------------------------------------------------------------'%0A    print 'git branch:                   %7B0%7D'.format(failure%5B3%5D)%0A    print 'git hash:                     %7B0%7D'.format(failure%5B2%5D)%0A    print 'job name:                     %7B0%7D'.format(failure%5B11%5D)%0A    print 'build id:                     %7B0%7D'.format(failure%5B1%5D)%0A    print 'test name:                    %7B0%7D'.format(failure%5B5%5D)%0A    print 'duration (seconds):           %7B0%7D'.format(failure%5B7%5D - failure%5B6%5D)%0A    print 'machine ip:                   %7B0%7D'.format(failure%5B4%5D)%0A    print 'operating system:             %7B0%7D'.format(failure%5B10%5D)%0A    print 'number of cpus:               %7B0%7D'.format(failure%5B9%5D)%0A    print 'datetime (%25Y-%25m-%25d:%25H:%25M:%25S): %7B0%7D'.format(time.strftime('%25Y-%25m-%25d:%25H:%25M:%25S', time.localtime(failure%5B6%5D)))%0A    print '------------------------------------------------------------------------------%5Cn'%0A%0Aif __name__ == '__main__':%0A  failure_report(sys.argv)

add script to make morning failure report.