Skip to content

Commit ee9f17e

Browse files
authored
Downloader: Resolve race condition (#19348)
1 parent c10fd22 commit ee9f17e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lightning/data/streaming/downloader.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from filelock import FileLock, Timeout
2121

2222
from lightning.data.streaming.client import S3Client
23+
from lightning.data.streaming.constants import _INDEX_FILENAME
2324

2425

2526
class Downloader(ABC):
@@ -56,7 +57,7 @@ def download_file(self, remote_filepath: str, local_filepath: str) -> None:
5657
return
5758

5859
try:
59-
with FileLock(local_filepath + ".lock", timeout=0):
60+
with FileLock(local_filepath + ".lock", timeout=1 if obj.path.endswith(_INDEX_FILENAME) else 0):
6061
if self._s5cmd_available:
6162
proc = subprocess.Popen(
6263
f"s5cmd cp {remote_filepath} {local_filepath}",

0 commit comments

Comments
 (0)