Skip to content

Blockwise.clone doesn't handle (iterable) literal arguments correctly #8978

Closed

Description

@JSKenyon

What happened:
Calling dask.graph_manipulation.clone on the result of a dask.array.blockwise operation with a (iterable) literal argument results in a ValueError.

What you expected to happen:
The dask.graph_manipulation.clone operation to succeed.

Minimal Complete Verifiable Example:

import dask.array as da
from dask.graph_manipulation import clone

if __name__ == "__main__":

    x = da.ones(10)
    y = (1,)

    z = da.blockwise(lambda x, y: x + y[0], "r",
                     x, "r",
                     y, None)

    clone(z)

Anything else we need to know?:
The above produces:

TypeError: unhashable type: 'list'

I have traced the problem to:

dask/dask/blockwise.py

Lines 812 to 817 in 1ccd1a4

numblocks = {}
for k, nbv in self.numblocks.items():
if k in names:
is_leaf = False
k = clone_key(k, seed)
numblocks[k] = nbv

In the above, the conditional if k in names causes the ValueError when k is not hashable.

Environment:

  • Dask version: 2022.4.1
  • Python version: 3.8.10
  • Operating System: Ubuntu 20.04
  • Install method (conda, pip, source): pip

Activity

  1. added
    needs triage
    on Apr 25, 2022
  2. added a commit that references this issue on Apr 25, 2022
    4ebc0ab
  3. added
    bug
    and removed
    needs triage
    on Apr 27, 2022
  4. added a commit that references this issue on Apr 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    arraybug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions