Skip to content

Commit

Permalink
[Distributed] Cleanup the process pool correctly when the process exi…
Browse files Browse the repository at this point in the history
…ts. (dmlc#2781)

Co-authored-by: xiang song(charlie.song) <[email protected]>
  • Loading branch information
zheng-da and classicsong authored Mar 29, 2021
1 parent 66f7fe8 commit 97863ab
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/dgl/distributed/dist_dataloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ def __init__(self, dataset, batch_size, shuffle=False, collate_fn=None, drop_las
res.get()

def __del__(self):
# When the process exits, the process pool may have been closed. We should try
# and get the process pool again and see if we need to clean up the process pool.
self.pool, self.num_workers = get_sampler_pool()
if self.pool is not None:
results = []
for _ in range(self.num_workers):
Expand Down

0 comments on commit 97863ab

Please sign in to comment.