Index: appengine/findit/model/build.py |
diff --git a/appengine/findit/model/build.py b/appengine/findit/model/build.py |
index 3dcd47a2c4cd9fe422fb5ccbe06ec990232887f5..8b0398b5399f6f4572f6856ca29f7d93e3ec020a 100644 |
--- a/appengine/findit/model/build.py |
+++ b/appengine/findit/model/build.py |
@@ -1,47 +1,32 @@ |
-# Copyright (c) 2014 The Chromium Authors. All rights reserved. |
+# Copyright 2014 The Chromium Authors. All rights reserved. |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
-import calendar |
- |
from google.appengine.ext import ndb |
-from model.build_analysis_status import BuildAnalysisStatus |
+from model.base_build_model import BaseBuildModel |
-class Build(ndb.Model): |
- """Represent a build cycle of a builder in a waterfall.""" |
+class Build(BaseBuildModel): |
+ """Represents a build cycle of a builder in a waterfall.""" |
@staticmethod |
def CreateKey(master_name, builder_name, build_number): # pragma: no cover |
- return ndb.Key( |
- 'Master', master_name, 'Builder', builder_name, 'Build', build_number) |
+ return ndb.Key('Build', |
+ BaseBuildModel.CreateBuildId( |
+ master_name, builder_name, build_number)) |
@staticmethod |
def CreateBuild(master_name, builder_name, build_number): # pragma: no cover |
- """Create a Build instance, but not save it to datastore.""" |
- return Build(key=Build.CreateKey(master_name, builder_name, build_number), |
- master_name=master_name, |
- builder_name=builder_name, |
- build_number=build_number) |
+ return Build(key=Build.CreateKey(master_name, builder_name, build_number)) |
@staticmethod |
def GetBuild(master_name, builder_name, build_number): # pragma: no cover |
return Build.CreateKey(master_name, builder_name, build_number).get() |
- def Reset(self): |
- """Reset to the state as if no analysis is run.""" |
- self.analysis_status = BuildAnalysisStatus.PENDING |
- self.analysis_start_time = None |
- self.analysis_updated_time = None |
- |
- # Information of the build. |
- master_name = ndb.StringProperty(indexed=False) |
- builder_name = ndb.StringProperty(indexed=False) |
- build_number = ndb.IntegerProperty(indexed=False) |
- |
- # Information of analysis processing. |
- analysis_status = ndb.IntegerProperty( |
- default=BuildAnalysisStatus.PENDING, indexed=False) |
- analysis_start_time = ndb.DateTimeProperty(indexed=False) |
- analysis_updated_time = ndb.DateTimeProperty(indexed=False) |
+ data = ndb.JsonProperty(indexed=False, compressed=True) |
+ last_crawled_time = ndb.DateTimeProperty(indexed=False) |
+ |
+ start_time = ndb.DateTimeProperty(indexed=False) |
+ completed = ndb.BooleanProperty(default=False, indexed=False) |
+ result = ndb.IntegerProperty(indexed=False) |