Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 """Checks confidence level for different result source (try job or heuristic) | |
| 6 or different score for heuristic results.""" | |
| 7 from collections import defaultdict | |
| 8 import datetime | |
| 9 import json | |
| 10 import os | |
| 11 import sys | |
| 12 | |
| 13 _REMOTE_API_DIR = os.path.join(os.path.dirname(__file__), os.path.pardir) | |
| 14 sys.path.insert(1, _REMOTE_API_DIR) | |
| 15 | |
| 16 import remote_api | |
| 17 | |
| 18 from model import result_status | |
| 19 from model.wf_analysis import WfAnalysis | |
| 20 from model.wf_try_job_data import WfTryJobData | |
| 21 | |
| 22 | |
| 23 DAYS = 30 | |
| 24 | |
| 25 CORRECT_RESULT_STATUSES = [result_status.FOUND_CORRECT, | |
| 26 result_status.FOUND_CORRECT_DUPLICATE] | |
| 27 INCORRECT_RESULT_STATUSES = [result_status.FOUND_INCORRECT, | |
| 28 result_status.FOUND_INCORRECT_DUPLICATE] | |
| 29 TRIAGED_RESULT_STATUSES = [result_status.FOUND_CORRECT, | |
| 30 result_status.FOUND_CORRECT_DUPLICATE, | |
| 31 result_status.FOUND_INCORRECT, | |
| 32 result_status.FOUND_INCORRECT_DUPLICATE] | |
| 33 | |
| 34 if __name__ == '__main__': | |
| 35 # Set up the Remote API to use services on the live App Engine. | |
| 36 remote_api.EnableRemoteApi(app_id='findit-for-me') | |
| 37 | |
| 38 end_date = datetime.datetime.utcnow().replace( | |
| 39 hour=0, minute=0, second=0, microsecond=0) | |
| 40 start_date = end_date - datetime.timedelta(days=DAYS) | |
| 41 | |
| 42 try_job_data_query = WfTryJobData.query( | |
| 43 WfTryJobData.request_time >= start_date, | |
| 44 WfTryJobData.request_time < end_date) | |
| 45 try_job_data_list = try_job_data_query.fetch() | |
| 46 | |
| 47 total_triaged_try_job_num = 0 | |
| 48 correct_try_job_num = 0 | |
| 49 total_triaged_compile_num = 0 | |
| 50 correct_compile_num = 0 | |
| 51 total_triaged_test_num = 0 | |
| 52 correct_test_num = 0 | |
| 53 for data in try_job_data_list: | |
| 54 if data.error: | |
| 55 continue | |
| 56 analysis = WfAnalysis.Get( | |
| 57 data.master_name, data.builder_name, data.build_number) | |
| 58 if (analysis and analysis.result_status in TRIAGED_RESULT_STATUSES and | |
| 59 len(analysis.suspected_cls) == 1): | |
|
stgao
2016/06/17 18:38:59
What if the try-job finds nothing while analysis.s
chanli
2016/06/17 22:01:28
Added a check of data.culprits
| |
| 60 total_triaged_try_job_num += 1 | |
| 61 if data.try_job_type == 'compile': | |
|
lijeffrey
2016/06/17 19:43:11
just to be safe i'd add data.try_job_type.lower()
chanli
2016/06/17 22:01:28
Done.
| |
| 62 total_triaged_compile_num += 1 | |
| 63 else: | |
| 64 total_triaged_test_num += 1 | |
| 65 if analysis.result_status in CORRECT_RESULT_STATUSES: | |
| 66 correct_try_job_num += 1 | |
| 67 if data.try_job_type == 'compile': | |
| 68 correct_compile_num += 1 | |
| 69 else: | |
| 70 correct_test_num += 1 | |
| 71 | |
| 72 | |
| 73 print total_triaged_try_job_num | |
| 74 print correct_try_job_num | |
| 75 print float(correct_try_job_num)/total_triaged_try_job_num | |
| 76 print | |
| 77 print total_triaged_compile_num | |
| 78 print correct_compile_num | |
| 79 print float(correct_compile_num)/total_triaged_compile_num | |
| 80 print | |
| 81 print total_triaged_test_num | |
| 82 print correct_test_num | |
| 83 print float(correct_test_num)/total_triaged_test_num | |
| OLD | NEW |