From 291cf767ee61f54bdc77eb672262c0f65270e63c Mon Sep 17 00:00:00 2001 From: YangLuo Date: Sun, 20 Sep 2020 16:13:50 +0800 Subject: [PATCH] relax time constraint for GeneratorWorker --- mindspore/dataset/engine/datasets.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/mindspore/dataset/engine/datasets.py b/mindspore/dataset/engine/datasets.py index aa0be6466e..4136a4195a 100644 --- a/mindspore/dataset/engine/datasets.py +++ b/mindspore/dataset/engine/datasets.py @@ -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,13 @@ 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") - + return self.res_queue.get(timeout=30) def __del__(self): - self.terminate() + try: + self.terminate() + except AttributeError: + pass class GeneratorDataset(MappableDataset):