From 6f99f14a6d1dcca272756c14c018cc39c8212e49 Mon Sep 17 00:00:00 2001 From: iperov Date: Tue, 25 Dec 2018 19:48:34 +0400 Subject: [PATCH] SubprocessorBase fix --- utils/SubprocessorBase.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/utils/SubprocessorBase.py b/utils/SubprocessorBase.py index 5551a9f..2154374 100644 --- a/utils/SubprocessorBase.py +++ b/utils/SubprocessorBase.py @@ -94,19 +94,24 @@ class SubprocessorBase(object): cq = multiprocessing.Queue() client_dict.update ( {'print_lock' : self.print_lock} ) - - p = multiprocessing.Process(target=self.subprocess, args=(sq,cq,client_dict)) - p.daemon = True - p.start() - self.processes.append ( { 'process' : p, - 'sq' : sq, - 'cq' : cq, - 'state' : 'busy', - 'sent_time': time.time(), - 'name': name, - 'host_dict' : host_dict - } ) + try: + p = multiprocessing.Process(target=self.subprocess, args=(sq,cq,client_dict)) + p.daemon = True + p.start() + self.processes.append ( { 'process' : p, + 'sq' : sq, + 'cq' : cq, + 'state' : 'busy', + 'sent_time': time.time(), + 'name': name, + 'host_dict' : host_dict + } ) + except: + print ("Unable to start subprocess %s" % (name)) + if len(self.processes) == 0: + raise Exception ("Unable to start Subprocessor '%s' " % (self.name)) + while True: for p in self.processes[:]: while not p['cq'].empty():