Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: appengine/findit/model/base_try_job.py

Issue 2605803002: [Findit] Refactoring WfTryJobData into BaseTryJobData, WfTryJobData, and FlakeTryJobData (Closed)
Patch Set: Fixing code coverage Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 google.appengine.ext import ndb 5 from google.appengine.ext import ndb
6 6
7 from model import analysis_status 7 from model import analysis_status
8 8
9 9
10 class BaseTryJob(ndb.Model): 10 class BaseTryJob(ndb.Model):
11 """Represents a base try job result.""" 11 """Represents a base try job result."""
12 12
13 # The status of the try job. 13 # The status of the try job.
14 status = ndb.IntegerProperty( 14 status = ndb.IntegerProperty(
15 default=analysis_status.PENDING, indexed=False) 15 default=analysis_status.PENDING, indexed=False)
16 16
17 # A list of try job IDs associated with each try job for collecting metadata. 17 # A list of try job IDs associated with each try job for collecting metadata.
18 try_job_ids = ndb.JsonProperty(indexed=False, compressed=True) 18 try_job_ids = ndb.JsonProperty(indexed=False, compressed=True)
19 19
20 @property 20 @property
21 def completed(self): 21 def completed(self):
22 return self.status in ( 22 return self.status in (
23 analysis_status.COMPLETED, analysis_status.ERROR) 23 analysis_status.COMPLETED, analysis_status.ERROR)
24 24
25 @property 25 @property
26 def failed(self): 26 def failed(self):
27 return self.status == analysis_status.ERROR 27 return self.status == analysis_status.ERROR
28
29 @classmethod
30 def GetMasterName(cls, key):
31 return key.pairs()[0][1].split('/')[0]
32
33 @classmethod
34 def GetBuilderName(cls, key):
35 return key.pairs()[0][1].split('/')[1]
36
37 @ndb.ComputedProperty
38 def master_name(self):
39 return self.GetMasterName(self.key)
40
41 @ndb.ComputedProperty
42 def builder_name(self):
43 return self.GetBuilderName(self.key)
OLDNEW
« no previous file with comments | « appengine/findit/handlers/test/try_job_dashboard_test.py ('k') | appengine/findit/model/base_try_job_data.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698