Skip to content

Commit

Permalink
Ensure the client is quiet if scheduler leaves (dask#1806)
Browse files Browse the repository at this point in the history
We still print out a basic warning, but previously we were dumping
large stack traces every few seconds.
  • Loading branch information
mrocklin authored Mar 5, 2018
1 parent 0a0c5fa commit 57599e8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion distributed/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ def _update_scheduler_info(self):
try:
self._scheduler_identity = yield self.scheduler.identity()
except EnvironmentError:
if self.status not in ('running', 'connecting'):
if self.status != 'running':
return
else:
raise
Expand Down
10 changes: 10 additions & 0 deletions distributed/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5195,5 +5195,15 @@ def test_client_doesnt_close_given_loop(loop):
assert c.submit(inc, 2).result() == 3


@gen_cluster(client=True, ncores=[])
def test_quiet_scheduler_loss(c, s):
c._periodic_callbacks['scheduler-info'].interval = 10
with captured_logger(logging.getLogger('distributed.client')) as logger:
yield s.close()
yield c._update_scheduler_info()
text = logger.getvalue()
assert "BrokenPipeError" not in text


if sys.version_info >= (3, 5):
from distributed.tests.py3_test_client import * # noqa F401
2 changes: 1 addition & 1 deletion distributed/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ def coro():
s.validate_state()
finally:
if client:
yield c._close()
yield c._close(fast=s.status == 'closed')
yield end_cluster(s, workers)
_globals.clear()
_globals.update(old_globals)
Expand Down

0 comments on commit 57599e8

Please sign in to comment.