Conversation
tmadlener
reviewed
Apr 7, 2026
| m.SetFastMethod(ROOT.kTRUE) | ||
| m.AddObjectNames("metadata") | ||
| if not m.PartialMerge(ROOT.TFileMerger.kAll | ROOT.TFileMerger.kOnlyListed | ROOT.TFileMerger.kIncremental): | ||
| raise RuntimeError(f"TFileMerger failed adding metadata {fmt_name} to {output_file}") |
Collaborator
There was a problem hiding this comment.
Suggested change
| raise RuntimeError(f"TFileMerger failed adding metadata {fmt_name} to {output_file}") | |
| raise RuntimeError(f"TFileMerger failed adding metadata category to {output_file}") |
Would make it possible to drop the fmt_name from the arguments with essentially the same information.
tmadlener
reviewed
Apr 7, 2026
Collaborator
tmadlener
left a comment
There was a problem hiding this comment.
Looks good to me (minor comments below). I suppose we are not yet at a stage where we have less code if we use the root file merger (that hadd uses internally) directly instead of going through hadd and then "fixing things" afterwards?
Comment on lines
+91
to
+92
| tmp_fd, tmp_path = tempfile.mkstemp(suffix=".root") | ||
| os.close(tmp_fd) |
Collaborator
There was a problem hiding this comment.
with tempfile.NamedTemporaryFile(suffix=".root", delete=True) as f:
tmp_path = f.namethat way the cleanup below would be automatically done. Or do we need the file handle closed for ROOT?
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.
Currently
podio-merge-filesreads every Frame and writes it back. This is very slow (between 10x and 100x) compared to usinghadd; I would say unusable. For TTrees and RNTuples, our files can be merged withhadd, producing readable files with the only caveat that there are some categories that may be repeated a few times, like metadata. The new implementation is equivalent to what we had before, but much faster.BEGINRELEASENOTES
haddwith ROOT files inpodio-merge-filesto speed it up and add code to make sure the metadata is set correctly. Keep the old behaviour for the other backends (SIO only).ENDRELEASENOTES
@meleneemil