Skip to content

Commit

Permalink
Make split_every configurable (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasdavis authored Feb 23, 2023
1 parent 3596de5 commit 55a9a11
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,4 @@ ignore = "D105"

[tool.ruff]
ignore = ["E501"]
per-file-ignores = {"__init__.py" = ["E402", "F401"]}
2 changes: 1 addition & 1 deletion src/dask_histogram/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Histogramming with Dask collections."""
from dask_histogram import config # isort:skip; load dask-histogram config

import boost_histogram.axis as _axis
import boost_histogram.storage as _storage
Expand Down
12 changes: 12 additions & 0 deletions src/dask_histogram/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import os

import dask.config
import yaml

config = dask.config.config

fn = os.path.join(os.path.dirname(__file__), "histogram.yaml")
with open(fn) as f:
defaults = yaml.safe_load(f)

dask.config.update_defaults(defaults)
2 changes: 1 addition & 1 deletion src/dask_histogram/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ def _reduction(
from dask.bag.core import empty_safe_aggregate

if split_every is None:
split_every = 4
split_every = dask.config.get("histogram.aggregation.split_every", 8)
if split_every is False:
split_every = ph.npartitions

Expand Down
10 changes: 10 additions & 0 deletions src/dask_histogram/histogram.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
histogram:

# Aggregation specific configuration table
aggregation:

# When converting from a partitioned histogram to a single
# aggregated histogram this parameter controls how the tree
# reduction is handled; this number of nodes will be combined at a
# time as a new dask task.
split_every: 8

0 comments on commit 55a9a11

Please sign in to comment.