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

dask dev upstream test failiures #4502

Closed
mathause opened this issue Oct 11, 2020 · 1 comment
Closed

dask dev upstream test failiures #4502

mathause opened this issue Oct 11, 2020 · 1 comment

Comments

@mathause
Copy link
Collaborator

mathause commented Oct 11, 2020

Our upstream tests fail due to a change in dask. The likely culprit is dask/dask#6680 - dask.array.zeros_like does now take the meta keyword and thus it tries to coerce str to a bool which fails (and it didn't do before). The following should trigger the error:

import xarray as xr
import dask

da = xr.DataArray(dask.array.array(""))
xr.zeros_like(da, dtype=bool)

Note that zeros_like is called in isnull (which triggered the test failures):

elif issubclass(scalar_type, (np.bool_, np.integer, np.character, np.void)):
# these types cannot represent missing values
return zeros_like(data, dtype=bool)

What happened:

/home/vsts/work/1/s/xarray/tests/test_duck_array_ops.py:499: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/vsts/work/1/s/xarray/testing.py:139: in compat_variable
    return a.dims == b.dims and (a._data is b._data or equiv(a.data, b.data))
/home/vsts/work/1/s/xarray/testing.py:36: in _data_allclose_or_equiv
    return duck_array_ops.array_equiv(arr1, arr2)
/home/vsts/work/1/s/xarray/core/duck_array_ops.py:246: in array_equiv
    flag_array = (arr1 == arr2) | (isnull(arr1) & isnull(arr2))
/home/vsts/work/1/s/xarray/core/duck_array_ops.py:104: in isnull
    return zeros_like(data, dtype=bool)
/home/vsts/work/1/s/xarray/core/duck_array_ops.py:56: in f
    return wrapped(*args, **kwargs)
/usr/share/miniconda/envs/xarray-tests/lib/python3.8/site-packages/dask/array/creation.py:174: in zeros_like
    return zeros(
/usr/share/miniconda/envs/xarray-tests/lib/python3.8/site-packages/dask/array/wrap.py:78: in wrap_func_shape_as_first_arg
    return Array(dsk, name, chunks, dtype=dtype, meta=kwargs.get("meta", None))
/usr/share/miniconda/envs/xarray-tests/lib/python3.8/site-packages/dask/array/core.py:1083: in __new__
    meta = meta_from_array(meta, dtype=dtype)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

x = array('', dtype='<U1'), ndim = 0, dtype = dtype('bool')

    def meta_from_array(x, ndim=None, dtype=None):
        """Normalize an array to appropriate meta object
    
        Parameters
        ----------
        x: array-like, callable
            Either an object that looks sufficiently like a Numpy array,
            or a callable that accepts shape and dtype keywords
    
        if dtype and meta.dtype != dtype:
>           meta = meta.astype(dtype)
E           ValueError: invalid literal for int() with base 10: ''
@mathause mathause changed the title dask upstream issue test failiures dask dev upstream test failiures Oct 11, 2020
@mathause
Copy link
Collaborator Author

This was fixed upstream. Thanks @pentschev!

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

Successfully merging a pull request may close this issue.

1 participant