OLD | NEW |
(Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 from google.appengine.ext import ndb |
| 6 |
| 7 from model.base_build_model import BaseBuildModel |
| 8 from model.build_analysis_status import BuildAnalysisStatus |
| 9 |
| 10 |
| 11 class BuildAnalysis(BaseBuildModel): |
| 12 """Represents an analysis of a build cycle of a builder in a waterfall.""" |
| 13 |
| 14 @staticmethod |
| 15 def CreateKey(master_name, builder_name, build_number): # pragma: no cover |
| 16 return ndb.Key('BuildAnalysis', |
| 17 BaseBuildModel.CreateBuildId( |
| 18 master_name, builder_name, build_number)) |
| 19 |
| 20 @staticmethod |
| 21 def CreateBuildAnalysis( |
| 22 master_name, builder_name, build_number): # pragma: no cover |
| 23 return BuildAnalysis( |
| 24 key=BuildAnalysis.CreateKey(master_name, builder_name, build_number)) |
| 25 |
| 26 @staticmethod |
| 27 def GetBuildAnalysis( |
| 28 master_name, builder_name, build_number): # pragma: no cover |
| 29 return BuildAnalysis.CreateKey( |
| 30 master_name, builder_name, build_number).get() |
| 31 |
| 32 def Reset(self): # pragma: no cover |
| 33 """Reset to the state as if no analysis is run.""" |
| 34 self.pipeline_url = None |
| 35 self.status = BuildAnalysisStatus.PENDING |
| 36 self.start_time = None |
| 37 self.updated_time = None |
| 38 |
| 39 # Information of the analyzed build. |
| 40 build_start_time = ndb.DateTimeProperty(indexed=True) |
| 41 |
| 42 # Information of analysis processing. |
| 43 pipeline_url = ndb.StringProperty(indexed=False) |
| 44 status = ndb.IntegerProperty( |
| 45 default=BuildAnalysisStatus.PENDING, indexed=False) |
| 46 start_time = ndb.DateTimeProperty(indexed=False) |
| 47 updated_time = ndb.DateTimeProperty(indexed=False) |
OLD | NEW |