| OLD | NEW |
| 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 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import contextlib | 5 import contextlib |
| 6 | 6 |
| 7 from google.appengine.api import modules | 7 from google.appengine.api import modules |
| 8 from google.appengine.api import namespace_manager | 8 from google.appengine.api import namespace_manager |
| 9 from google.appengine.ext import ndb | 9 from google.appengine.ext import ndb |
| 10 | 10 |
| 11 from infra_libs.ts_mon.common import metrics | 11 from infra_libs.ts_mon.common import metrics |
| 12 | 12 |
| 13 REGION = 'appengine' | 13 REGION = 'appengine' |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 try: | 107 try: |
| 108 namespace_manager.set_namespace(INSTANCE_NAMESPACE) | 108 namespace_manager.set_namespace(INSTANCE_NAMESPACE) |
| 109 yield | 109 yield |
| 110 finally: | 110 finally: |
| 111 namespace_manager.set_namespace(previous_namespace) | 111 namespace_manager.set_namespace(previous_namespace) |
| 112 | 112 |
| 113 | 113 |
| 114 def get_instance_entity(): | 114 def get_instance_entity(): |
| 115 with instance_namespace_context(): | 115 with instance_namespace_context(): |
| 116 return Instance.get_or_insert(instance_key_id()) | 116 return Instance.get_or_insert(instance_key_id()) |
| OLD | NEW |