Skip to content

Commit 6a44602

Browse files
authored
Support fail_on_missing_trees option (#580)
* Support fail_on_missing_trees option
1 parent 69286a8 commit 6a44602

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

docs/query_types.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ Each dictionary either has a ``treename`` key (indicating that it is a query on
8989

9090
* ``expressions``, ``cut``, ``filter_name``, ``aliases``: have the same meaning as for `TTree.arrays()`_ in ``uproot``, except that functions aren't permitted (but *glob*\s and *regular expressions*, which are special kinds of strings, are).
9191

92+
* ``fail_on_missing_trees``: if set to ``True``, will cause the transformation to fail if a tree specified in the query is not present in any of the input files. By default if a requested tree is not present, it will just be ignored and the corresponding output will not be in the output.
93+
9294
Other keys will be ignored.
9395

9496
Most queries will probably use ``filter_names``, which selects specific branches, and ``cut``, which selects specific rows. The ``expressions`` argument permits new values to be computed from the branches in the tree, and ``aliases`` can be used to introduce shorthand to make these expressions cleaner.

servicex/uproot_raw/uproot_raw.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2024, IRIS-HEP
1+
# Copyright (c) 2024-2025, IRIS-HEP
22
# All rights reserved.
33
#
44
# Redistribution and use in source and binary forms, with or without
@@ -54,6 +54,8 @@ class TreeSubQuery(DocStringBaseModel):
5454
"""Expression to filter the list of considered input variables by type name"""
5555
aliases: Optional[Mapping[str, str]] = None
5656
"""Define aliases to use in computation and expressions"""
57+
fail_on_missing_trees: Optional[bool] = None
58+
"""Make queries fail if input trees are missing (default False)"""
5759

5860

5961
class CopyHistogramSubQuery(DocStringBaseModel):

0 commit comments

Comments
 (0)