-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unserializable histogram generated if computed without fill call #153
Comments
Hm, the computed object shouldn't have any ties to dask at all. Note that |
The following fixes it, but I would like to figure out why the attribute is there in the first place --- a/src/dask_histogram/boost.py
+++ b/src/dask_histogram/boost.py
@@ -137,7 +137,12 @@ class Histogram(bh.Histogram, DaskMethodsMixin, family=dask_histogram):
return self.dask_name
def __dask_postcompute__(self) -> Any:
- return lambda x: self._in_memory_type(first(x)), ()
+ def f(x):
+ out = self._in_memory_type(first(x))
+ if hasattr(out, "_dask"):
+ del out._dask
+ return out
+ return f, ()
def __dask_postpersist__(self) -> Any: |
I have not yet come up with any better solution, so if you would check what I put above, I would appreciate it. |
Just confirmed that this indeed allows empty histograms to be pickled/unpickled as usual. Thanks! |
OK, let's make that PR for now, as certainly it doesn't seem to have a downside. |
Originally posted here: scikit-hep/hist#586
And I found that this issue can be replicated entirely upstream using just
dask-histogram
Without a fill call, the resulting histogram will have dangling a
self._dask
field that breaks serialization.The text was updated successfully, but these errors were encountered: