| 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 from google.appengine.ext import ndb | 6 from google.appengine.ext import ndb |
| 7 | 7 |
| 8 from status import build_result | 8 from status import build_result |
| 9 | 9 |
| 10 # Represents a parent for BuildRun objects that are for the same patchset and | 10 # Represents a parent for BuildRun objects that are for the same patchset and |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 return master[len('master.'):] | 36 return master[len('master.'):] |
| 37 else: | 37 else: |
| 38 return master | 38 return master |
| 39 | 39 |
| 40 def getURL(self): | 40 def getURL(self): |
| 41 parent = self.key.parent().get() | 41 parent = self.key.parent().get() |
| 42 return ('http://build.chromium.org/p/' + | 42 return ('http://build.chromium.org/p/' + |
| 43 self.removeMasterPrefix(parent.master) + '/builders/' + | 43 self.removeMasterPrefix(parent.master) + '/builders/' + |
| 44 parent.builder + '/builds/' + str(self.buildnumber)) | 44 parent.builder + '/builds/' + str(self.buildnumber)) |
| 45 | 45 |
| 46 def getMiloURL(self): |
| 47 # In July 2016, protobuf changed and URLs for earlier builds do not open. |
| 48 if self.time_finished < datetime.datetime(2016, 8, 1): |
| 49 return |
| 50 parent = self.key.parent().get() |
| 51 return ('https://luci-milo.appspot.com/buildbot/' + |
| 52 self.removeMasterPrefix(parent.master) + '/' + parent.builder + |
| 53 '/' + str(self.buildnumber)) |
| 54 |
| 46 buildnumber = ndb.IntegerProperty(required=True) | 55 buildnumber = ndb.IntegerProperty(required=True) |
| 47 result = ndb.IntegerProperty(required=True) | 56 result = ndb.IntegerProperty(required=True) |
| 48 time_finished = ndb.DateTimeProperty(required=True) | 57 time_finished = ndb.DateTimeProperty(required=True) |
| 49 time_started = ndb.DateTimeProperty(default=datetime.datetime.max) | 58 time_started = ndb.DateTimeProperty(default=datetime.datetime.max) |
| 50 | 59 |
| 51 is_success = ndb.ComputedProperty( | 60 is_success = ndb.ComputedProperty( |
| 52 lambda self: build_result.isResultSuccess(self.result)) | 61 lambda self: build_result.isResultSuccess(self.result)) |
| 53 is_failure = ndb.ComputedProperty( | 62 is_failure = ndb.ComputedProperty( |
| 54 lambda self: build_result.isResultFailure(self.result)) | 63 lambda self: build_result.isResultFailure(self.result)) |
| OLD | NEW |