Chromium Code Reviews| Index: appengine/findit/model/flake/flake_try_job_data.py |
| diff --git a/appengine/findit/model/flake/flake_try_job_data.py b/appengine/findit/model/flake/flake_try_job_data.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e9823f34e6b54c3459e582914ab575b324473d70 |
| --- /dev/null |
| +++ b/appengine/findit/model/flake/flake_try_job_data.py |
| @@ -0,0 +1,46 @@ |
| +# Copyright 2016 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 base64 |
| + |
| +from google.appengine.ext import ndb |
| + |
| +from model.base_try_job_data import BaseTryJobData |
| + |
| + |
| +class FlakeTryJobData(BaseTryJobData): |
| + """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 :)
|
| + |
| + @property |
|
stgao
2017/01/05 21:15:11
Should we do ComputedProperty for easier query?
lijeffrey
2017/01/06 04:22:21
Done.
|
| + def master_name(self): |
| + 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
|
| + |
| + @property |
| + def builder_name(self): |
| + return self.try_job_key.pairs()[0][1].split('/')[1] |
| + |
| + @property |
| + def step_name(self): |
| + return self.try_job_key.pairs()[0][1].split('/')[2] |
| + |
| + @property |
| + def test_name(self): |
| + return base64.b64decode(self.try_job_key.pairs()[0][1].split('/')[3]) |
| + |
| + @property |
| + def git_hash(self): |
| + return self.try_job_key.pairs()[0][1].split('/')[4] |
| + |
| + @staticmethod |
| + def _CreateKey(build_id): # pragma: no cover |
| + return ndb.Key('FlakeTryJobData', build_id) |
| + |
| + @staticmethod |
| + def Create(build_id): # pragma: no cover |
| + return FlakeTryJobData(key=FlakeTryJobData._CreateKey(build_id)) |
| + |
| + @staticmethod |
| + def Get(build_id): # pragma: no cover |
| + return FlakeTryJobData._CreateKey(build_id).get() |
| + |