✨ process dump: JSON Data and workflow outputs - #7589
Conversation
Dumping copies the repository of each linked `Data` node, so a node that keeps its content in the database, such as the `Dict` of results of a calculation, reached no file, and the nodes a workflow returned reached none either. Add `include_data_json`, off by default and exposed as `--include-data-json/--exclude-data-json` on `verdi process dump`, `verdi group dump` and `verdi profile dump`: - Every linked `Data` node without repository content is written as `<link-label>.json` beside the repository-backed ones. A `Dict` writes its dictionary, an `Int`/`Float`/`Str`/`Bool` its bare value, anything else its attributes. - A namespaced link label such as `pseudos__Si` is written into one `pseudos.json` for the whole namespace. - An existing file is never overwritten; the JSON is skipped with a warning instead. - Each `WorkflowNode` gains a `node_outputs` directory holding the nodes it returned, with repository-backed ones copied out as they are for a calculation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add the flag to the "Process Dumping" how-to, with the tree a `MultiplyAddWorkChain` dump produces under it, and a `CHANGELOG` entry under Unreleased. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
An output whose repository is empty, such as a bare `FolderData`, has no repository content and so is written as JSON like any other such node; the file holds the empty attributes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The keyword also gives a `WorkflowNode` a `node_outputs` directory; the parameter docs described only the JSON files. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The CLI help, the three `.dump()` docstrings and the CHANGELOG paragraph said `include_data_json` alone gives every `WorkflowNode` a `node_outputs` directory. `test_workflow_returns_need_both_options` shows neither option alone produces it. - Reworded the `INCLUDE_DATA_JSON` help text in `cmdline/params/options/main.py`. - Reworded the `:param include_data_json:` docstring in `orm/nodes/process/process.py`, `orm/groups.py` and `manage/configuration/profile.py`. - Reworded the CHANGELOG paragraph to match. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
`.. versionadded:: 2.10` sat mid-paragraph, several sentences below the "Process dumping" heading, unlike every other versionadded directive in this file. - Moved it to sit right after `.. versionadded:: 2.6`, under the section heading. - Noted that an incremental re-dump into an existing directory does not add the JSON files to a node already dumped, since the dump log marks that node done; use `--overwrite` or a new path to pick them up. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The nodes a workflow returns and the `Data` nodes that keep their content in the database are two separate gaps, reached by one flag named after only the second of them. A returned `SinglefileData` is a file to copy, and asking for it through `--include-data-json` misdescribes it. Split the flag in two, both off by default and both exposed on `verdi process dump`, `verdi group dump` and `verdi profile dump` and as keywords on `ProcessNode.dump()`, `Group.dump()` and `Profile.dump()`: - `--include-data-json` writes every linked `Data` node without repository content as `<link-label>.json`, wherever the dump already places that node's repository-backed siblings. - `--include-workflow-outputs` gives a `WorkflowNode` its own `node_outputs` directory of the nodes it returned, copying out the repository-backed ones. A returned `Dict` still needs both flags. - The workflow half no longer follows `--include-outputs`, which governs a calculation's `CREATE` outputs, not a workflow's `RETURN` outputs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- A workflow dumped with `--include-workflow-outputs` alone copies out its returned `SinglefileData` and passes over its returned `Dict`, with `--include-outputs` off: one case pinning that the workflow half is neither gated on `--include-outputs` nor on the JSON flag. - A returned `Dict` is parametrized over all four flag combinations, and is written for exactly one of them. - The CLI-to-API mapping tests for all three commands carry both flags, and a further case pins that both default to `False`. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- The worked example passes `--include-workflow-outputs` alongside `--include-data-json`, since the workchain's result is a `Dict`. - The prose names the two gaps separately and says which flag closes which, rather than presenting one as a side effect of the other. - The CHANGELOG entry and the `versionadded` note name both flags. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
`_nest_by_link_label` warned and dropped a clashing label only when the value already in its place was a scalar or a list. When that value was a dictionary, as a `Dict` node's is, the clashing label was merged into it: the `Dict`'s own key took an unrelated sibling link's value, and nothing was logged. - Track the path of each label already placed, and drop any label that would be written inside or on top of one, with a warning. - Siblings of one namespace are unaffected and still share a document. - Drive the helper over six label sets, the `Dict`-valued parent among them. - Illustrate the namespace rule with `alphas__filled` rather than `pseudos__Si`, which carries repository content and so never reaches the JSON. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Renumber the added example to the PKs the section already uses, rather than starting a second numbering halfway down. - Illustrate a shared namespace with `alphas__filled`/`alphas__empty`: pseudopotentials carry repository content, so they land in a directory and never in the JSON. - Say that a namespace holding both kinds is split between the directory and the JSON file. - Name `List` in the list of what each node type writes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Recent entries under Unreleased are generated at release time from the merged pull requests, not written per PR. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Under `--flat`, a Dict input's `<label>.json` written before a same-named output file was copied silently lost to that copy, with no warning from the existing "already exists" guard. - Copy node_inputs' and node_outputs' repository-backed content before writing either side's JSON, so the guard sees every file that will occupy the shared directory. - Split `_dump_io_files` into `_copy_io_repository_content` (copy, collect JSON) and the existing `_dump_io_json` (write), reused by both the calculation and the workflow node_outputs paths. - Add a regression test: an input Dict and a same-named output FolderData file collide, and the FolderData's file survives with a warning instead of being silently overwritten. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Placed under the section heading it read as if the whole process-dump section were new in 2.10. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
`Dict`, `List` and the `BaseType` scalars all answer `value`; three branches said so one class at a time. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks 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 #7589 +/- ##
==========================================
+ Coverage 80.69% 80.71% +0.03%
==========================================
Files 581 581
Lines 47139 47147 +8
==========================================
+ Hits 38035 38051 +16
+ Misses 9104 9096 -8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
CI and RTD built against upstream aiida-core 92c21cc2dd, which lacks the process-dump JSON and workflow-output flags; they now clone elinscott/aiida-core at 715972d65e, upstream main with the aiidateam/aiida-core#7589 commits on top. - three test jobs and the RTD build fetch the fork commit - CLAUDE.md records the pin and that it returns to upstream once #7589 merges Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A dumped run showed a step's parsed results and a workflow's own outputs nowhere; every step now lists them, with the run's answers indexed at the top. - consumes aiida-core's include_data_json / include_workflow_outputs (fork pin, aiidateam/aiida-core#7589) - folders for CalcJobs and graphs only; flat inputs/ and outputs/ per step; lone files take the link label - files link only when they hold the same node's content, canonical at the producing step - a graph's outputs/ indexes its answers as links under its own names - scratch folders, codes, retrieved echoes, engine bookkeeping and empty listings are not written; a failed run keeps its stderr - Si and O2 tutorial dumps inspected live Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Thanks for opening the PR, @elinscott. Some top-level design questions. I wrote most of the dumping code quite a while ago and would do plenty differently now, but, I'd try to keep it backwards compatible here, and we can discuss bigger reworks within the framing of v3.
Zooming out, and this probably wants its own issue: the reason all of the above are open questions is that the dump was designed around processes, and v3 sketchThe internal vocabulary is already right, only the directory names it maps onto are misleading: # _generate_calculation_io_mapping
aiida_entities = ['repository', 'retrieved', 'inputs', 'outputs']
default_dirs = ['inputs', 'outputs', 'node_inputs', 'node_outputs']So internal
One entry per link, always identity and the database side, plus a A |
TL;DR
A
MultiplyAddWorkChain, dumped as it is today:Crucially, the number the workflow computed is nowhere in that tree.
With this PR, it is dumped when using the new flags:
Problem
Discussed extensively in #7588: a dump does not contain
Datanodes nor the returned outputs ofWorkflowNodes.Changes
Two new flags
verdi process dump,verdi group dumpandverdi profile dumpProcessNode.dump(),Group.dump()andProfile.dump().--include-data-jsonwrites every linkedDatanode that has no repository content as<link-label>.json, wherever the dump already places that node's repository-backed siblings. ADictwrites its dictionary, aListits list, anInt/Float/Str/Boolits bare value, and anything else its attributes (see e.g.remote_folder.jsonabove, which holds the calculation'sremote_path)--include-workflow-outputsgives eachWorkflowNodeanode_outputsdirectory of the nodes it returned, with repository-backed returns copied out exactly as they are for a calculation. These files are not dumped with--include-outputs: that flag governs a calculation'sCREATEoutputs, and a workflow'sRETURNoutputs are something separate. (We could possibly reconsider the flag names though...)Note that...
alphas__filledandalphas__emptybecome a singlealphas.jsonrather than a file per port.alphas/andalphas.json.Pre-existing collisions
copy_treehas pre-existing issues with file collisions that appear under--flat. This PR mitigates the risk (JSON files are written after the repository copies, so on a name collision the JSON is skipped with a warning); the collision issue should be dealt with in a separate PR.Notes
Addresses #7588. The issue's secondary question — whether a single-file repository should flatten to
<label>.<ext>— is left for a follow-up.