Skip to content

Commit

Permalink
Moving worker timeout constant to proper file (pytorch#839)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: pytorch#839

Test Plan: Imported from OSS

Reviewed By: ejguan

Differential Revision: D40494730

Pulled By: NivekT

fbshipit-source-id: ccd3ec723fbf4b99a80a144971da7cb3fa80d1fe
  • Loading branch information
NivekT authored and ejguan committed Oct 21, 2022
1 parent 4127c77 commit 992cdef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions torchdata/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@

# Use the same timeout as PyTorch Distributed
default_timeout_in_s = 30 * 60

default_dl2_worker_join_timeout_in_s = 20
4 changes: 2 additions & 2 deletions torchdata/dataloader2/reading_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from torch.utils.data import DataLoader

from torchdata._constants import default_timeout_in_s
from torchdata._constants import default_dl2_worker_join_timeout_in_s, default_timeout_in_s
from torchdata.dataloader2 import communication
from torchdata.dataloader2.graph import DataPipe
from torchdata.datapipes.iter import FullSync, IterableWrapper, IterDataPipe
Expand Down Expand Up @@ -322,7 +322,7 @@ def clean_me(process, req_queue, res_queue):
# TODO(620): Make termination a function of QueueWrapperDataPipe (similar to reset)
req_queue.put(communication.messages.TerminateRequest())
_ = res_queue.get()
process.join(20)
process.join(default_dl2_worker_join_timeout_in_s)

for process, req_queue, res_queue in self.processes:
try:
Expand Down

0 comments on commit 992cdef

Please sign in to comment.