Support stashed directory cleaning in `verdi node delete --clean-workdir`
The --clean-workdir flag only cleaned remote_folder outputs but ignored remote_stash outputs created by the stashing mechanism.
Changes
-
src/aiida/orm/utils/remote.py: Addedget_calcjob_stashed_paths()andclean_mapping_stashed_paths()to query and clean stashed data, mirroring the existing remote folder functions -
src/aiida/orm/nodes/data/remote/stash/: Implemented_clean()methods:-
RemoteStashFolderData: removes target directory viaclean_remote() -
RemoteStashCompressedData: removes compressed file viatransport.remove() -
RemoteStashCustomData: raisesNotImplementedErrorwith message "I don't know how to delete remote files of RemoteStashCustomData" - Added
KEY_EXTRA_CLEANEDconstant andget_authinfo()helper to base class
-
-
src/aiida/cmdline/commands/cmd_node.py: Extendednode_deleteto query bothremote_folderandremote_stashoutputs when--clean-workdiris specified
Behavior
# Now cleans both remote work directories and stashed directories
verdi node delete --clean-workdir <node_pk>
# For RemoteStashCustomData nodes, raises:
# Critical: I don't know how to delete remote files of RemoteStashCustomData.
# Please manually clean the stashed data for node <pk>.
Cleaned status is tracked via the cleaned extra on both RemoteData and RemoteStashData nodes.
Original prompt
This section details on the original issue you should resolve
<issue_title>
CLI:verdi node delete --clean-workdirpotentially could also support removing stashed directories.</issue_title> <issue_description>Following PR https://github.com/aiidateam/aiida-core/pull/6756 , which providesverdi node delete --clean-workdirfunctionality at first place:While still designing and developing aiidateam/aiida-core#6764 stashing, I could not foresee if
verdi node delete --clean-workdirshould also clean stashed directories, and even if so, how should that be done.Therefore, I document here, so after completing aiidateam/aiida-core#6764, we can come back here, think through and develop
verdi node delete --clean-workdirfurther. </issue_description><agent_instructions>I think we should also support this. With one exception, if the the type is
RemoteStashCustomDatayou just raise: "I don't know how to delete remote files of RemoteStashCustomData"</agent_instructions>Comments on the Issue (you are @copilot in this section)
@khsrali Hi @Muhammad-RebaalThanks for your interest.
This issue is mainly for future, when we put stashing fully in place. Right now it's not possible to solve it, because we have not finalized the stashing interface yet.</comment_new>
- Fixes aiidateam/aiida-core#6781
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
Codecov Report
:x: Patch coverage is 4.90196% with 97 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 29.14%. Comparing base (5014979) to head (1d5f8cb).
Additional details and impacted files
@@ Coverage Diff @@
## main #7149 +/- ##
===========================================
- Coverage 79.62% 29.14% -50.48%
===========================================
Files 566 566
Lines 43576 43628 +52
===========================================
- Hits 34694 12709 -21985
- Misses 8882 30919 +22037
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.