-
-
Notifications
You must be signed in to change notification settings - Fork 747
Closed
Description
Using isinstance on computation results from Dask.Distributed shows unexpected behavior under Python 2.7:
import dask
from dask.distributed import Client
class MyObject(object):
pass
print("Expected behavior:")
x = MyObject()
print(x, type(x), isinstance(x, MyObject))
print("Behavior with debugging scheduler:")
dask.config.set(scheduler="single-threaded")
x_delayed = dask.delayed(lambda: MyObject())()
x = dask.compute(x_delayed)[0]
print(x, type(x), isinstance(x, MyObject))
print("Behavior with distributed scheduler:")
client = Client()
x_delayed = dask.delayed(lambda: MyObject())()
x = dask.compute(x_delayed)[0]
print(x, type(x), isinstance(x, MyObject))Output:
Expected behavior:
(<__main__.MyObject object at 0x7fa9afe49d50>, <class '__main__.MyObject'>, True)
Behavior with debugging scheduler:
(<__main__.MyObject object at 0x7fa9afe49f10>, <class '__main__.MyObject'>, True)
Behavior with distributed scheduler:
(<__main__.MyObject object at 0x7fa9a6ef4790>, <class '__main__.MyObject'>, False)
In this simple example isinstance(x, MyObject) seems to be always False with distributed. In a more complex example the results are even non-deterministic.
The problem does not exist with the non-distributed schedulers or when using Python 3.5.2.
Versions:
- Python 2.7.12
- dask==0.19.0
- distributed==1.23.0
- tornado==5.1
Metadata
Metadata
Assignees
Labels
No labels