Use pathlib to create tempdir - #1982
Open
r42-chun wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates ayon_core.pipeline.tempdir to create staging temp directories using pathlib instead of tempfile.mkdtemp, aiming to improve permission inheritance when the temp root is on a different OS/fileserver (e.g., AYON_TMPDIR pointing to a cross-OS share).
Changes:
- Replaced
tempfile.mkdtemp(...)with manualPath(...).mkdir(...)creation in_create_local_staging_dir. - Introduced UUID-based folder naming to ensure uniqueness.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+70
to
+79
| if dirpath is None: | ||
| dirpath = tempfile.gettempdir() | ||
|
|
||
| base_dir = Path(dirpath) | ||
| unique_id = str(uuid.uuid4().hex[:8]) | ||
| folder_name = f"{prefix or ''}{unique_id}{suffix or ''}" | ||
| tmpdir = base_dir / folder_name | ||
| tmpdir.mkdir(parents=True, exist_ok=False) | ||
|
|
||
| return str(tmpdir) |
iLLiCiTiT
reviewed
Aug 5, 2026
iLLiCiTiT
reviewed
Aug 5, 2026
Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
iLLiCiTiT
reviewed
Aug 5, 2026
iLLiCiTiT
reviewed
Aug 5, 2026
Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog Description
Updated the _create_local_staging_dir function to use pathlib.
This is because if the temp directory is on a different os server, for example if the function is ran on a windows computer to create a temp file on a linux server, the permissions isn't inherited correctly from the parent folder which causes the writing of the file to the temp directory to error.
Testing notes:
Create a review from 3dsmax with a temp directory set on another os server with the environment variable AYON_TMPDIR.
Check if it works