-
Notifications
You must be signed in to change notification settings - Fork 97
Edit cleanPath and TempDirChanger behavior
#2402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| # 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 |
There was a problem hiding this comment.
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.
armi/utils/pathTools.py
Outdated
| 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 😈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😈 d11bc73
|
@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: Also I see a bunch of CI failed. I'll look into that later today....bodes well for my downstream testing 🙃 |
oops, might want to make sure the path is the right type!
| "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 |
There was a problem hiding this comment.
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
| # We can consider caches temporary directories, since they are not important containers for simulation results. | ||
| cleanPath(cachedFolder, tempDir=True) |
There was a problem hiding this comment.
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!

What is the change? Why is it being made?
This PR updates the behavior of
cleanPathand fixes a bug in the code regarding which paths to always clean/never clean. This bug fix is in support of enabling theTemporaryDirectoryChangerto have a global edit to its behavior when a user wants to override allrootargs 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:
cleanPathis not behaving properly, and that is being remedied in order to support a global override option for theTemporaryDirectoryChangerroot argument.One-line Impact on Requirements: NA
Checklist
docfolder.pyproject.toml.