From e72d3731db814e24d56b3e3f3d37b3626dac75a7 Mon Sep 17 00:00:00 2001 From: iasonkrom Date: Thu, 31 Aug 2023 09:56:50 -0500 Subject: [PATCH 1/4] add uproot_options to uporoot.dask in factory --- src/coffea/nanoevents/factory.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/coffea/nanoevents/factory.py b/src/coffea/nanoevents/factory.py index 38e06d601..fb9a6c4b5 100644 --- a/src/coffea/nanoevents/factory.py +++ b/src/coffea/nanoevents/factory.py @@ -232,7 +232,7 @@ def from_root( treepath="/Events", entry_start=None, entry_stop=None, - chunks_per_file=1, + chunks_per_file=None, runtime_cache=None, persistent_cache=None, schemaclass=NanoAODSchema, @@ -268,7 +268,7 @@ def from_root( metadata : dict, optional Arbitrary metadata to add to the `base.NanoEvents` object uproot_options : dict, optional - Any options to pass to ``uproot.open`` + Any options to pass to ``uproot.open`` or ``uproot.dask`` access_log : list, optional Pass a list instance to record which branches were lazily accessed by this instance use_ak_forth: @@ -326,6 +326,17 @@ def from_root( ak_add_doc=True, filter_branch=_remove_not_interpretable, steps_per_file=chunks_per_file, + **uproot_options, + ) + elif chunks_per_file is None: + opener = partial( + uproot.dask, + file, + full_paths=True, + open_files=False, + ak_add_doc=True, + filter_branch=_remove_not_interpretable, + **uproot_options, ) else: opener = partial( @@ -336,6 +347,7 @@ def from_root( ak_add_doc=True, filter_branch=_remove_not_interpretable, steps_per_file=chunks_per_file, + **uproot_options, ) return cls(map_schema, opener, None, cache=None, is_dask=True) elif permit_dask and not schemaclass.__dask_capable__: From 881e4e23c5d00eba203956c80c2f758444ee96d0 Mon Sep 17 00:00:00 2001 From: iasonkrom Date: Thu, 31 Aug 2023 11:29:55 -0500 Subject: [PATCH 2/4] leave chunks_per_file=1 for now --- src/coffea/nanoevents/factory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coffea/nanoevents/factory.py b/src/coffea/nanoevents/factory.py index fb9a6c4b5..f429f04bd 100644 --- a/src/coffea/nanoevents/factory.py +++ b/src/coffea/nanoevents/factory.py @@ -232,7 +232,7 @@ def from_root( treepath="/Events", entry_start=None, entry_stop=None, - chunks_per_file=None, + chunks_per_file=1, runtime_cache=None, persistent_cache=None, schemaclass=NanoAODSchema, From 5527a02e94aa2685be59d6f6ca334d56c62d1a77 Mon Sep 17 00:00:00 2001 From: Lindsey Gray Date: Wed, 6 Sep 2023 16:10:38 -0500 Subject: [PATCH 3/4] use uproot._util.unset as default value to chunks_per_file to ensure correct behavior --- src/coffea/nanoevents/factory.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/coffea/nanoevents/factory.py b/src/coffea/nanoevents/factory.py index f429f04bd..f1c8ebb64 100644 --- a/src/coffea/nanoevents/factory.py +++ b/src/coffea/nanoevents/factory.py @@ -232,7 +232,7 @@ def from_root( treepath="/Events", entry_start=None, entry_stop=None, - chunks_per_file=1, + chunks_per_file=uproot._util.unset, runtime_cache=None, persistent_cache=None, schemaclass=NanoAODSchema, @@ -327,17 +327,7 @@ def from_root( filter_branch=_remove_not_interpretable, steps_per_file=chunks_per_file, **uproot_options, - ) - elif chunks_per_file is None: - opener = partial( - uproot.dask, - file, - full_paths=True, - open_files=False, - ak_add_doc=True, - filter_branch=_remove_not_interpretable, - **uproot_options, - ) + ) else: opener = partial( uproot.dask, From 130a90342912311bfa2379c1aeaa4a064cb9817e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 6 Sep 2023 21:11:24 +0000 Subject: [PATCH 4/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/coffea/nanoevents/factory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coffea/nanoevents/factory.py b/src/coffea/nanoevents/factory.py index f1c8ebb64..58dd55ad5 100644 --- a/src/coffea/nanoevents/factory.py +++ b/src/coffea/nanoevents/factory.py @@ -327,7 +327,7 @@ def from_root( filter_branch=_remove_not_interpretable, steps_per_file=chunks_per_file, **uproot_options, - ) + ) else: opener = partial( uproot.dask,