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

Backport PR #3048: (feat): raising errors where backed is not supported #3072

Merge branch '1.10.x' into auto-backport-of-pr-3048-on-1.10.x

0948c80
Select commit
Loading
Failed to load commit list.
Merged

Backport PR #3048: (feat): raising errors where backed is not supported #3072

Merge branch '1.10.x' into auto-backport-of-pr-3048-on-1.10.x
0948c80
Select commit
Loading
Failed to load commit list.
Azure Pipelines / scverse.scanpy failed Jun 3, 2024 in 21m 37s

Build #20240603.19 had test failures

Details

Tests

  • Failed: 2 (0.02%)
  • Passed: 8,136 (92.82%)
  • Other: 627 (7.15%)
  • Total: 8,765
Code coverage

  • 9489 of 12540 line covered (75.67%)

Annotations

Check failure on line 2678 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / scverse.scanpy

Build log #L2678

Bash exited with code '1'.

Check failure on line 1 in scanpy/tests/test_utils.py::test_is_constant_dask[csr_matrix-0]

See this annotation in the file changed.

@azure-pipelines azure-pipelines / scverse.scanpy

scanpy/tests/test_utils.py::test_is_constant_dask[csr_matrix-0]

TypeError: int() argument must be a string, a bytes-like object or a number, not 'csr_matrix'

The above exception was the direct cause of the following exception:

axis = 0, expected = [True, True, False, False]
block_type = <class 'scipy.sparse._csr.csr_matrix'>

    @needs.dask
    @pytest.mark.parametrize(
        ("axis", "expected"),
        [
            pytest.param(None, False, id="None"),
            pytest.param(0, [True, True, False, False], id="0"),
            pytest.param(1, [False, False, True, True, False, True], id="1"),
        ],
    )
    @pytest.mark.parametrize("block_type", [np.array, csr_matrix])
    def test_is_constant_dask(axis, expected, block_type):
        import dask.array as da
    
        if (axis is None) and block_type is csr_matrix:
            pytest.skip("Dask has weak support for scipy sparse matrices")
    
        x_data = [
            [0, 0, 1, 1],
            [0, 0, 1, 1],
            [0, 0, 0, 0],
            [0, 0, 0, 0],
            [0, 0, 1, 0],
            [0, 0, 0, 0],
        ]
        x = da.from_array(np.array(x_data), chunks=2).map_blocks(block_type)
>       result = is_constant(x, axis=axis).compute()

scanpy/tests/test_utils.py:243: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/base.py:315: in compute
    (result,) = compute(self, traverse=False, **kwargs)
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/base.py:600: in compute
    results = schedule(dsk, keys, **kwargs)
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/threaded.py:89: in get
    results = get_async(
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/local.py:511: in get_async
    raise_exception(exc, tb)
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/local.py:319: in reraise
    raise exc
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/local.py:224: in execute_task
    result = _execute_task(task, data)
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/core.py:119: in _execute_task
    return func(*(_execute_task(a, cache) for a in args))
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/core.py:119: in <genexpr>
    return func(*(_execute_task(a, cache) for a in args))
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/core.py:119: in _execute_task
    return func(*(_execute_task(a, cache) for a in args))
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/array/core.py:5302: in concatenate_axes
    return concatenate3(transposelist(arrays, axes, extradims=extradims))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

arrays = [[<2x2 sparse matrix of type '<class 'numpy.int64'>'
	with 4 stored elements in Compressed Sparse Row format>], [<2x2 ...ormat>], [<2x2 sparse matrix of type '<class 'numpy.int64'>'
	with 1 stored elements in Compressed Sparse Row format>]]

    def concatenate3(arrays):
        """Recursive np.concatenate
    
        Input should be a nested list of numpy arrays arranged in the order they
        should appear in the array itself.  Each array should have the same number
        of dimensions as the desired output and the nesting of the lists.
    
        >>> x = np.array([[1, 2]])
        >>> concatenate3([[x, x, x], [x, x, x]])
        array([[1, 2, 1, 2, 1, 2],
               [1, 2, 1, 2, 1, 2]])
    
        >>> concatenate3([[x, x], [x, x], [x, x]])
        array([[1, 2, 1, 2],
               [1, 2, 1, 2],
               [1, 2, 1, 2]])
        """
        # We need this as __array_function__ may not exist on older NumPy versions.
        # And to reduce verbosity.
        NDARRAY_ARRAY_FUNCTION = getattr(np.ndarray, "__array_function__", None)
    
        arrays = con
Raw output
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/array/core.py:5291: ValueError: setting an array element with a sequence.

Check failure on line 1 in scanpy/tests/test_utils.py::test_is_constant_dask[csr_matrix-1]

See this annotation in the file changed.

@azure-pipelines azure-pipelines / scverse.scanpy

scanpy/tests/test_utils.py::test_is_constant_dask[csr_matrix-1]

TypeError: int() argument must be a string, a bytes-like object or a number, not 'csr_matrix'

The above exception was the direct cause of the following exception:

axis = 1, expected = [False, False, True, True, False, True]
block_type = <class 'scipy.sparse._csr.csr_matrix'>

    @needs.dask
    @pytest.mark.parametrize(
        ("axis", "expected"),
        [
            pytest.param(None, False, id="None"),
            pytest.param(0, [True, True, False, False], id="0"),
            pytest.param(1, [False, False, True, True, False, True], id="1"),
        ],
    )
    @pytest.mark.parametrize("block_type", [np.array, csr_matrix])
    def test_is_constant_dask(axis, expected, block_type):
        import dask.array as da
    
        if (axis is None) and block_type is csr_matrix:
            pytest.skip("Dask has weak support for scipy sparse matrices")
    
        x_data = [
            [0, 0, 1, 1],
            [0, 0, 1, 1],
            [0, 0, 0, 0],
            [0, 0, 0, 0],
            [0, 0, 1, 0],
            [0, 0, 0, 0],
        ]
        x = da.from_array(np.array(x_data), chunks=2).map_blocks(block_type)
>       result = is_constant(x, axis=axis).compute()

scanpy/tests/test_utils.py:243: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/base.py:315: in compute
    (result,) = compute(self, traverse=False, **kwargs)
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/base.py:600: in compute
    results = schedule(dsk, keys, **kwargs)
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/threaded.py:89: in get
    results = get_async(
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/local.py:511: in get_async
    raise_exception(exc, tb)
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/local.py:319: in reraise
    raise exc
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/local.py:224: in execute_task
    result = _execute_task(task, data)
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/core.py:119: in _execute_task
    return func(*(_execute_task(a, cache) for a in args))
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/core.py:119: in <genexpr>
    return func(*(_execute_task(a, cache) for a in args))
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/core.py:119: in _execute_task
    return func(*(_execute_task(a, cache) for a in args))
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/array/core.py:5302: in concatenate_axes
    return concatenate3(transposelist(arrays, axes, extradims=extradims))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

arrays = [[<2x2 sparse matrix of type '<class 'numpy.int64'>'
	with 0 stored elements in Compressed Sparse Row format>, <2x2 sparse matrix of type '<class 'numpy.int64'>'
	with 4 stored elements in Compressed Sparse Row format>]]

    def concatenate3(arrays):
        """Recursive np.concatenate
    
        Input should be a nested list of numpy arrays arranged in the order they
        should appear in the array itself.  Each array should have the same number
        of dimensions as the desired output and the nesting of the lists.
    
        >>> x = np.array([[1, 2]])
        >>> concatenate3([[x, x, x], [x, x, x]])
        array([[1, 2, 1, 2, 1, 2],
               [1, 2, 1, 2, 1, 2]])
    
        >>> concatenate3([[x, x], [x, x], [x, x]])
        array([[1, 2, 1, 2],
               [1, 2, 1, 2],
               [1, 2, 1, 2]])
        """
        # We need this as __array_function__ may not exist on older NumPy versions.
        # And to reduce verbosity.
        NDARRAY_ARRAY_FUNCTION = getattr(np.ndarray, "__array_function__", None)
    
        arrays = concrete(arrays)
Raw output
/opt/hostedtoolcache/Python/3.9.19/x64/lib/python3.9/site-packages/dask/array/core.py:5291: ValueError: setting an array element with a sequence.