mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-07-11 15:47:01 -07:00
fix SubprocessorBase
This commit is contained in:
parent
a37af3e965
commit
8686309417
1 changed files with 14 additions and 8 deletions
|
@ -179,8 +179,7 @@ class SubprocessorBase(object):
|
||||||
if (time.time() - p['sent_time']) > self.no_response_time_sec:
|
if (time.time() - p['sent_time']) > self.no_response_time_sec:
|
||||||
print ( '%s doesnt response, terminating it.' % (p['name']) )
|
print ( '%s doesnt response, terminating it.' % (p['name']) )
|
||||||
self.onHostDataReturn ( p['sent_data'] )
|
self.onHostDataReturn ( p['sent_data'] )
|
||||||
p['sq'].put ( {'op': 'close'} )
|
p['process'].terminate()
|
||||||
p['process'].join()
|
|
||||||
self.processes.remove(p)
|
self.processes.remove(p)
|
||||||
|
|
||||||
if all ([p['state'] == 'free' for p in self.processes]):
|
if all ([p['state'] == 'free' for p in self.processes]):
|
||||||
|
@ -194,21 +193,28 @@ class SubprocessorBase(object):
|
||||||
|
|
||||||
for p in self.processes[:]:
|
for p in self.processes[:]:
|
||||||
p['sq'].put ( {'op': 'close'} )
|
p['sq'].put ( {'op': 'close'} )
|
||||||
|
p['sent_time'] = time.time()
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
for p in self.processes[:]:
|
for p in self.processes[:]:
|
||||||
|
terminate_it = False
|
||||||
while not p['cq'].empty():
|
while not p['cq'].empty():
|
||||||
obj = p['cq'].get()
|
obj = p['cq'].get()
|
||||||
obj_op = obj['op']
|
obj_op = obj['op']
|
||||||
if obj_op == 'finalized':
|
if obj_op == 'finalized':
|
||||||
|
terminate_it = True
|
||||||
|
break
|
||||||
|
|
||||||
|
if (time.time() - p['sent_time']) > self.no_response_time_sec:
|
||||||
|
terminate_it = True
|
||||||
|
|
||||||
|
if terminate_it:
|
||||||
p['state'] = 'finalized'
|
p['state'] = 'finalized'
|
||||||
|
p['process'].terminate()
|
||||||
|
|
||||||
if all ([p['state'] == 'finalized' for p in self.processes]):
|
if all ([p['state'] == 'finalized' for p in self.processes]):
|
||||||
break
|
break
|
||||||
|
|
||||||
for p in self.processes[:]:
|
|
||||||
p['process'].terminate()
|
|
||||||
|
|
||||||
self.onHostProcessEnd()
|
self.onHostProcessEnd()
|
||||||
|
|
||||||
return self.get_start_return()
|
return self.get_start_return()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue