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

Side by Side Diff: scripts/slave/build_scan.py

Issue 2451213004: build_scan: Raise ValueError on URL fetch error (Closed)
Patch Set: Created 4 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 """Scans a list of masters and saves information in a build_db.""" 6 """Scans a list of masters and saves information in a build_db."""
7 7
8 from contextlib import closing 8 from contextlib import closing
9 import json 9 import json
10 import logging 10 import logging
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 229
230 if not args: 230 if not args:
231 parser.error('you need to specify at least one master URL') 231 parser.error('you need to specify at least one master URL')
232 232
233 args = [url.rstrip('/') for url in args] 233 args = [url.rstrip('/') for url in args]
234 234
235 return options, args 235 return options, args
236 236
237 237
238 def get_updated_builds(masters, build_db, parallelism): 238 def get_updated_builds(masters, build_db, parallelism):
239 new_builds, master_jsons = find_new_builds_per_master(masters, build_db) 239 try:
240 build_jsons = get_build_jsons(new_builds, parallelism) 240 new_builds, master_jsons = find_new_builds_per_master(masters, build_db)
241 propagate_build_json_to_db(build_db, build_jsons) 241 build_jsons = get_build_jsons(new_builds, parallelism)
242 return master_jsons, build_jsons 242 propagate_build_json_to_db(build_db, build_jsons)
243 return master_jsons, build_jsons
244
245 # Catch this and raise a ValueError because this can be called from
246 # mulitprocessing, which can't pickle SSLContext objects, which apparently are
247 # properties of urllib2.URLError (it seems).
248 except (urllib2.URLError, IOError) as f:
249 msg = "URL Fetch timed out: %s" % f
ghost stip (do not use) 2016/10/27 23:41:18 probably want to make this something like "Error e
martiniss 2016/10/27 23:44:04 Done.
250 logging.error(msg)
251 raise ValueError(msg)
243 252
244 253
245 def main(): 254 def main():
246 options, args = get_options() 255 options, args = get_options()
247 256
248 logging.basicConfig(level=logging.DEBUG if options.verbose else logging.INFO) 257 logging.basicConfig(level=logging.DEBUG if options.verbose else logging.INFO)
249 258
250 masters = {} 259 masters = {}
251 for m in set(args): 260 for m in set(args):
252 masters[m] = BUILDER_WILDCARD 261 masters[m] = BUILDER_WILDCARD
(...skipping 11 matching lines...) Expand all
264 print '%s:%s:%s' % (master_url, builder, buildnum) 273 print '%s:%s:%s' % (master_url, builder, buildnum)
265 274
266 if not options.skip_build_db_update: 275 if not options.skip_build_db_update:
267 build_scan_db.save_build_db(build_db, {}, options.build_db) 276 build_scan_db.save_build_db(build_db, {}, options.build_db)
268 277
269 return 0 278 return 0
270 279
271 280
272 if __name__ == '__main__': 281 if __name__ == '__main__':
273 sys.exit(main()) 282 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698