OLD | NEW |
1 # coding: utf-8 | 1 # coding: utf-8 |
2 # Copyright 2015 The Swarming Authors. All rights reserved. | 2 # Copyright 2015 The LUCI Authors. All rights reserved. |
3 # Use of this source code is governed by the Apache v2.0 license that can be | 3 # Use of this source code is governed by the Apache v2.0 license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Packing and unpacking of ndb.Key. | 6 """Packing and unpacking of ndb.Key. |
7 | 7 |
8 End users are only given packed keys, which permits to not expose internal | 8 End users are only given packed keys, which permits to not expose internal |
9 schema details to the user. | 9 schema details to the user. |
10 """ | 10 """ |
11 | 11 |
12 from google.appengine.ext import ndb | 12 from google.appengine.ext import ndb |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 """Returns the TaskRunResult ndb.Key from a packed key. | 160 """Returns the TaskRunResult ndb.Key from a packed key. |
161 | 161 |
162 The expected format of |packed_key| is %x. | 162 The expected format of |packed_key| is %x. |
163 """ | 163 """ |
164 request_key = unpack_request_key(packed_key[:-1]) | 164 request_key = unpack_request_key(packed_key[:-1]) |
165 run_id = int(packed_key[-1], 16) | 165 run_id = int(packed_key[-1], 16) |
166 if not run_id: | 166 if not run_id: |
167 raise ValueError('Can\'t reference to the overall task result.') | 167 raise ValueError('Can\'t reference to the overall task result.') |
168 result_summary_key = request_key_to_result_summary_key(request_key) | 168 result_summary_key = request_key_to_result_summary_key(request_key) |
169 return result_summary_key_to_run_result_key(result_summary_key, run_id) | 169 return result_summary_key_to_run_result_key(result_summary_key, run_id) |
OLD | NEW |