OLD | NEW |
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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 # The idea here is to retry if the error isn't permanent. | 434 # The idea here is to retry if the error isn't permanent. |
435 # Unfortunately, there are so many different possible errors, | 435 # Unfortunately, there are so many different possible errors, |
436 # that we end up enumerating those that are known to us to be | 436 # that we end up enumerating those that are known to us to be |
437 # transient. | 437 # transient. |
438 # The reason can be a string or another exception, e.g., | 438 # The reason can be a string or another exception, e.g., |
439 # socket.error or whatever else. | 439 # socket.error or whatever else. |
440 reason_as_str = str(e.reason) | 440 reason_as_str = str(e.reason) |
441 for retry_anyway in ( | 441 for retry_anyway in ( |
442 'Name or service not known', | 442 'Name or service not known', |
443 'EOF occurred in violation of protocol', | 443 'EOF occurred in violation of protocol', |
444 'timed out'): | 444 'timed out', |
| 445 # See http://crbug.com/601260. |
| 446 'urlopen error [Errno 10060] A connection attempt failed', |
| 447 'urlopen error [Errno 104] Connection reset by peer', |
| 448 ): |
445 if retry_anyway in reason_as_str: | 449 if retry_anyway in reason_as_str: |
446 return True | 450 return True |
447 return False # Assume permanent otherwise. | 451 return False # Assume permanent otherwise. |
448 if not is_transient(): | 452 if not is_transient(): |
449 raise | 453 raise |
450 except socket.error, e: | 454 except socket.error, e: |
451 if retry >= (self._maxtries - 1): | 455 if retry >= (self._maxtries - 1): |
452 raise | 456 raise |
453 if not 'timed out' in str(e): | 457 if not 'timed out' in str(e): |
454 raise | 458 raise |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 self, issue, patchset, reason, clobber, revision, builders_and_tests, | 748 self, issue, patchset, reason, clobber, revision, builders_and_tests, |
745 master=None, category='cq'): | 749 master=None, category='cq'): |
746 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % | 750 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % |
747 (builders_and_tests, issue)) | 751 (builders_and_tests, issue)) |
748 | 752 |
749 def trigger_distributed_try_jobs( # pylint:disable=R0201 | 753 def trigger_distributed_try_jobs( # pylint:disable=R0201 |
750 self, issue, patchset, reason, clobber, revision, masters, | 754 self, issue, patchset, reason, clobber, revision, masters, |
751 category='cq'): | 755 category='cq'): |
752 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % | 756 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % |
753 (masters, issue)) | 757 (masters, issue)) |
OLD | NEW |