Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import base64 | |
| 6 | |
| 7 from google.appengine.ext import ndb | |
| 8 | |
| 9 from model.base_try_job_data import BaseTryJobData | |
| 10 | |
| 11 | |
| 12 class FlakeTryJobData(BaseTryJobData): | |
| 13 """Represents a tryjob's data for a completed compile or test try job.""" | |
|
stgao
2017/01/05 21:15:11
This description is incorrect.
lijeffrey
2017/01/06 04:22:21
Oops, copy paste error :)
| |
| 14 | |
| 15 @property | |
|
stgao
2017/01/05 21:15:11
Should we do ComputedProperty for easier query?
lijeffrey
2017/01/06 04:22:21
Done.
| |
| 16 def master_name(self): | |
| 17 return self.try_job_key.pairs()[0][1].split('/')[0] | |
|
stgao
2017/01/05 21:15:11
Should we move the decoding to the FlakeTryJob mod
| |
| 18 | |
| 19 @property | |
| 20 def builder_name(self): | |
| 21 return self.try_job_key.pairs()[0][1].split('/')[1] | |
| 22 | |
| 23 @property | |
| 24 def step_name(self): | |
| 25 return self.try_job_key.pairs()[0][1].split('/')[2] | |
| 26 | |
| 27 @property | |
| 28 def test_name(self): | |
| 29 return base64.b64decode(self.try_job_key.pairs()[0][1].split('/')[3]) | |
| 30 | |
| 31 @property | |
| 32 def git_hash(self): | |
| 33 return self.try_job_key.pairs()[0][1].split('/')[4] | |
| 34 | |
| 35 @staticmethod | |
| 36 def _CreateKey(build_id): # pragma: no cover | |
| 37 return ndb.Key('FlakeTryJobData', build_id) | |
| 38 | |
| 39 @staticmethod | |
| 40 def Create(build_id): # pragma: no cover | |
| 41 return FlakeTryJobData(key=FlakeTryJobData._CreateKey(build_id)) | |
| 42 | |
| 43 @staticmethod | |
| 44 def Get(build_id): # pragma: no cover | |
| 45 return FlakeTryJobData._CreateKey(build_id).get() | |
| 46 | |
| OLD | NEW |