Skip to content

Handle errant workers when another worker has data #1853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions distributed/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2038,11 +2038,12 @@ def handle_missing_data(self, key=None, errant_worker=None, **kwargs):
ts = self.tasks.get(key)
if ts is None or not ts.who_has:
return
ws = self.workers[errant_worker]
if ws in ts.who_has:
ts.who_has.remove(ws)
ws.has_what.remove(ts)
ws.nbytes -= ts.get_nbytes()
if errant_worker in self.workers:
ws = self.workers[errant_worker]
if ws in ts.who_has:
ts.who_has.remove(ws)
ws.has_what.remove(ts)
ws.nbytes -= ts.get_nbytes()
if not ts.who_has:
if ts.run_spec:
self.transitions({key: 'released'})
Expand Down Expand Up @@ -3320,9 +3321,9 @@ def transition_processing_memory(self, key, nbytes=None, type=None,
return {key: 'released'}

if ws is not ts.processing_on: # someone else has this task
logger.warning("Unexpected worker completed task, likely due to"
" work stealing. Expected: %s, Got: %s, Key: %s",
ts.processing_on, ws, key)
logger.info("Unexpected worker completed task, likely due to"
" work stealing. Expected: %s, Got: %s, Key: %s",
ts.processing_on, ws, key)
return {}

if startstops:
Expand Down
17 changes: 17 additions & 0 deletions distributed/tests/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1200,3 +1200,20 @@ def test_retries(c, s, a, b):
with pytest.raises(ZeroDivisionError) as exc_info:
res = yield future
exc_info.match("one")


@pytest.mark.xfail(reason="second worker also errant for some reason")
@gen_cluster(client=True, ncores=[('127.0.0.1', 1)] * 3, timeout=5)
def test_mising_data_errant_worker(c, s, w1, w2, w3):
with set_config({'connect-timeout': '1s'}):
np = pytest.importorskip('numpy')

x = c.submit(np.random.random, 10000000, workers=w1.address)
yield wait(x)
yield c.replicate(x, workers=[w1.address, w2.address])

y = c.submit(len, x, workers=w3.address)
while not w3.tasks:
yield gen.sleep(0.001)
w1._close()
yield wait(y)
3 changes: 2 additions & 1 deletion distributed/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,8 @@ def get_data(self, comm, keys=None, who=None):
try:
compressed = yield comm.write(msg)
except EnvironmentError:
logger.exception('failed during get data', exc_info=True)
logger.exception('failed during get data with %s -> %s',
self.address, who, exc_info=True)
comm.abort()
raise
stop = time()
Expand Down