From 58ec2a4bd574d719beeb163ffb78bba3f8903031 Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Tue, 28 Jan 2025 23:54:08 -0500 Subject: [PATCH 1/4] Extend timeout --- tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 8939e429..ee8388e3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -89,7 +89,7 @@ async def wrapped_test_fn(*args, **kwargs): def pytest_configure(): # change this by command line TODO - pytest.default_timeout = 12 + pytest.default_timeout = 20 # pytest shuts down its capture before logging/threads finish From 5dd27978af6b8be2134627bd95cfb0edb2e961ca Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Tue, 28 Jan 2025 23:54:41 -0500 Subject: [PATCH 2/4] Add quiet option for manually clean --- choreographer/utils/_tmpfile.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/choreographer/utils/_tmpfile.py b/choreographer/utils/_tmpfile.py index abdbc104..079e43db 100644 --- a/choreographer/utils/_tmpfile.py +++ b/choreographer/utils/_tmpfile.py @@ -85,6 +85,7 @@ def _delete_manually( # noqa: C901, PLR0912 self, *, check_only: bool = False, + quiet: bool = False, ) -> tuple[ int, int, @@ -133,11 +134,12 @@ def _delete_manually( # noqa: C901, PLR0912 else: self.exists = False elif errors: - warnings.warn( # noqa: B028 - "The temporary directory could not be deleted, " - f"execution will continue. errors: {errors}", - TmpDirWarning, - ) + if not quiet: + warnings.warn( # noqa: B028 + "The temporary directory could not be deleted, " + f"execution will continue. errors: {errors}", + TmpDirWarning, + ) self.exists = True else: self.exists = False @@ -188,7 +190,7 @@ def extra_clean() -> None: i = 0 tries = 5 while self.path.exists() and i < tries: - time.sleep(1) + time.sleep(2) _logger.info(f"Extra manual clean executing {i}.") self._delete_manually() i += 1 From 1dab4014d1ac068f50518c58d00a221c9e3f9548 Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Tue, 28 Jan 2025 23:55:41 -0500 Subject: [PATCH 3/4] Silence all but last manual clean --- choreographer/utils/_tmpfile.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/choreographer/utils/_tmpfile.py b/choreographer/utils/_tmpfile.py index 079e43db..6b23e800 100644 --- a/choreographer/utils/_tmpfile.py +++ b/choreographer/utils/_tmpfile.py @@ -188,12 +188,14 @@ def remove_readonly( def extra_clean() -> None: i = 0 - tries = 5 + tries = 4 while self.path.exists() and i < tries: - time.sleep(2) _logger.info(f"Extra manual clean executing {i}.") - self._delete_manually() + self._delete_manually(quiet=True) i += 1 + time.sleep(2) + + self._delete_manually(quiet=False) # testing doesn't look threads so I guess we'll block extra_clean() From 3d05b6e00a6e01cf8ad7a10408330d09f8d5994f Mon Sep 17 00:00:00 2001 From: Andrew Pikul Date: Tue, 28 Jan 2025 23:56:21 -0500 Subject: [PATCH 4/4] Fix obvious logic errors --- choreographer/utils/_tmpfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/choreographer/utils/_tmpfile.py b/choreographer/utils/_tmpfile.py index 6b23e800..bb9a32f5 100644 --- a/choreographer/utils/_tmpfile.py +++ b/choreographer/utils/_tmpfile.py @@ -194,8 +194,8 @@ def extra_clean() -> None: self._delete_manually(quiet=True) i += 1 time.sleep(2) - - self._delete_manually(quiet=False) + if self.path.exists(): + self._delete_manually(quiet=False) # testing doesn't look threads so I guess we'll block extra_clean()