Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

survies_server_restart: ignore (verbosely) all socket errors #136

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions resalloc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""
from __future__ import print_function

import errno
import socket
import time
import sys
Expand All @@ -23,15 +22,6 @@ class _WrappedXMLRPCClient(object):
def __init__(self, connection_string, survive_server_restart):
self._conn = C_XMLRPC(connection_string)
self.survive_server_restart = survive_server_restart
self._retry_errors = [
errno.ECONNREFUSED,
errno.ECONNABORTED,
errno.ECONNRESET,
errno.ENETUNREACH,
errno.ENETRESET,
errno.ENETDOWN,
errno.EADDRNOTAVAIL,
]

def call(self, name, *args):
"""
Expand All @@ -43,11 +33,10 @@ def call(self, name, *args):
while True:
try:
return fcall(*args)
except socket.error as os_e:
except socket.error as sock_err:
print(str(sock_err), file=sys.stderr)
if not self.survive_server_restart:
raise
if os_e.errno not in self._retry_errors:
raise
except RPCEXCEPTION as ex:
print(str(ex), file=sys.stderr)
time.sleep(3)
Expand Down
Loading