| OLD | NEW |
| 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 collections import defaultdict | 5 from collections import defaultdict |
| 6 | 6 |
| 7 from google.appengine.ext import ndb | 7 from google.appengine.ext import ndb |
| 8 | 8 |
| 9 from model.base_build_model import BaseBuildModel | 9 from model.base_build_model import BaseBuildModel |
| 10 from model import analysis_status | 10 from model.base_swarming_task import BaseSwarmingTask |
| 11 | 11 |
| 12 | 12 |
| 13 class WfSwarmingTask(BaseBuildModel): | 13 class WfSwarmingTask(BaseBuildModel, BaseSwarmingTask): |
| 14 """Represents a swarming task for a failed step. | 14 """Represents a swarming task for a failed step. |
| 15 | 15 |
| 16 'Wf' is short for waterfall. | 16 'Wf' is short for waterfall. |
| 17 """ | 17 """ |
| 18 # The id of the Swarming task scheduled or running on Swarming Server. | |
| 19 task_id = ndb.StringProperty(indexed=False) | |
| 20 | |
| 21 # A dict to keep track of running information for each test: | |
| 22 # number of total runs, number of each status (such as 'SUCCESS' or 'FAILED') | |
| 23 tests_statuses = ndb.JsonProperty(indexed=False, compressed=True) | |
| 24 | |
| 25 # The status of the swarming task. | |
| 26 status = ndb.IntegerProperty( | |
| 27 default=analysis_status.PENDING, indexed=False) | |
| 28 | |
| 29 # The revision of the failed build. | |
| 30 build_revision = ndb.StringProperty(indexed=False) | |
| 31 | |
| 32 # Time when the task is created. | |
| 33 created_time = ndb.DateTimeProperty(indexed=True) | |
| 34 # Time when the task is started. | |
| 35 started_time = ndb.DateTimeProperty(indexed=False) | |
| 36 # Time when the task is completed. | |
| 37 completed_time = ndb.DateTimeProperty(indexed=False) | |
| 38 | |
| 39 # parameters need to be stored and analyzed later. | |
| 40 parameters = ndb.JsonProperty(indexed=False, compressed=True) | |
| 41 | 18 |
| 42 @property | 19 @property |
| 43 def classified_tests(self): | 20 def classified_tests(self): |
| 44 """Classification of tests into lists of reliable and flaky tests. | 21 """Classification of tests into lists of reliable and flaky tests. |
| 45 | 22 |
| 46 example format would be: | 23 example format would be: |
| 47 { | 24 { |
| 48 'flaky_tests': ['test1', 'test2', ...], | 25 'flaky_tests': ['test1', 'test2', ...], |
| 49 'reliable_tests': ['test3', ...], | 26 'reliable_tests': ['test3', ...], |
| 50 'unknown_tests': ['test4', ...] | 27 'unknown_tests': ['test4', ...] |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 master_name, builder_name, build_number, step_name)) | 60 master_name, builder_name, build_number, step_name)) |
| 84 task.parameters = task.parameters or {} | 61 task.parameters = task.parameters or {} |
| 85 task.tests_statuses = task.tests_statuses or {} | 62 task.tests_statuses = task.tests_statuses or {} |
| 86 return task | 63 return task |
| 87 | 64 |
| 88 @staticmethod | 65 @staticmethod |
| 89 def Get( | 66 def Get( |
| 90 master_name, builder_name, build_number, step_name): # pragma: no cover | 67 master_name, builder_name, build_number, step_name): # pragma: no cover |
| 91 return WfSwarmingTask._CreateKey( | 68 return WfSwarmingTask._CreateKey( |
| 92 master_name, builder_name, build_number, step_name).get() | 69 master_name, builder_name, build_number, step_name).get() |
| OLD | NEW |