Skip to content
Snippets Groups Projects
Commit fe9f0cd4 authored by Wouter Klijn's avatar Wouter Klijn
Browse files

Task #7458: Merge the release back into the trunk

parents 51404aa5 35be9183
No related branches found
No related tags found
No related merge requests found
...@@ -119,12 +119,15 @@ class LOFARnodeTCP(LOFARnode): ...@@ -119,12 +119,15 @@ class LOFARnodeTCP(LOFARnode):
else: else:
break break
def __fetch_arguments(self): def __fetch_arguments(self, tries=5, min_timeout=1.0, max_timeout=5.0):
""" """
Connect to a remote job dispatch server (an instance of Connect to a remote job dispatch server (an instance of
jobserver.JobSocketReceive) and obtain all the details necessary to jobserver.JobSocketReceive) and obtain all the details necessary to
run this job. run this job.
""" """
while True:
tries -= 1
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.__try_connect(s) self.__try_connect(s)
message = "GET %d" % self.job_id message = "GET %d" % self.job_id
...@@ -135,6 +138,19 @@ class LOFARnodeTCP(LOFARnode): ...@@ -135,6 +138,19 @@ class LOFARnodeTCP(LOFARnode):
while len(chunk) < slen: while len(chunk) < slen:
chunk += s.recv(slen - len(chunk)) chunk += s.recv(slen - len(chunk))
self.arguments = pickle.loads(chunk) self.arguments = pickle.loads(chunk)
except socket.error, e:
print "Failed to get recipe arguments from server"
if tries > 0:
timeout = random.uniform(min_timeout, max_timeout)
print("Retrying in %f seconds (%d more %s)." %
(timeout, tries, "try" if tries == 1 else "tries"))
time.sleep(timeout)
else:
# we tried 5 times, abort with original exception
raise
else:
# no error, thus break the loop
break #
def __send_results(self): def __send_results(self):
""" """
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment