added monkeypatch to resolve known dask bug

This commit is contained in:
Ari Brown 2023-10-10 20:21:56 -04:00
parent 495d786103
commit 27a1d75bb3

View file

@ -113,3 +113,22 @@ class Cluster:
return security_group_id
# Monkeypatch to address a known bug in Dask
# https://github.com/dask/distributed/issues/4305
from dask.distributed import Future
import sys
def monkeypatch_del(self):
try:
self.release()
except AttributeError:
# Occasionally we see this error when shutting down the client
# https://github.com/dask/distributed/issues/4305
if not sys.is_finalizing():
raise
#pass
except RuntimeError: # closed event loop
pass
Future.__del__ = monkeypatch_del