Skip to content
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

[fix]Solve circular import #151

Merged
merged 2 commits into from
Sep 19, 2024
Merged

[fix]Solve circular import #151

merged 2 commits into from
Sep 19, 2024

Conversation

martindurant
Copy link
Collaborator

Fixes #149

This is a more complex way of solving things, by splitting this into two packages.

@martindurant martindurant changed the title Solve circular import [fix]Solve circular import Sep 17, 2024
@lgray
Copy link
Collaborator

lgray commented Sep 19, 2024

Hmmm still brings up the same problem :-/

@martindurant
Copy link
Collaborator Author

These fail because they use the released version of dask-awkward

@lgray
Copy link
Collaborator

lgray commented Sep 19, 2024

indeed - I should look at these things after coffee.

Otherwise lgtm.

@martindurant martindurant merged commit d90219d into main Sep 19, 2024
8 of 19 checks passed
@martindurant martindurant deleted the sizeof branch September 19, 2024 17:09
@martindurant
Copy link
Collaborator Author

OK, release is out on pypi and things are importable again.

@lgray
Copy link
Collaborator

lgray commented Sep 19, 2024

Something's gone off with with the tests and optimization. One of the awkward histogram filling tests should be using the optimization function from dask awkward as opposed to dask histogram and now it has stopped doing that.

@martindurant
Copy link
Collaborator Author

I don't understand. This is a new issue? No code changed here...

@lgray
Copy link
Collaborator

lgray commented Sep 19, 2024

Yeah I am not sure, but tests in main are failing.

I'll check on my laptop in a bit.

@lgray
Copy link
Collaborator

lgray commented Sep 19, 2024

The tests even passed in your PR so that's rather strange!

@martindurant
Copy link
Collaborator Author

https://github.com/dask-contrib/dask-histogram/actions/runs/10946251458/job/30392316434?pr=152#step:5:138 you seem to be right. I have it locally too, must have been a different commit, though.

@martindurant
Copy link
Collaborator Author

OK, so the case is: dask is no longer auto-importing dask-awkward as before. If you import dask-awkward before running the graph, it is right.
This was the point! dask-histogram uses the existence of "awkward" in the dask config to see whether dak has been imported, and then sets the optimise method. We can use importlib instead.

@martindurant
Copy link
Collaborator Author

--- a/src/dask_histogram/core.py
+++ b/src/dask_histogram/core.py
@@ -524,7 +524,9 @@ def _get_optimization_function():
     # running this optimization even in cases where it's unncessary
     # because if no AwkwardInputLayers from dask-awkward are
     # detected then the original graph is returned unchanged.
-    if dask.config.get("awkward", default=False):
+    import importlib.metadata
+
+    if importlib.metadata.distribution("dask_awkward"):
         from dask_awkward.lib.optimize import all_optimizations

OK?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot import dask_histogram which causes failures downstream (hist.dask etc) with the newest dask 2024.9.0
2 participants