Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: appengine/findit/model/suspected_cl_confidence.py

Issue 2072893002: [Findit] scripts to calculate confidence level of Findit results. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | appengine/findit/util_scripts/remote_queries/calculate_confidence_scores.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from google.appengine.ext import ndb 5 from google.appengine.ext import ndb
6 6
7 from common.time_util import GetUTCNow 7 from common.time_util import GetUTCNow
8 from model.versioned_model import VersionedModel 8 from model.versioned_model import VersionedModel
9 9
10
10 class ConfidenceInformation(ndb.Model): 11 class ConfidenceInformation(ndb.Model):
11 correct = ndb.IntegerProperty() 12 correct = ndb.IntegerProperty()
12 total = ndb.IntegerProperty() 13 total = ndb.IntegerProperty()
13 confidence = ndb.FloatProperty() 14 confidence = ndb.FloatProperty()
14 15
15 # score is specific for confidence of heuristic results. 16 # score is specific for confidence of heuristic results.
16 score = ndb.IntegerProperty(default=None) 17 score = ndb.IntegerProperty(default=None)
17 18
18 def ToDict(self): 19 def ToDict(self):
19 dict_format = { 20 dict_format = {
(...skipping 15 matching lines...) Expand all
35 a. The score has been further refined by the top score of hints. 36 a. The score has been further refined by the top score of hints.
36 2. CLs for compile failures found by Try Job approach. 37 2. CLs for compile failures found by Try Job approach.
37 3. CLs for compile failures found by both approaches. 38 3. CLs for compile failures found by both approaches.
38 4. CLs for test failures found by Heuristic approach. 39 4. CLs for test failures found by Heuristic approach.
39 a. The score has been further refined by the top score of hints. 40 a. The score has been further refined by the top score of hints.
40 5. CLs for test failures found by Try Job approach. 41 5. CLs for test failures found by Try Job approach.
41 6. CLs for test failures found by both approaches. 42 6. CLs for test failures found by both approaches.
42 """ 43 """
43 44
44 # Start date of querying suspected CLs. 45 # Start date of querying suspected CLs.
45 # Note: the confidence scores will be for all the CLs up until end_date, 46 # Note: the start date will be 6 months before end date.
46 # not just for CLs from start date to end_date.
47 start_date = ndb.DateTimeProperty(indexed=False) 47 start_date = ndb.DateTimeProperty(indexed=False)
48 48
49 # End date of querying suspected CLs. 49 # End date of querying suspected CLs.
50 end_date = ndb.DateTimeProperty(indexed=True) 50 end_date = ndb.DateTimeProperty(indexed=True)
51 51
52 # Time when the instance is updated. 52 # Time when the instance is updated.
53 updated_time = ndb.DateTimeProperty(indexed=True) 53 updated_time = ndb.DateTimeProperty(indexed=True)
54 54
55 # Confidence scores for CLs for compile failures found by Heuristic approach. 55 # Confidence scores for CLs for compile failures found by Heuristic approach.
56 compile_heuristic = ndb.LocalStructuredProperty( 56 compile_heuristic = ndb.LocalStructuredProperty(
(...skipping 11 matching lines...) Expand all
68 68
69 # Confidence score for CLs for test failures found by Try Job approach. 69 # Confidence score for CLs for test failures found by Try Job approach.
70 test_try_job = ndb.LocalStructuredProperty(ConfidenceInformation) 70 test_try_job = ndb.LocalStructuredProperty(ConfidenceInformation)
71 71
72 # Confidence score for CLs for test failures found by both approaches. 72 # Confidence score for CLs for test failures found by both approaches.
73 test_heuristic_try_job = ndb.LocalStructuredProperty(ConfidenceInformation) 73 test_heuristic_try_job = ndb.LocalStructuredProperty(ConfidenceInformation)
74 74
75 @classmethod 75 @classmethod
76 def Get(cls, version=None): 76 def Get(cls, version=None):
77 confidences = cls.GetVersion(version=version) 77 confidences = cls.GetVersion(version=version)
78 return confidences or cls() if version is None else confidences 78 return (confidences or VersionedModel.Create() if version is None
79 else confidences)
79 80
80 def Update( 81 def Update(
81 self, start_date, end_date, 82 self, start_date, end_date,
82 compile_heuristic, compile_try_job, compile_heuristic_try_job, 83 compile_heuristic, compile_try_job, compile_heuristic_try_job,
83 test_heuristic, test_try_job, test_heuristic_try_job): 84 test_heuristic, test_try_job, test_heuristic_try_job):
84 85
85 self.start_date = start_date 86 self.start_date = start_date
86 self.end_date = end_date 87 self.end_date = end_date
87 self.updated_time = GetUTCNow() 88 self.updated_time = GetUTCNow()
88 self.compile_heuristic = compile_heuristic 89 self.compile_heuristic = compile_heuristic
89 self.compile_try_job = compile_try_job 90 self.compile_try_job = compile_try_job
90 self.compile_heuristic_try_job = compile_heuristic_try_job 91 self.compile_heuristic_try_job = compile_heuristic_try_job
91 self.test_heuristic = test_heuristic 92 self.test_heuristic = test_heuristic
92 self.test_try_job = test_try_job 93 self.test_try_job = test_try_job
93 self.test_heuristic_try_job = test_heuristic_try_job 94 self.test_heuristic_try_job = test_heuristic_try_job
94 95
95 if self.end_date <= end_date: 96 if self.end_date <= end_date:
96 self.put() 97 self.put()
97 else: 98 else:
98 self.Save() 99 self.Save()
OLDNEW
« no previous file with comments | « no previous file | appengine/findit/util_scripts/remote_queries/calculate_confidence_scores.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698