aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/error.py
diff options
context:
space:
mode:
authorrnefyodov <rnefyodov@yandex-team.ru>2022-02-10 16:47:17 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:17 +0300
commitc753751b693cf7c481c0292912e2b7536fa6d36a (patch)
tree9814fbd1c3effac9b8377c5d604b367b14e2db55 /build/scripts/error.py
parentc22320e8c4f3d7be38c504706f137034e91d31e6 (diff)
downloadydb-c753751b693cf7c481c0292912e2b7536fa6d36a.tar.gz
Restoring authorship annotation for <rnefyodov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'build/scripts/error.py')
-rw-r--r--build/scripts/error.py56
1 files changed, 28 insertions, 28 deletions
diff --git a/build/scripts/error.py b/build/scripts/error.py
index 644a172d895..f7d8ecb2cc0 100644
--- a/build/scripts/error.py
+++ b/build/scripts/error.py
@@ -8,11 +8,11 @@ TEMPORARY_ERROR_MESSAGES = [
'Internal Server Error',
'Network connection closed unexpectedly',
'Network is unreachable',
- 'No route to host',
+ 'No route to host',
'No space left on device',
'Not enough space',
'Temporary failure in name resolution',
- 'The read operation timed out',
+ 'The read operation timed out',
'timeout: timed out',
]
@@ -30,48 +30,48 @@ def merge_exit_codes(exit_codes):
return max(e if e >= 0 else 1 for e in exit_codes) if exit_codes else 0
-def is_temporary_error(exc):
+def is_temporary_error(exc):
import logging
logger = logging.getLogger(__name__)
- if getattr(exc, 'temporary', False):
+ if getattr(exc, 'temporary', False):
logger.debug("Exception has temporary attribute: %s", exc)
- return True
-
- import errno
- err = getattr(exc, 'errno', None)
-
- if err == errno.ECONNREFUSED or err == errno.ENETUNREACH:
+ return True
+
+ import errno
+ err = getattr(exc, 'errno', None)
+
+ if err == errno.ECONNREFUSED or err == errno.ENETUNREACH:
logger.debug("Exception has errno attribute: %s (errno=%s)", exc, err)
- return True
-
- import socket
-
+ return True
+
+ import socket
+
if isinstance(exc, socket.timeout) or isinstance(getattr(exc, 'reason', None), socket.timeout):
logger.debug("Socket timeout exception: %s", exc)
- return True
-
- if isinstance(exc, socket.gaierror):
+ return True
+
+ if isinstance(exc, socket.gaierror):
logger.debug("Getaddrinfo exception: %s", exc)
- return True
-
+ return True
+
import urllib2
if isinstance(exc, urllib2.HTTPError) and exc.code in (429, ):
logger.debug("urllib2.HTTPError: %s", exc)
return True
- import httplib
-
- if isinstance(exc, httplib.IncompleteRead):
+ import httplib
+
+ if isinstance(exc, httplib.IncompleteRead):
logger.debug("IncompleteRead exception: %s", exc)
- return True
-
- exc_str = str(exc)
-
+ return True
+
+ exc_str = str(exc)
+
for message in TEMPORARY_ERROR_MESSAGES:
if message in exc_str:
logger.debug("Found temporary error pattern (%s): %s", message, exc_str)
return True
-
- return False
+
+ return False