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

Side by Side Diff: rietveld.py

Issue 1475063002: Retry more errors when talking to Rietveld (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Fix Created 5 years 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 | Annotate | Revision Log
« 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 # coding: utf-8 1 # coding: utf-8
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 """Defines class Rietveld to easily access a rietveld instance. 5 """Defines class Rietveld to easily access a rietveld instance.
6 6
7 Security implications: 7 Security implications:
8 8
9 The following hypothesis are made: 9 The following hypothesis are made:
10 - Rietveld enforces: 10 - Rietveld enforces:
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 flake_codes = [500, 502, 503] 426 flake_codes = [500, 502, 503]
427 if retry_on_404: 427 if retry_on_404:
428 flake_codes.append(404) 428 flake_codes.append(404)
429 if e.code not in flake_codes: 429 if e.code not in flake_codes:
430 raise 430 raise
431 except urllib2.URLError, e: 431 except urllib2.URLError, e:
432 if retry >= (self._maxtries - 1): 432 if retry >= (self._maxtries - 1):
433 raise 433 raise
434 if (not 'Name or service not known' in e.reason and 434 if (not 'Name or service not known' in e.reason and
435 not 'EOF occurred in violation of protocol' in e.reason and 435 not 'EOF occurred in violation of protocol' in e.reason and
436 not 'Connection timed out' in e.reason and
437 not 'The handshake operation timed out' in e.reason and
436 # On windows we hit weird bug http://crbug.com/537417 438 # On windows we hit weird bug http://crbug.com/537417
437 # with message '[Errno 10060] A connection attempt failed...' 439 # with message '[Errno 10060] A connection attempt failed...'
438 not (sys.platform.startswith('win') and 440 not (sys.platform.startswith('win') and
439 isinstance(e.reason, socket.error) and 441 isinstance(e.reason, socket.error) and
440 e.reason.errno == errno.ETIMEDOUT 442 e.reason.errno == errno.ETIMEDOUT
441 ) 443 )
442 ): 444 ):
443 # Usually internal GAE flakiness. 445 # Usually internal GAE flakiness.
444 raise 446 raise
445 except socket.error, e: 447 except socket.error, e:
446 if retry >= (self._maxtries - 1): 448 if retry >= (self._maxtries - 1):
447 raise 449 raise
448 if not 'timed out' in str(e): 450 if not 'timed out' in str(e):
tandrii(chromium) 2015/11/25 16:56:37 this was probably the hope originally.
Sergiy Byelozyorov 2015/11/25 17:02:54 Acknowledged.
449 raise 451 raise
450 # If reaching this line, loop again. Uses a small backoff. 452 # If reaching this line, loop again. Uses a small backoff.
451 time.sleep(min(10, 1+retry*2)) 453 time.sleep(min(10, 1+retry*2))
452 except urllib2.HTTPError as e: 454 except urllib2.HTTPError as e:
453 print 'Request to %s failed: %s' % (e.geturl(), e.read()) 455 print 'Request to %s failed: %s' % (e.geturl(), e.read())
454 raise 456 raise
455 finally: 457 finally:
456 upload.ErrorExit = old_error_exit 458 upload.ErrorExit = old_error_exit
457 459
458 # DEPRECATED. 460 # DEPRECATED.
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 self, issue, patchset, reason, clobber, revision, builders_and_tests, 732 self, issue, patchset, reason, clobber, revision, builders_and_tests,
731 master=None, category='cq'): 733 master=None, category='cq'):
732 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % 734 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' %
733 (builders_and_tests, issue)) 735 (builders_and_tests, issue))
734 736
735 def trigger_distributed_try_jobs( # pylint:disable=R0201 737 def trigger_distributed_try_jobs( # pylint:disable=R0201
736 self, issue, patchset, reason, clobber, revision, masters, 738 self, issue, patchset, reason, clobber, revision, masters,
737 category='cq'): 739 category='cq'):
738 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % 740 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' %
739 (masters, issue)) 741 (masters, issue))
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