🐛 Process dump: gate node_outputs on repository content - #7525
Open
elinscott wants to merge 2 commits into
Open
Conversation
`node_outputs/` was created only when a calculation had a `SinglefileData` or `FolderData` output, but the full, unfiltered list of output nodes was then dumped into it. An `ArrayData` output was therefore written when a file-like output happened to sit beside it and dropped when it was the only output, so whether a node reached disk depended on its siblings rather than on itself. Gate the directory on whether an output actually carries repository content, the same per-node decision `_dump_calculation_io_files` already makes when it writes them. Calculations returning only database-backed nodes still produce no empty `node_outputs/`. Add regression tests for an array-only calculation, an array with a file-like sibling, and a database-only calculation.
📝 WalkthroughWalkthroughThe process dumper now creates ChangesProcess output dumping
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7525 +/- ##
==========================================
+ Coverage 80.67% 80.67% +0.01%
==========================================
Files 581 581
Lines 46998 46998
==========================================
+ Hits 37909 37913 +4
+ Misses 9089 9085 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7523
Problem
NodeRepoIoDumper._dump_calculation_iodecided whether to createnode_outputs/by asking whether any output of the calculation was aSinglefileDataor aFolderData, and then dumped the full, unfiltered list of outputs into it. This gave differening opionions on what should be dumped, giving strange behaviour e.g. an output node's fate depended on its siblings:ArrayDatanext to aSinglefileDatagot both writtenArrayDataon its own got nothing!The same applies to every other repository-backed type the
isinstancecheck does not name (BandsData,TrajectoryDataandXyData) all of which store.npypayloads asArrayDatasubclasses, and aKpointsDataholding an explicit k-point list rather than a mesh.Changes
The gate now asks each output whether it has repository content
which is the same per-node question
_dump_calculation_io_filesalready answers a few lines further down when it decides what to write.The directory-creation check and the writing loop now agree by construction, so the type list cannot drift out of date again. The check's real purpose is preserved: calculations whose outputs live entirely in the database (
Dict,Int,StructureData,RemoteData) have empty repositories, so they still leave no emptynode_outputs/behind.Of course, this means that dumps of array-heavy profiles grow, in some cases substantially --- but this is intended behaviour and not a new cost. (A non-representative example: one of my workflow dumps grew by 3% due to this change.)
Testing
New
tests/tools/dumping/test_process.pyasserts:node_outputs/arraydata/default.npy(fails before this change);DictandIntcreates nonode_outputs/directory (passes before this change — this pins the check's original purpose).The existing dumping tests are unaffected.
Notes
tests/tools/dumping/integration_tests.pyis not picked up by pytest, so its 26 tests have never run in CI. They do pass when invoked explicitly, both before and after this change.