Notify driver when a worker dies while executing a task. (#419)

* Notify driver when a worker dies while executing a task.

* Fix linting.

* Don't push error when local scheduler is cleaning up.
This commit is contained in:
Robert Nishihara
2017-04-06 00:02:39 -07:00
committed by Philipp Moritz
parent 85b373a4be
commit fa363a5a3a
3 changed files with 35 additions and 2 deletions
+21
View File
@@ -353,5 +353,26 @@ class ActorTest(unittest.TestCase):
ray.worker.cleanup()
class WorkerDeath(unittest.TestCase):
def testWorkerDying(self):
ray.init(num_workers=0, driver_mode=ray.SILENT_MODE)
# Define a remote function that will kill the worker that runs it.
@ray.remote
def f():
eval("exit()")
f.remote()
wait_for_errors(b"worker_died", 1)
self.assertEqual(len(ray.error_info()), 1)
self.assertIn("A worker died or was killed while executing a task.",
ray.error_info()[0][b"message"].decode("ascii"))
ray.worker.cleanup()
if __name__ == "__main__":
unittest.main(verbosity=2)