-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
implement normalize_token #3378
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
Comments
How should this be implemented? |
https://docs.dask.org/en/latest/custom-collections.html#implementing-deterministic-hashing @normalize_token.register(Dataset)
def tokenize_dataset(ds):
return Dataset, ds._variables, ds._coord_names, ds._attrs
@normalize_token.register(DataArray)
def tokenize_dataarray(da):
return DataArray, ds._variable, ds._coords, ds._name
# Note: the @singledispatch for IndexVariable must be defined before the one for Variable
@normalize_token.register(IndexVariable)
def tokenize_indexvariable(v):
# Don't waste time converting pd.Index to np.ndarray
return IndexVariable, v._dims, v._data.array, v._attrs
@normalize_token.register(Variable)
def tokenize_variable(v):
# Note: it's v.data, not v._data, in order to cope with the
# wrappers around NetCDF and the like
return Variable, v._dims, v.data, v._attrs You'll need to write a dummy normalize_token for when dask is not installed. Unit tests:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See #3276 (comment)
The text was updated successfully, but these errors were encountered: