From aacea8bca902d40f0ceee8067b33a72f6cc66343 Mon Sep 17 00:00:00 2001 From: James Knighton Date: Sun, 21 Jan 2024 21:31:26 -0800 Subject: [PATCH] Use `tempfile.gettempdir()` instead of a hardcoded temp root. (#570) * Use `tempfile.gettempdir()` instead of a hardcoded temp root. * Lint. --- streaming/base/dataset.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/streaming/base/dataset.py b/streaming/base/dataset.py index e9f5b96d6..3869244b5 100644 --- a/streaming/base/dataset.py +++ b/streaming/base/dataset.py @@ -12,6 +12,7 @@ from concurrent.futures._base import Future from enum import IntEnum from math import ceil +from tempfile import gettempdir from threading import Event, Lock from time import sleep, time_ns from typing import Any, Dict, Iterator, Optional, Sequence, Tuple, Union @@ -512,7 +513,7 @@ def __init__(self, ] self._shm_prefix_int, self._locals_shm = get_shm_prefix(streams_local, streams_remote, world) - self._filelock_root = os.path.join(os.path.sep, 'tmp', 'streaming') + self._filelock_root = os.path.join(gettempdir(), 'streaming') os.makedirs(self._filelock_root, exist_ok=True) # Create the shared memory-backed barrier, without its lock, which is unpickleable.