Add driver ID to task spec and add driver ID to Python error handling. (#225)

* Add driver ID to task spec and add driver ID to Python error handling.

* Make constants global variables.

* Add test for error isolation.
This commit is contained in:
Robert Nishihara
2017-01-25 22:53:48 -08:00
committed by Philipp Moritz
parent 3c6686db08
commit ab8c3432f7
13 changed files with 292 additions and 108 deletions
+6 -2
View File
@@ -44,12 +44,16 @@ being caught in "lib/python/ray/workers/default_worker.py".
ray.worker.main_loop()
except Exception as e:
traceback_str = traceback.format_exc() + error_explanation
error_key = "WorkerError:{}".format(random_string())
DRIVER_ID_LENGTH = 20
# We use a driver ID of all zeros to push an error message to all drivers.
driver_id = DRIVER_ID_LENGTH * b"\x00"
error_key = b"Error:" + driver_id + b":" + random_string()
redis_host, redis_port = args.redis_address.split(":")
# For this command to work, some other client (on the same machine as
# Redis) must have run "CONFIG SET protected-mode no".
redis_client = redis.StrictRedis(host=redis_host, port=int(redis_port))
redis_client.hmset(error_key, {"message": traceback_str,
redis_client.hmset(error_key, {"type": "worker_crash",
"message": traceback_str,
"note": "This error is unexpected and should not have happened."})
redis_client.rpush("ErrorKeys", error_key)
# TODO(rkn): Note that if the worker was in the middle of executing a