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

Side by Side Diff: infra_libs/event_mon/config.py

Issue 1407143009: Added event_mon.set_default_event (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « infra_libs/event_mon/__init__.py ('k') | infra_libs/event_mon/test/config_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 logging 5 import logging
6 import socket 6 import socket
7 7
8 import infra_libs 8 import infra_libs
9 from infra_libs.event_mon.protos.chrome_infra_log_pb2 import ( 9 from infra_libs.event_mon.protos.chrome_infra_log_pb2 import (
10 ChromeInfraEvent, ServiceEvent) 10 ChromeInfraEvent, ServiceEvent)
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 _router = ev_router._TextStreamRouter() 158 _router = ev_router._TextStreamRouter()
159 elif run_type == 'file': 159 elif run_type == 'file':
160 _router = ev_router._LocalFileRouter(output_file, 160 _router = ev_router._LocalFileRouter(output_file,
161 dry_run=dry_run) 161 dry_run=dry_run)
162 else: 162 else:
163 _router = ev_router._HttpRouter(_cache, 163 _router = ev_router._HttpRouter(_cache,
164 ENDPOINTS.get(run_type), 164 ENDPOINTS.get(run_type),
165 dry_run=dry_run) 165 dry_run=dry_run)
166 166
167 167
168 def set_default_event(event):
169 """Change the default ChromeInfraEvent used to compute all events.
170
171 Args:
172 event (ChromeInfraEvent): default event
173 """
174 if not isinstance(event, ChromeInfraEvent):
175 logging.error('A ChromeInfraEvent is required as the default event. Got %s',
dsansome 2015/10/29 00:51:54 Feels like you ought to raise a TypeError or Value
pgervais 2015/10/29 17:11:24 Done.
176 type(event))
177 return
178
179 _cache['default_event'] = event
180
181
168 def close(): 182 def close():
169 """Reset the state. 183 """Reset the state.
170 184
171 Call this right before exiting the program. 185 Call this right before exiting the program.
172 186
173 Returns: 187 Returns:
174 success (bool): False if an error occured 188 success (bool): False if an error occured
175 """ 189 """
176 global _router, _cache 190 global _router, _cache
177 _router = None 191 _router = None
178 _cache = {} 192 _cache = {}
179 return True 193 return True
OLDNEW
« no previous file with comments | « infra_libs/event_mon/__init__.py ('k') | infra_libs/event_mon/test/config_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698