!6670 [MD] r1.0 Relax time constraint for GeneratorWorker
Merge pull request !6670 from luoyang/son_r1.0
This commit is contained in:
commit
e611556834
|
@ -3372,7 +3372,7 @@ class _GeneratorWorkerMt(threading.Thread):
|
|||
"""
|
||||
Get function for worker result queue. Block with timeout.
|
||||
"""
|
||||
return self.res_queue.get(timeout=10)
|
||||
return self.res_queue.get(timeout=30)
|
||||
|
||||
|
||||
class _GeneratorWorkerMp(multiprocessing.Process):
|
||||
|
@ -3395,17 +3395,18 @@ class _GeneratorWorkerMp(multiprocessing.Process):
|
|||
"""
|
||||
Get function for worker result queue. Block with timeout.
|
||||
"""
|
||||
while check_iterator_cleanup() is False:
|
||||
try:
|
||||
return self.res_queue.get(timeout=10)
|
||||
except multiprocessing.TimeoutError:
|
||||
continue
|
||||
|
||||
raise Exception("Generator worker process timeout")
|
||||
# Relax 10s to 30s, since it sometimes will cause "Generator worker process timeout"
|
||||
# when we run too many iterators with infinite epoch(num_epoch=-1)
|
||||
return self.res_queue.get(timeout=30)
|
||||
|
||||
|
||||
def __del__(self):
|
||||
self.terminate()
|
||||
# Try to destruct here, sometimes the class itself will be destructed in advance,
|
||||
# so "self" will be a NoneType
|
||||
try:
|
||||
self.terminate()
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
|
||||
class GeneratorDataset(MappableDataset):
|
||||
|
|
Loading…
Reference in New Issue