0

I have the following basic code which (I thought) should set up xarray to use a LocalCluster.

from dask.distributed import Client
client = Client("tcp://127.0.0.1:46573") # this points to a LocalCluster

import xarray as xr
ds = xr.open_mfdataset('*.nc', combine='by_coords') # Uses dask to defer actually loading data

I now launch some task which also completes with no issues:

(ds.mean('time').mean('longitude')**10).compute()
  1. I noticed that the tabs for the Task graph, Workers, or Task stream (among others) in the dask-labextension for my LocalCluster remain empty. Shouldn't there be some sort of progress displayed while the computation is running?

  2. Which leads me to wonder, how do I tell xarray to explicitly use this cluster? Or is Client a singleton such that xarray only ever has one instance to use anyway?

1 Answer 1

1

When you create a Dask Client it automatically registers itself as the default way to run Dask computations.

You can check to see if an object is a Dask collection with the dask.is_dask_collection function. As you say, I believe that xr.open_mfdataset uses Dask by default, but this would be a good way to check.

As to why you're not seeing anything on the dashboard, I unfortunately don't know enough about your situation to be able to help you there.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! As for the dashboard (where I see some things, just not everything I'd thought I would see), I will try to narrow it down before asking for further help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.