From 1bc9bba5a3bb201345fcf6b690b1c884f8ab8a7d Mon Sep 17 00:00:00 2001 From: Samo Penic <samo.penic@gmail.com> Date: Sun, 23 Dec 2018 08:41:23 +0000 Subject: [PATCH] A try to make greater robustness when calling client ping --- tsclient.py | 22 +++++++++++++++++----- 1 files changed, 17 insertions(+), 5 deletions(-) diff --git a/tsclient.py b/tsclient.py index 47856c5..610f947 100755 --- a/tsclient.py +++ b/tsclient.py @@ -178,9 +178,13 @@ print("[{}] Could not get CID.".format(self.id)) self.sleep(10) continue - #print("Got CID. getting RID.") - client_ping_time_elapsed=0 - concurrent_runs=client_ping(self.conn_address,cid) + print("[{}] Connected and got client ID {}.".format(self.id, cid)) + try: + concurrent_runs=client_ping(self.conn_address,cid) + client_ping_time_elapsed=0 + except: + self.sleep(10) + continue self.subrunsStartStop(concurrent_runs) while(not self.isStopped()): #successfully registered, now start pinging and searching for job try: @@ -252,7 +256,7 @@ try: ping_run(self.conn_address, cid, rid) except: - print("[{}] Could not ping.".format(self.id)) + print("[{}] Could not prolong a lease on the run.".format(self.id)) self.p.terminate() self.p=None removeDir(self.workingdir.fullpath()) @@ -275,7 +279,15 @@ self.sleep(self.update_seconds-1) client_ping_time_elapsed+=self.update_seconds if(client_ping_time_elapsed>self.max_client_ping_time_elapsed-self.update_seconds/2): - concurrent_runs=client_ping(self.conn_address,cid) + try: + concurrent_runs=client_ping(self.conn_address,cid) + except: + print("[{}] Could not client ping.".format(self.sid)) + self.p.terminate() + self.p=None + removeDir(self.workingdir.fullpath()) + self.workingdir=None + break self.subrunsStartStop(concurrent_runs) client_ping_time_elapsed=0 -- Gitblit v1.9.3