-
Notifications
You must be signed in to change notification settings - Fork 97
Modifying unclear cleanPath 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
|
@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!
cleanPath and TempDirChanger behaviorcleanPath and TempDirChanger behavior
Except all changes to this feature to cause massive trauma downstream. People use this feature A LOT, and some people use it in surprising and unexpected ways. Since I am constantly surprised HOW this is being used, it's hard to know what changes would make this feature more stable. |
I mean, I don't agree with that. You have need to use this old feature in a new setting it's never been used in before. This is new feature or enhancement at best. |
…e of PR and need to update that)
| # Deletions are not immediate, so wait for it to finish. | ||
| maxLoops = 6 | ||
| waitTime = 0.5 | ||
| loopCounter = 0 | ||
| while os.path.exists(path): | ||
| loopCounter += 1 | ||
| if loopCounter > maxLoops: | ||
| break | ||
| sleep(waitTime) |
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.
@john-science will check on if this can be deleted. Could be cruft from the old days.
Does shutil only return once it's complete? If yes, can delete
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.
I can confirm:
- This is cruft from the ancient past.
- Their docs do not say that
shutil.rmtree()is blocking. But digging around the code for a while convinces me it is.
cleanPath and TempDirChanger behaviorcleanPath behavior
|
I love your re-design of the PR description. Thank you! |
| at the same time. Always check filenames for some special flag when calling this, especially | ||
| with full permissions on the cluster. You could accidentally delete everyone's work with one | ||
| misplaced line! This doesn't ask questions. | ||
| def cleanPath(path, mpiRank=0, tempDir=False): |
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.
I'm 50/50 on this. Should this new parameter be called tempDir, or something like force?
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 yea, I'm very willing to go over ideas here (see comment reply here #2402 (comment))
Really, as reviewer you can tell me what to do here.
force
forceDelete
forceClean
allowDelete
yesIHaveAPermit
AUTHORIZED
clearedForDeletion
blessedBeTheDeletion
outputCacheOrTempDirDeletionONLY
hallPassForDestruction
ok wow I need to stop
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.
I would go with force or forceClean, if I was picking from your list. #shrug

What is the change? Why is it being made?
Update: I'm marking this as a feature request instead of a bug for the SCR because although I'm calling it a bug, it wasn't hurting anyone. It's just super unclear behavior we are now correcting.
See #2401 for a full description of the non-ideal behavior.
DO_NOT_CLEAN_PATHScheck is removed entirely as it is not needed. It was doing the opposite of what was indicated--it was greenlighting those deletions. We don't need any greenlit deletions other than (2) and (3) below.APP_DATAcheck is replaced with a check that the path for deletion is under_FAST_PATH._FAST_PATHis amended often (e.g. if the code changes directory) and is not guaranteed to be underAPP_DATA, but_FAST_PATHand therefore anything in it is always safe to delete.TemporaryDirectoryChangerroot is not guaranteed to be under_FAST_PATH, so an argument is added to indicate tocleanPaththe dir slated for deletion comes from atempDirinstance (and this was also applied to output caches as well).This work exposed some confusion with
cleanTempDirs, so we made a ticket for that: #2408. I'm resolving that here because it was found during the course of this work.SCR Information
Change Type: features
One-Sentence Rationale:
cleanPathis not behaving like the variable names would indicate, so issues with naming were corrected incleanPathas well as incleanTempDirs.One-line Impact on Requirements: NA
Checklist
docfolder.pyproject.toml.