Skip to content

Conversation

@opotowsky
Copy link
Member

@opotowsky opotowsky commented Dec 30, 2025

What is the change? Why is it being made?

This PR updates the behavior of cleanPath and fixes a bug in the code regarding which paths to always clean/never clean. This bug fix is in support of enabling the TemporaryDirectoryChanger to have a global edit to its behavior when a user wants to override all root args used, e.g., for unit tests in a read-only environment.

See #2401 for a full description of the bug.

SCR Information

Change Type: fixes

One-Sentence Rationale: cleanPath is not behaving properly, and that is being remedied in order to support a global override option for the TemporaryDirectoryChanger root argument.

One-line Impact on Requirements: NA


Checklist

@opotowsky opotowsky added bug Something is wrong: Highest Priority feature request Smaller user request labels Dec 30, 2025
@opotowsky opotowsky linked an issue Dec 30, 2025 that may be closed by this pull request
Comment on lines 207 to 214
# Any tempDir can be deleted
if tempDir:
valid = True

if pathlib.Path(context.APP_DATA) in pathlib.Path(path).parents:
# If the path slated for deletion is a subdirectory of _FAST_PATH, then cool, delete.
# _FAST_PATH itself gets deleted on program exit.
if path.is_relative_to(context.getFastPath()):
valid = True
Copy link
Member Author

@opotowsky opotowsky Dec 31, 2025

Choose a reason for hiding this comment

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

We have only 2 scenarios that allow us to delete a path (temp dir, and underneath FAST_PATH), so I think this function is pretty safe.

I will need to do a lot of testing to make sure this doesn't mess up anything in the downstream code.

from armi import context, runLog
from armi.utils import safeCopy

# TODO: This needs to be updated, since I don't think any of these are in common use anymore
Copy link
Member

Choose a reason for hiding this comment

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

Just delete this list then.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh sure I can do that 😈

Copy link
Member Author

Choose a reason for hiding this comment

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

😈 d11bc73

@opotowsky
Copy link
Member Author

@john-science this is a feature addition that exposed a bug, so I'm treating it as a bug ticket. I could separate the feature addition into a different PR if you prefer for SCR clarity. The feature is just this:
image

Also I see a bunch of CI failed. I'll look into that later today....bodes well for my downstream testing 🙃

"pyDOE>=0.3.8", # We import a Latin-hypercube algorithm to explore a phase space
"pyevtk>=1.2.0", # Handles binary VTK visualization files
"ruamel.yaml ; python_version >= '3.11.0'", # Our foundational YAML library
"ruamel.yaml<0.19.0; python_version >= '3.11.0'", # Our foundational YAML library
Copy link
Member Author

Choose a reason for hiding this comment

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

we got one of those "someone released a new package and now everything broke" situations.

I didn't look into fixes yet, just testing that this is working first

Comment on lines +179 to +180
# We can consider caches temporary directories, since they are not important containers for simulation results.
cleanPath(cachedFolder, tempDir=True)
Copy link
Member Author

Choose a reason for hiding this comment

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

this makes me think we could call it something else, like safeToDelete

but of course anyone using cleanPath thinks their path is safe to delete!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something is wrong: Highest Priority feature request Smaller user request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cleanPath behavior has troubling issues

3 participants