`dask.compute` can't handle some `dataclass`es as input
- Dominant language
- Python
- Stars
- 13.9k
- Forks
- 2k
- PR merge metrics
- No merged PRs in 30d
Description
As mentioned in https://github.com/dask/dask/pull/9345#discussion_r940533164, `dask.compute` can't handle some `dataclass`es as inputs due to a limitation in `dask.base.unpack_collections`. In #9345, we added support or error handling for these types of `dataclass`es, but the implementation of `dask.base.unpack_collections` makes it non-trivial to apply those changes. Specifically, we experience issues as soon as we encounter a custom `__init__`, `__post_init__`, fields with `init=False` or `InitVar`s in the `dataclass`. #9363 would provide an alternative route to solving this issue.
```python3
import dask
from dataclasses import dataclass
@dataclass
class MyDataClass:
arg1: int
def __init__(self, arg):
self.arg1 = arg
dask.compute([dask.delayed(1), MyDataClass(1)])
```
Contributor guide
Assessment
This issue has not been assessed yet.