Change all instances of JobID to DriverID. (#4431)

This commit is contained in:
justinwyang
2019-04-22 16:28:09 -07:00
committed by Robert Nishihara
parent 06c768823c
commit 8dfc833a8b
21 changed files with 319 additions and 322 deletions
+20 -19
View File
@@ -840,19 +840,19 @@ class GlobalState(object):
return dict(total_available_resources)
def _error_messages(self, job_id):
"""Get the error messages for a specific job.
def _error_messages(self, driver_id):
"""Get the error messages for a specific driver.
Args:
job_id: The ID of the job to get the errors for.
driver_id: The ID of the driver to get the errors for.
Returns:
A list of the error messages for this job.
A list of the error messages for this driver.
"""
assert isinstance(job_id, ray.DriverID)
assert isinstance(driver_id, ray.DriverID)
message = self.redis_client.execute_command(
"RAY.TABLE_LOOKUP", ray.gcs_utils.TablePrefix.ERROR_INFO, "",
job_id.binary())
driver_id.binary())
# If there are no errors, return early.
if message is None:
@@ -864,7 +864,7 @@ class GlobalState(object):
for i in range(gcs_entries.EntriesLength()):
error_data = ray.gcs_utils.ErrorTableData.GetRootAsErrorTableData(
gcs_entries.Entries(i), 0)
assert job_id.binary() == error_data.JobId()
assert driver_id.binary() == error_data.DriverId()
error_message = {
"type": decode(error_data.Type()),
"message": decode(error_data.ErrorMessage()),
@@ -873,31 +873,32 @@ class GlobalState(object):
error_messages.append(error_message)
return error_messages
def error_messages(self, job_id=None):
"""Get the error messages for all jobs or a specific job.
def error_messages(self, driver_id=None):
"""Get the error messages for all drivers or a specific driver.
Args:
job_id: The specific job to get the errors for. If this is None,
then this method retrieves the errors for all jobs.
driver_id: The specific driver to get the errors for. If this is
None, then this method retrieves the errors for all drivers.
Returns:
A dictionary mapping job ID to a list of the error messages for
that job.
A dictionary mapping driver ID to a list of the error messages for
that driver.
"""
if job_id is not None:
assert isinstance(job_id, ray.DriverID)
return self._error_messages(job_id)
if driver_id is not None:
assert isinstance(driver_id, ray.DriverID)
return self._error_messages(driver_id)
error_table_keys = self.redis_client.keys(
ray.gcs_utils.TablePrefix_ERROR_INFO_string + "*")
job_ids = [
driver_ids = [
key[len(ray.gcs_utils.TablePrefix_ERROR_INFO_string):]
for key in error_table_keys
]
return {
binary_to_hex(job_id): self._error_messages(ray.DriverID(job_id))
for job_id in job_ids
binary_to_hex(driver_id): self._error_messages(
ray.DriverID(driver_id))
for driver_id in driver_ids
}
def actor_checkpoint_info(self, actor_id):
+1 -1
View File
@@ -76,7 +76,7 @@ def construct_error_message(driver_id, error_type, message, timestamp):
message_offset = builder.CreateString(message)
ray.core.generated.ErrorTableData.ErrorTableDataStart(builder)
ray.core.generated.ErrorTableData.ErrorTableDataAddJobId(
ray.core.generated.ErrorTableData.ErrorTableDataAddDriverId(
builder, driver_offset)
ray.core.generated.ErrorTableData.ErrorTableDataAddType(
builder, error_type_offset)
-16
View File
@@ -32,67 +32,51 @@ cdef extern from "ray/id.h" namespace "ray" nogil:
@staticmethod
CActorCheckpointID from_binary(const c_string &binary)
cdef cppclass CActorClassID "ray::ActorClassID"(CUniqueID):
@staticmethod
CActorClassID from_binary(const c_string &binary)
cdef cppclass CActorID "ray::ActorID"(CUniqueID):
@staticmethod
CActorID from_binary(const c_string &binary)
cdef cppclass CActorHandleID "ray::ActorHandleID"(CUniqueID):
@staticmethod
CActorHandleID from_binary(const c_string &binary)
cdef cppclass CClientID "ray::ClientID"(CUniqueID):
@staticmethod
CClientID from_binary(const c_string &binary)
cdef cppclass CConfigID "ray::ConfigID"(CUniqueID):
@staticmethod
CConfigID from_binary(const c_string &binary)
cdef cppclass CFunctionID "ray::FunctionID"(CUniqueID):
@staticmethod
CFunctionID from_binary(const c_string &binary)
cdef cppclass CDriverID "ray::DriverID"(CUniqueID):
@staticmethod
CDriverID from_binary(const c_string &binary)
cdef cppclass CJobID "ray::JobID"(CUniqueID):
@staticmethod
CJobID from_binary(const c_string &binary)
cdef cppclass CTaskID "ray::TaskID"(CUniqueID):
@staticmethod
CTaskID from_binary(const c_string &binary)
cdef cppclass CObjectID" ray::ObjectID"(CUniqueID):
@staticmethod
CObjectID from_binary(const c_string &binary)
cdef cppclass CWorkerID "ray::WorkerID"(CUniqueID):
@staticmethod
-1
View File
@@ -19,7 +19,6 @@ from ray.includes.unique_ids cimport (
CConfigID,
CDriverID,
CFunctionID,
CJobID,
CObjectID,
CTaskID,
CUniqueID,
+7 -6
View File
@@ -1142,8 +1142,8 @@ def error_info():
"""Return information about failed tasks."""
worker = global_worker
worker.check_connected()
return (global_state.error_messages(job_id=worker.task_driver_id) +
global_state.error_messages(job_id=DriverID.nil()))
return (global_state.error_messages(driver_id=worker.task_driver_id) +
global_state.error_messages(driver_id=DriverID.nil()))
def _initialize_serialization(driver_id, worker=global_worker):
@@ -1288,8 +1288,9 @@ def init(redis_address=None,
node_ip_address (str): The IP address of the node that we are on.
object_id_seed (int): Used to seed the deterministic generation of
object IDs. The same value can be used across multiple runs of the
same job in order to generate the object IDs in a consistent
manner. However, the same ID should not be used for different jobs.
same driver in order to generate the object IDs in a consistent
manner. However, the same ID should not be used for different
drivers.
local_mode (bool): True if the code should be executed serially
without Ray. This is useful for debugging.
ignore_reinit_error: True if we should suppress errors from calling
@@ -1663,8 +1664,8 @@ def listen_error_messages_raylet(worker, task_error_queue, threads_stopped):
assert gcs_entry.EntriesLength() == 1
error_data = ray.gcs_utils.ErrorTableData.GetRootAsErrorTableData(
gcs_entry.Entries(0), 0)
job_id = error_data.JobId()
if job_id not in [
driver_id = error_data.DriverId()
if driver_id not in [
worker.task_driver_id.binary(),
DriverID.nil().binary()
]: