diff --git a/python/ray/exceptions.py b/python/ray/exceptions.py index 1e49c0ae337d..f4aba5a74c42 100644 --- a/python/ray/exceptions.py +++ b/python/ray/exceptions.py @@ -341,7 +341,7 @@ class ActorDiedError(RayActorError): BASE_ERROR_MSG = "The actor died unexpectedly before finishing this task." - def __init__(self, cause: Union[RayTaskError, ActorDiedErrorContext, NodeDeathInfo] = None): + def __init__(self, cause: Union[RayTaskError, ActorDiedErrorContext] = None): """ Construct a RayActorError by building the arguments. """ @@ -362,12 +362,6 @@ def __init__(self, cause: Union[RayTaskError, ActorDiedErrorContext, NodeDeathIn " raised in its creation task, " f"{cause.__str__()}" ) - elif isinstance(cause, NodeDeathInfo): - error_msg = ( - "The actor died because the node was terminated." - ) - # FIXME: we don't have actor_id info - # actor_id = ActorID(cause.actor_id).hex() else: # Inidicating system-level actor failures. assert isinstance(cause, ActorDiedErrorContext) @@ -388,7 +382,11 @@ def __init__(self, cause: Union[RayTaskError, ActorDiedErrorContext, NodeDeathIn error_msg_lines.append( "The actor never ran - it was cancelled before it started running." ) - if cause.preempted: + if ( + cause.node_death_info + and cause.node_death_info.reason + == NodeDeathInfo.AUTOSCALER_DRAIN_PREEMPTED + ): preempted = True error_msg_lines.append( "\tThe actor's node was killed by a spot preemption." diff --git a/src/ray/gcs/gcs_server/gcs_actor_manager.cc b/src/ray/gcs/gcs_server/gcs_actor_manager.cc index 456186393658..edfe77adeacb 100644 --- a/src/ray/gcs/gcs_server/gcs_actor_manager.cc +++ b/src/ray/gcs/gcs_server/gcs_actor_manager.cc @@ -215,8 +215,8 @@ const ray::rpc::ActorDeathCause GcsActorManager::GenNodeDiedCause( // TODO(vitsai): Publish this information as well if (auto death_info = node->death_info(); death_info.reason() == rpc::NodeDeathInfo::AUTOSCALER_DRAIN_PREEMPTED) { - auto node_death_info = actor_died_error_ctx->mutable_node_death_info(); - node_death_info->CopyFrom(node->death_info()); + auto node_death_info = actor_died_error_ctx->mutable_node_death_info(); + node_death_info->CopyFrom(node->death_info()); } return death_cause; }