You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the merge #8920 (and dask/dask#11477) it looks like one cannot pass empty dictionaries as arguments to functions through client.submit or client.map
Minimal Complete Verifiable Example:
importdistributedclient=distributed.Client()
defidentity(*args, **kwargs):
returnargs, kwargsclient.submit(identity, {}).result() # ValueError: Dict needs at least one argumentclient.submit(identity, x={}).result() # ValueError: Dict needs at least one argumentclient.submit(identity, x=None).result() # Fine.client.map(identity, [None], kw={"foo": {"bar": {}}}) # ValueError: Dict needs at least one argument
This patch in dask allows the above examples to complete for me:
diff --git a/dask/_task_spec.py b/dask/_task_spec.py
index 82b896b6..c67318fb 100644
--- a/dask/_task_spec.py+++ b/dask/_task_spec.py@@ -728,8 +728,6 @@ class Dict(NestedContainer):
if len(args) > 1:
raise ValueError("Dict can only take one positional argument")
kwargs = args[0]
- elif not kwargs:- raise ValueError("Dict needs at least one argument")
super().__init__(
*(Tuple(*it) for it in kwargs.items()), _dependencies=_dependencies
)
However, I am not sure if that is incorrectly relaxing an invariant that should be upheld by the Dict class (namely that it has at least one entry).
Environment:
Dask version: 2024.11.2+23.g0f3e5ff6
Python version: 3.12
The text was updated successfully, but these errors were encountered:
Describe the issue:
Since the merge #8920 (and dask/dask#11477) it looks like one cannot pass empty dictionaries as arguments to functions through
client.submit
orclient.map
Minimal Complete Verifiable Example:
This patch in dask allows the above examples to complete for me:
However, I am not sure if that is incorrectly relaxing an invariant that should be upheld by the
Dict
class (namely that it has at least one entry).Environment:
The text was updated successfully, but these errors were encountered: