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

On Windows use Triton cache dir per pytest worker #3041

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions python/test/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,10 @@ def fresh_triton_cache():
except OSError:
# Ignore errors, such as PermissionError, on Windows
pass


def pytest_configure(config):
worker_id = os.getenv("PYTEST_XDIST_WORKER")
# On Windows, use a dedicated Triton cache per pytest worker to avoid PermissionError.
if os.name == "nt" and worker_id:
os.environ["TRITON_CACHE_DIR"] = tempfile.mkdtemp(prefix="triton-")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use worker_id as a unique identifier in the name of cache directory.

I could, but worker_id won't help to debug potentials issues, since we still need to know unique/random suffix.