This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git


The following commit(s) were added to refs/heads/main by this push:
     new 52cbd2b  Ensure that the temporary revision directory is on the same 
filesystem
52cbd2b is described below

commit 52cbd2b57bbf9d89f3ad039f674f4befd52710fb
Author: Sean B. Palmer <[email protected]>
AuthorDate: Mon May 26 19:58:43 2025 +0100

    Ensure that the temporary revision directory is on the same filesystem
---
 atr/revision.py | 6 ++++--
 atr/server.py   | 1 +
 atr/util.py     | 5 +++++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/atr/revision.py b/atr/revision.py
index ebb1151..deac150 100644
--- a/atr/revision.py
+++ b/atr/revision.py
@@ -58,9 +58,11 @@ async def create_and_manage(
             RuntimeError("Release does not exist for new revision creation")
         )
         old_revision = await interaction.latest_revision(release)
+
     # Create a temporary directory
-    # Ensure that it's removed on any exception
-    temp_dir: str = await asyncio.to_thread(tempfile.mkdtemp)
+    # We ensure, below, that it's removed on any exception
+    # Use the tmp subdirectory of state, to ensure that it is on the same 
filesystem
+    temp_dir: str = await asyncio.to_thread(tempfile.mkdtemp, 
dir=util.get_tmp_dir())
     temp_dir_path = pathlib.Path(temp_dir)
     try:
         # The directory was created by mkdtemp, but it's empty
diff --git a/atr/server.py b/atr/server.py
index fe2db51..c3fe38c 100644
--- a/atr/server.py
+++ b/atr/server.py
@@ -79,6 +79,7 @@ def app_dirs_setup(app_config: type[config.AppConfig]) -> 
None:
     print(f"Working directory changed to: {os.getcwd()}")
     util.get_unfinished_dir().mkdir(parents=True, exist_ok=True)
     util.get_finished_dir().mkdir(parents=True, exist_ok=True)
+    util.get_tmp_dir().mkdir(parents=True, exist_ok=True)
 
 
 def app_setup_api_docs(app: base.QuartApp) -> None:
diff --git a/atr/util.py b/atr/util.py
index 62ce4f7..ca89278 100644
--- a/atr/util.py
+++ b/atr/util.py
@@ -333,6 +333,11 @@ async def get_release_stats(release: models.Release) -> 
tuple[int, int, str]:
     return count, total_bytes, formatted_size
 
 
+def get_tmp_dir() -> pathlib.Path:
+    # This must be on the same filesystem as the other state subdirectories
+    return pathlib.Path(config.get().STATE_DIR) / "tmp"
+
+
 def get_unfinished_dir() -> pathlib.Path:
     return pathlib.Path(config.get().UNFINISHED_STORAGE_DIR)
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to