OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import datetime | 5 import datetime |
6 | 6 |
7 from google.appengine.ext import ndb | 7 from google.appengine.ext import ndb |
8 | 8 |
9 from model.build_run import BuildRun | 9 from model.build_run import BuildRun |
10 | 10 |
11 # A particular occurance of a single flake occuring. | 11 # A particular occurrence of a single flake occuring. |
12 class FlakeOccurance(ndb.Model): | 12 class FlakeOccurrence(ndb.Model): |
13 # step name, i.e. browser_tests | 13 # step name, i.e. browser_tests |
14 name = ndb.StringProperty(required=True) | 14 name = ndb.StringProperty(required=True) |
15 # failre, i.e. FooTest.Bar | 15 # failre, i.e. FooTest.Bar |
16 failure = ndb.StringProperty(required=True) | 16 failure = ndb.StringProperty(required=True) |
17 | 17 |
18 | 18 |
19 # Represents a patchset with a successful and failed try run for a particular | 19 # Represents a patchset with a successful and failed try run for a particular |
20 # builder. The flaky failed run can have multiple different flakes that cause | 20 # builder. The flaky failed run can have multiple different flakes that cause |
21 # it to turn red, each represented by a FlakeOccurance. | 21 # it to turn red, each represented by a FlakeOccurrence. |
22 class FlakyRun(ndb.Model): | 22 class FlakyRun(ndb.Model): |
23 failure_run = ndb.KeyProperty(BuildRun, required=True) | 23 failure_run = ndb.KeyProperty(BuildRun, required=True) |
24 # A copy of failure_run.time_started to reduce lookups. | 24 # A copy of failure_run.time_started to reduce lookups. |
25 failure_run_time_started = ndb.DateTimeProperty(default=datetime.datetime.max) | 25 failure_run_time_started = ndb.DateTimeProperty(default=datetime.datetime.max) |
26 # A copy of failure_run.time_finished to reduce lookups. | 26 # A copy of failure_run.time_finished to reduce lookups. |
27 failure_run_time_finished = ndb.DateTimeProperty(required=True) | 27 failure_run_time_finished = ndb.DateTimeProperty(required=True) |
28 success_run = ndb.KeyProperty(BuildRun, required=True) | 28 success_run = ndb.KeyProperty(BuildRun, required=True) |
29 flakes = ndb.StructuredProperty(FlakeOccurance, repeated=True) | 29 flakes = ndb.StructuredProperty(FlakeOccurrence, repeated=True) |
30 comment = ndb.StringProperty() | 30 comment = ndb.StringProperty() |
31 | 31 |
32 | 32 |
33 # Represents a step that flakes. The name could be a test_suite:test name (i.e. | 33 # Represents a step that flakes. The name could be a test_suite:test name (i.e. |
34 # unit_tests:FooTest), a ninja step in case of compile flake, etc... This entity | 34 # unit_tests:FooTest), a ninja step in case of compile flake, etc... This entity |
35 # groups together all the occurrences of this flake, with each particular | 35 # groups together all the occurrences of this flake, with each particular |
36 # instance of a flake being represented by a FlakyRun. | 36 # instance of a flake being represented by a FlakyRun. |
37 class Flake(ndb.Model): | 37 class Flake(ndb.Model): |
38 name = ndb.StringProperty(required=True) | 38 name = ndb.StringProperty(required=True) |
39 occurrences = ndb.KeyProperty(FlakyRun, repeated=True) | 39 occurrences = ndb.KeyProperty(FlakyRun, repeated=True) |
(...skipping 29 matching lines...) Expand all Loading... |
69 # tracker and prevent too many updates filed. The FlakeUpdateSingleton entity is | 69 # tracker and prevent too many updates filed. The FlakeUpdateSingleton entity is |
70 # a singleton and all FlakyUpdate entities should be child entities of this | 70 # a singleton and all FlakyUpdate entities should be child entities of this |
71 # singleton entity, which allows us to query all of them within a single | 71 # singleton entity, which allows us to query all of them within a single |
72 # transaction. | 72 # transaction. |
73 class FlakeUpdateSingleton(ndb.Model): | 73 class FlakeUpdateSingleton(ndb.Model): |
74 pass | 74 pass |
75 | 75 |
76 | 76 |
77 class FlakeUpdate(ndb.Model): | 77 class FlakeUpdate(ndb.Model): |
78 time_updated = ndb.DateTimeProperty(auto_now_add=True) | 78 time_updated = ndb.DateTimeProperty(auto_now_add=True) |
OLD | NEW |