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

Side by Side Diff: infra/services/builder_alerts/__main__.py

Issue 2134193002: Remove codesite bug tracker support from builder_alerts and chromium-try-flakes (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Update tests Created 4 years, 5 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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import argparse 6 import argparse
7 import contextlib 7 import contextlib
8 import cStringIO 8 import cStringIO
9 import datetime 9 import datetime
10 import gzip 10 import gzip
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 resp.status_code, resp.reason, resp.content, e) 311 resp.status_code, resp.reason, resp.content, e)
312 ret = False 312 ret = False
313 313
314 # Query sheriff issues and post them to the new API endpoint. 314 # Query sheriff issues and post them to the new API endpoint.
315 if args.crbug_service_account: 315 if args.crbug_service_account:
316 global issue_tracker_last_poll 316 global issue_tracker_last_poll
317 seconds_since_last_poll = ( 317 seconds_since_last_poll = (
318 datetime.datetime.utcnow() - issue_tracker_last_poll).total_seconds() 318 datetime.datetime.utcnow() - issue_tracker_last_poll).total_seconds()
319 if seconds_since_last_poll > ISSUE_TRACKER_POLLING_FREQUENCY_SEC: 319 if seconds_since_last_poll > ISSUE_TRACKER_POLLING_FREQUENCY_SEC:
320 issue_tracker_last_poll = datetime.datetime.utcnow() 320 issue_tracker_last_poll = datetime.datetime.utcnow()
321 issues_per_tree = crbug_issues.query(args.crbug_service_account, 321 issues_per_tree = crbug_issues.query(args.crbug_service_account)
322 args.use_monorail)
323 for tree, issues in issues_per_tree.iteritems(): 322 for tree, issues in issues_per_tree.iteritems():
324 json_data = {'alerts': issues} 323 json_data = {'alerts': issues}
325 gzipped_data = gzipped(json.dumps(json_data)) 324 gzipped_data = gzipped(json.dumps(json_data))
326 if args.api_endpoint_prefix: 325 if args.api_endpoint_prefix:
327 new_api_endpoint = string_helpers.slash_join( 326 new_api_endpoint = string_helpers.slash_join(
328 args.api_endpoint_prefix, 'api/v1/alerts', tree) 327 args.api_endpoint_prefix, 'api/v1/alerts', tree)
329 logging.info('POST %s alerts (%s bytes compressed) to %s', 328 logging.info('POST %s alerts (%s bytes compressed) to %s',
330 len(issues), len(gzipped_data), new_api_endpoint) 329 len(issues), len(gzipped_data), new_api_endpoint)
331 resp = requests.post(new_api_endpoint, data=gzipped_data, 330 resp = requests.post(new_api_endpoint, data=gzipped_data,
332 headers={'content-encoding': 'gzip'}) 331 headers={'content-encoding': 'gzip'})
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 loop_results = outer_loop.loop( 425 loop_results = outer_loop.loop(
427 task=outer_loop_iteration, 426 task=outer_loop_iteration,
428 sleep_timeout=lambda: 5, 427 sleep_timeout=lambda: 5,
429 **loop_args) 428 **loop_args)
430 429
431 return 0 if loop_results.success else 1 430 return 0 if loop_results.success else 1
432 431
433 432
434 if __name__ == '__main__': 433 if __name__ == '__main__':
435 sys.exit(main(sys.argv[1:])) 434 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « appengine/chromium_try_flakes/issue_tracker/issue_tracker_api.py ('k') | infra/services/builder_alerts/crbug_issues.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698