Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tag shared and temp files with username #430

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion streaming/base/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

"""A mid-epoch-resumable streaming/caching pytorch IterableDataset."""

import getpass
import json
import logging
import os
Expand Down Expand Up @@ -495,7 +496,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(os.path.sep, 'tmp', getpass.getuser(), 'streaming')
os.makedirs(self._filelock_root, exist_ok=True)

# Create the shared memory-backed barrier, without its lock, which is unpickleable.
Expand Down
3 changes: 2 additions & 1 deletion streaming/base/shared/prefix.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
prevent shared resources like shared memory from colliding.
"""

import getpass
from collections import Counter
from time import sleep
from typing import Iterator, List, Tuple, Union
Expand Down Expand Up @@ -41,7 +42,7 @@ def _get_path(prefix_int: int, name: str) -> str:
Returns:
str: Unique shared memory name.
"""
return f'{prefix_int:06}_{name}'
return f'{getpass.getuser()}_{prefix_int:06}_{name}'


def _pack_locals(dirnames: List[str], prefix_int: int) -> bytes:
Expand Down