Obscure error message when all copies of scattered data are lost
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 778
- Avg merge
- 2h 50m
- Merged PRs (30d)
- 3
Description
Related to #2454
In the use case of
- a cluster shared among multiple clients
- client A uses scatter()
- client B has a faulty function that triggers node death
it is exceedingly easy for client A to get random failures in his computation.
When this happens, he receives a very uninformative CancelledError.
Alternatively, the same client may have multiple independent computations running at the same time, one of which triggers node death.
# POC
```python
import os
import distributed
def seppuku(x):
print("seppuku(%s)" % x)
os.kill(os.getpid(), 9)
def submit(client, x):
print("submit")
fut = client.submit(seppuku, x, pure=False)
try:
fut.result()
except distributed.scheduler.KilledWorker:
pass
def main():
with distributed.LocalCluster(n_workers=2, threads_per_worker=1) as cluster:
with distributed.Client(cluster) as client:
submit(client, 0)
scattered = client.scatter(0, broadcast=True)
submit(client, scattered)
submit(client, scattered)
if __name__ == '__main__':
main()
```
Output:
```
submit
seppuku(0)
distributed.nanny - WARNING - Restarting worker
seppuku(0)
distributed.nanny - WARNING - Restarting worker
seppuku(0)
distributed.nanny - WARNING - Restarting worker
seppuku(0)
distributed.nanny - WARNING - Restarting worker
submit
seppuku(0)
seppuku(0)
distributed.nanny - WARNING - Restarting worker
distributed.nanny - WARNING - Restarting worker
Traceback (most recent call last):
File "/Users/crusaderky/Library/Preferences/PyCharmCE2019.2/scratches/killedworker_sync.py", line 31, in
main()
File "/Users/crusaderky/Library/Preferences/PyCharmCE2019.2/scratches/killedworker_sync.py", line 27, in main
submit(client, scattered)
File "/Users/crusaderky/Library/Preferences/PyCharmCE2019.2/scratches/killedworker_sync.py", line 17, in submit
fut.result()
File "/Users/crusaderky/miniconda3/envs/commrisk/lib/python3.7/site-packages/distributed/client.py", line 224, in result
raise result
concurrent.futures._base.CancelledError: seppuku-fc16b541-1163-40ac-b4b2-339ff009d49a
```
# Suggested behaviour
- the error message could be spelled out more clearly, e.g. "all copies of scattered data have been lost"
- scatter should accept a "minum redundancy" setting. When the number of copies across the grid of a piece of scattered data fall below the minum redundancy threshold, the workers hosting the surviving copies should not accept any more tasks until the data has been distributed to more workers. This should particularly hold true for tasks that have already caused a node death and have been flagged as suspicious.
# Workaround
Instead of
```python
scattered = client.scatter(0, broadcast=True)
```
Use
```python
def dummy(x):
return x
scattered = client.submit(dummy, 0)
```
Output:
```
submit
seppuku(0)
distributed.nanny - WARNING - Restarting worker
seppuku(0)
distributed.nanny - WARNING - Restarting worker
seppuku(0)
distributed.nanny - WARNING - Restarting worker
seppuku(0)
distributed.nanny - WARNING - Restarting worker
submit
dummy(0)
seppuku(0)
distributed.nanny - WARNING - Restarting worker
dummy(0)
seppuku(0)
distributed.nanny - WARNING - Restarting worker
dummy(0)
seppuku(0)
distributed.nanny - WARNING - Restarting worker
dummy(0)
seppuku(0)
submit
distributed.nanny - WARNING - Restarting worker
dummy(0)
seppuku(0)
distributed.nanny - WARNING - Restarting worker
dummy(0)
seppuku(0)
distributed.nanny - WARNING - Restarting worker
dummy(0)
seppuku(0)
dummy(0)
distributed.nanny - WARNING - Restarting worker
seppuku(0)
distributed.nanny - WARNING - Restarting worker
Process finished with exit code 0
```
Contributor guide
Assessment
This issue has not been assessed yet.