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

Side by Side Diff: appengine_module/gae_event_mon/__init__.py

Issue 2213143002: Add infra_libs as a bootstrap dependency. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 4 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 import imp
5 import logging 6 import logging
6 import os 7 import os
7 import sys 8 import sys
8 9
9 # Since event_mon depends on ts_mon, we reuse module setup (__init__.py) from 10 # Since event_mon depends on ts_mon, we reuse module setup (__init__.py) from
10 # the gae_ts_mon, which configures infra_libs as if it was imported directly. 11 # the gae_ts_mon, which configures infra_libs as if it was imported directly.
11 # We expect the users of gae_event_mon to symlink both this and gae_ts_mon 12 # We expect the users of gae_event_mon to symlink both this and gae_ts_mon
12 # modules into their apps. 13 # modules into their apps.
13 import gae_ts_mon 14 import gae_ts_mon
14 15
15 # Additional infra_libs configuration for event_mon. 16 # Additional infra_libs configuration for event_mon.
16 import infra_libs.ts_mon.httplib2_utils 17 import infra_libs.ts_mon.httplib2_utils
17 sys.modules['infra_libs'].InstrumentedHttp = ( 18 sys.modules['infra_libs'].InstrumentedHttp = (
18 infra_libs.ts_mon.httplib2_utils.InstrumentedHttp) 19 infra_libs.ts_mon.httplib2_utils.InstrumentedHttp)
19 sys.modules['infra_libs'].event_mon = sys.modules[__package__] 20 sys.modules['infra_libs'].event_mon = sys.modules[__package__]
20 sys.modules['infra_libs.event_mon'] = sys.modules[__package__] 21 sys.modules['infra_libs.event_mon'] = sys.modules[__package__]
21 22
23 # Import time_functions explicitly, since gae_ts_mon messes with infra_libs.
24 # TODO(sergeyberezin): clean up this mess. Do not meddle with magic.
Sergey Berezin 2016/08/04 20:21:25 FYI: this is the ugliest thing I had to do for thi
25 try:
26 tf_file, tf_path, tf_desc = imp.find_module(
27 'time_functions',
28 [os.path.dirname(__file__)])
29 tf_module = imp.load_module(
30 'infra_libs.time_functions', tf_file, tf_path, tf_desc)
31 finally:
32 if tf_file:
33 tf_file.close()
34
35 sys.modules['infra_libs'].time_functions = tf_module
36 sys.modules['infra_libs.time_functions'] = tf_module
37
22 from google.appengine.api import modules 38 from google.appengine.api import modules
23 from google.appengine.api.app_identity import app_identity 39 from google.appengine.api.app_identity import app_identity
24 40
25 def initialize(service_name): 41 def initialize(service_name):
26 is_local_unittest = ('expect_tests' in sys.argv[0]) 42 is_local_unittest = ('expect_tests' in sys.argv[0])
27 if is_local_unittest: 43 if is_local_unittest:
28 appengine_name = 'unittest' 44 appengine_name = 'unittest'
29 service_name = 'unittest' 45 service_name = 'unittest'
30 hostname = 'unittest' 46 hostname = 'unittest'
31 else: # pragma: no cover 47 else: # pragma: no cover
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 from infra_libs.event_mon.monitoring import send_service_event 79 from infra_libs.event_mon.monitoring import send_service_event
64 80
65 from infra_libs.event_mon.protos.chrome_infra_log_pb2 import ChromeInfraEvent 81 from infra_libs.event_mon.protos.chrome_infra_log_pb2 import ChromeInfraEvent
66 from infra_libs.event_mon.protos.chrome_infra_log_pb2 import BuildEvent 82 from infra_libs.event_mon.protos.chrome_infra_log_pb2 import BuildEvent
67 from infra_libs.event_mon.protos.chrome_infra_log_pb2 import ServiceEvent 83 from infra_libs.event_mon.protos.chrome_infra_log_pb2 import ServiceEvent
68 from infra_libs.event_mon.protos.chrome_infra_log_pb2 import InfraEventSource 84 from infra_libs.event_mon.protos.chrome_infra_log_pb2 import InfraEventSource
69 from infra_libs.event_mon.protos.chrome_infra_log_pb2 import CodeVersion 85 from infra_libs.event_mon.protos.chrome_infra_log_pb2 import CodeVersion
70 from infra_libs.event_mon.protos.chrome_infra_log_pb2 import CQEvent 86 from infra_libs.event_mon.protos.chrome_infra_log_pb2 import CQEvent
71 87
72 from infra_libs.event_mon.protos.log_request_lite_pb2 import LogRequestLite 88 from infra_libs.event_mon.protos.log_request_lite_pb2 import LogRequestLite
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698