Recreate actors when local schedulers die. (#804)

* Reconstruct actor state when local schedulers fail.

* Simplify construction of arguments to pass into default_worker.py from local scheduler.

* Remove deprecated ray.actor.

* Simplify actor reconstruction method.

* Fix linting.

* Small fixes.
This commit is contained in:
Robert Nishihara
2017-08-02 18:02:52 -07:00
committed by Philipp Moritz
parent 37282330c0
commit cb84972f6b
13 changed files with 441 additions and 79 deletions
@@ -14,6 +14,7 @@ typedef void (*actor_notification_table_subscribe_callback)(
ActorID actor_id,
WorkerID driver_id,
DBClientID local_scheduler_id,
bool reconstruct,
void *user_context);
/**
+24 -7
View File
@@ -1523,16 +1523,33 @@ void redis_actor_notification_table_subscribe_callback(redisAsyncContext *c,
ActorID actor_id;
WorkerID driver_id;
DBClientID local_scheduler_id;
CHECK(sizeof(actor_id) + sizeof(driver_id) + sizeof(local_scheduler_id) ==
bool reconstruct;
CHECK(sizeof(actor_id) + sizeof(driver_id) + sizeof(local_scheduler_id) +
1 ==
payload->len);
memcpy(&actor_id, payload->str, sizeof(actor_id));
memcpy(&driver_id, payload->str + sizeof(actor_id), sizeof(driver_id));
memcpy(&local_scheduler_id,
payload->str + sizeof(actor_id) + sizeof(driver_id),
sizeof(local_scheduler_id));
char *current_ptr = payload->str;
/* Parse the actor ID. */
memcpy(&actor_id, current_ptr, sizeof(actor_id));
current_ptr += sizeof(actor_id);
/* Parse the driver ID. */
memcpy(&driver_id, current_ptr, sizeof(driver_id));
current_ptr += sizeof(driver_id);
/* Parse the local scheduler ID. */
memcpy(&local_scheduler_id, current_ptr, sizeof(local_scheduler_id));
current_ptr += sizeof(local_scheduler_id);
/* Parse the reconstruct bit. */
if (*current_ptr == '1') {
reconstruct = true;
} else if (*current_ptr == '0') {
reconstruct = false;
} else {
LOG_FATAL("This code should be unreachable.");
}
current_ptr += 1;
if (data->subscribe_callback) {
data->subscribe_callback(actor_id, driver_id, local_scheduler_id,
data->subscribe_context);
reconstruct, data->subscribe_context);
}
} else if (strcmp(message_type->str, "subscribe") == 0) {
/* The reply for the initial SUBSCRIBE command. */