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

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

Issue 2361583002: [Findit] UI change and triage change for cl level trige. (Closed)
Patch Set: . 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 | « appengine/findit/main.py ('k') | appengine/findit/model/suspected_cl_status.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 from google.appengine.ext import ndb
6
7 from common.time_util import GetUTCNow
8 from model.versioned_model import VersionedModel
9
10 class ConfidenceInformation(ndb.Model):
11 correct = ndb.IntegerProperty()
12 total = ndb.IntegerProperty()
13 confidence = ndb.FloatProperty()
14
15 # score is specific for confidence of heuristic results.
16 score = ndb.IntegerProperty(default=None)
17
18 def ToDict(self):
19 dict_format = {
20 'correct': self.correct,
21 'total': self.total,
22 'confidence': self.confidence
23 }
24 return dict_format
25
26
27 class SuspectedCLConfidence(VersionedModel):
28 """Stores confidence data of different types of suspected CLs.
29
30 Confidence data includes confidence scores and the numbers we used to get
31 those scores.
32
33 The types of suspected CLs are:
34 1. CLs for compile failures found by Heuristic approach.
35 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 3. CLs for compile failures found by both approaches.
38 4. CLs for test failures found by Heuristic approach.
39 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 6. CLs for test failures found by both approaches.
42 """
43
44 # Start date of querying suspected CLs.
45 # Note: the confidence scores will be for all the CLs up until end_date,
46 # not just for CLs from start date to end_date.
47 start_date = ndb.DateTimeProperty(indexed=False)
48
49 # End date of querying suspected CLs.
50 end_date = ndb.DateTimeProperty(indexed=True)
51
52 # Time when the instance is updated.
53 updated_time = ndb.DateTimeProperty(indexed=True)
54
55 # Confidence scores for CLs for compile failures found by Heuristic approach.
56 compile_heuristic = ndb.LocalStructuredProperty(
57 ConfidenceInformation, repeated=True)
58
59 # Confidence score for CLs for compile failures found by Try Job approach.
60 compile_try_job = ndb.LocalStructuredProperty(ConfidenceInformation)
61
62 # Confidence score for CLs for compile failures found by both approaches.
63 compile_heuristic_try_job = ndb.LocalStructuredProperty(ConfidenceInformation)
64
65 # Confidence scores for CLs for test failures found by Heuristic approach.
66 test_heuristic = ndb.LocalStructuredProperty(
67 ConfidenceInformation, repeated=True)
68
69 # Confidence score for CLs for test failures found by Try Job approach.
70 test_try_job = ndb.LocalStructuredProperty(ConfidenceInformation)
71
72 # Confidence score for CLs for test failures found by both approaches.
73 test_heuristic_try_job = ndb.LocalStructuredProperty(ConfidenceInformation)
74
75 @classmethod
76 def Get(cls, version=None):
77 confidences = cls.GetVersion(version=version)
78 return confidences or cls() if version is None else confidences
79
80 def Update(
81 self, start_date, end_date,
82 compile_heuristic, compile_try_job, compile_heuristic_try_job,
83 test_heuristic, test_try_job, test_heuristic_try_job):
84
85 self.start_date = start_date
86 self.end_date = end_date
87 self.updated_time = GetUTCNow()
88 self.compile_heuristic = compile_heuristic
89 self.compile_try_job = compile_try_job
90 self.compile_heuristic_try_job = compile_heuristic_try_job
91 self.test_heuristic = test_heuristic
92 self.test_try_job = test_try_job
93 self.test_heuristic_try_job = test_heuristic_try_job
94
95 if self.end_date <= end_date:
96 self.put()
97 else:
98 self.Save()
OLDNEW
« no previous file with comments | « appengine/findit/main.py ('k') | appengine/findit/model/suspected_cl_status.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698