Skip to content

Commit

Permalink
Merge pull request #185 from plotly/andrew/tmp_resiliency
Browse files Browse the repository at this point in the history
Andrew/tmp resiliency
  • Loading branch information
ayjayt authored Jan 29, 2025
2 parents fc68b69 + 3d05b6e commit d71b5a2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions choreographer/utils/_tmpfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def _delete_manually( # noqa: C901, PLR0912
self,
*,
check_only: bool = False,
quiet: bool = False,
) -> tuple[
int,
int,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -186,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(1)
_logger.info(f"Extra manual clean executing {i}.")
self._delete_manually()
self._delete_manually(quiet=True)
i += 1
time.sleep(2)
if self.path.exists():
self._delete_manually(quiet=False)

# testing doesn't look threads so I guess we'll block
extra_clean()
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d71b5a2

Please sign in to comment.