Browse Source

Terminate python sub-process

tags/v0.3.0-alpha
yanghaitao 5 years ago
parent
commit
1e98fa35b8
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      mindspore/dataset/engine/datasets.py

+ 7
- 0
mindspore/dataset/engine/datasets.py View File

@@ -1431,6 +1431,10 @@ class MapDataset(DatasetOp):
iter_specific_operations.append(op)
self.operations = iter_specific_operations

def __del__(self):
if hasattr(self, 'process_pool') and self.process_pool is not None:
self.process_pool.terminate()


class FilterDataset(DatasetOp):
"""
@@ -2463,6 +2467,9 @@ class _GeneratorWorker(multiprocessing.Process):
"""
return self.res_queue.get(timeout=5)

def __del__(self):
self.terminate()


class GeneratorDataset(SourceDataset):
"""


Loading…
Cancel
Save