mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-07-07 13:32:09 -07:00
fix
This commit is contained in:
parent
e9c0f5fb9f
commit
7180076ecf
1 changed files with 21 additions and 13 deletions
|
@ -29,7 +29,9 @@ class Subprocessor(object):
|
||||||
def kill(self):
|
def kill(self):
|
||||||
self.p.terminate()
|
self.p.terminate()
|
||||||
self.p.join()
|
self.p.join()
|
||||||
|
self.s2c.close()
|
||||||
|
self.c2s.close()
|
||||||
|
|
||||||
#overridable optional
|
#overridable optional
|
||||||
def on_initialize(self, client_dict):
|
def on_initialize(self, client_dict):
|
||||||
#initialize your subprocess here using client_dict
|
#initialize your subprocess here using client_dict
|
||||||
|
@ -77,7 +79,12 @@ class Subprocessor(object):
|
||||||
time.sleep(0.001)
|
time.sleep(0.001)
|
||||||
|
|
||||||
self.on_finalize()
|
self.on_finalize()
|
||||||
|
|
||||||
|
|
||||||
c2s.put ( {'op': 'finalized'} )
|
c2s.put ( {'op': 'finalized'} )
|
||||||
|
self.s2c.close()
|
||||||
|
self.c2s.close()
|
||||||
|
|
||||||
return
|
return
|
||||||
except Subprocessor.SilenceException as e:
|
except Subprocessor.SilenceException as e:
|
||||||
pass
|
pass
|
||||||
|
@ -281,20 +288,21 @@ class Subprocessor(object):
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
for cli in self.clis[:]:
|
for cli in self.clis[:]:
|
||||||
terminate_it = False
|
if cli.state != 2:
|
||||||
while not cli.c2s.empty():
|
terminate_it = False
|
||||||
obj = cli.c2s.get()
|
while not cli.c2s.empty():
|
||||||
obj_op = obj['op']
|
obj = cli.c2s.get()
|
||||||
if obj_op == 'finalized':
|
obj_op = obj['op']
|
||||||
|
if obj_op == 'finalized':
|
||||||
|
terminate_it = True
|
||||||
|
break
|
||||||
|
|
||||||
|
if (time.time() - cli.sent_time) > 30:
|
||||||
terminate_it = True
|
terminate_it = True
|
||||||
break
|
|
||||||
|
|
||||||
if (time.time() - cli.sent_time) > 30:
|
if terminate_it:
|
||||||
terminate_it = True
|
cli.state = 2
|
||||||
|
cli.kill()
|
||||||
if terminate_it:
|
|
||||||
cli.state = 2
|
|
||||||
cli.kill()
|
|
||||||
|
|
||||||
if all ([cli.state == 2 for cli in self.clis]):
|
if all ([cli.state == 2 for cli in self.clis]):
|
||||||
break
|
break
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue