diff --git a/src/ray/object_manager/ownership_based_object_directory.cc b/src/ray/object_manager/ownership_based_object_directory.cc index 1b27a540d..a390bbb40 100644 --- a/src/ray/object_manager/ownership_based_object_directory.cc +++ b/src/ray/object_manager/ownership_based_object_directory.cc @@ -134,10 +134,10 @@ ray::Status OwnershipBasedObjectDirectory::ReportObjectAdded( request, [worker_id, object_id, node_id]( Status status, const rpc::AddObjectLocationOwnerReply &reply) { if (!status.ok()) { - RAY_LOG(INFO) << "Worker " << worker_id << " failed to add the location " - << node_id << " for " << object_id - << ", the object has most likely been freed: " - << status.ToString(); + RAY_LOG(DEBUG) << "Worker " << worker_id << " failed to add the location " + << node_id << " for " << object_id + << ", the object has most likely been freed: " + << status.ToString(); } else { RAY_LOG(DEBUG) << "Added location " << node_id << " for object " << object_id << " on owner " << worker_id; @@ -168,10 +168,10 @@ ray::Status OwnershipBasedObjectDirectory::ReportObjectRemoved( request, [worker_id, object_id, node_id]( Status status, const rpc::RemoveObjectLocationOwnerReply &reply) { if (!status.ok()) { - RAY_LOG(INFO) << "Worker " << worker_id << " failed to remove the location " - << node_id << " for " << object_id - << ", the object has most likely been freed: " - << status.ToString(); + RAY_LOG(DEBUG) << "Worker " << worker_id << " failed to remove the location " + << node_id << " for " << object_id + << ", the object has most likely been freed: " + << status.ToString(); } else { RAY_LOG(DEBUG) << "Removed location " << node_id << " for object " << object_id << " on owner " << worker_id; diff --git a/src/ray/raylet/scheduling/cluster_resource_scheduler.cc b/src/ray/raylet/scheduling/cluster_resource_scheduler.cc index 67a98adbc..c40aff01c 100644 --- a/src/ray/raylet/scheduling/cluster_resource_scheduler.cc +++ b/src/ray/raylet/scheduling/cluster_resource_scheduler.cc @@ -21,7 +21,8 @@ namespace ray { ClusterResourceScheduler::ClusterResourceScheduler( int64_t local_node_id, const NodeResources &local_node_resources) - : local_node_id_(local_node_id) { + : local_node_id_(local_node_id), + gen_(std::chrono::high_resolution_clock::now().time_since_epoch().count()) { AddOrUpdateNode(local_node_id_, local_node_resources); InitLocalResources(local_node_resources); } @@ -233,7 +234,8 @@ int64_t ClusterResourceScheduler::GetBestSchedulableNode(const TaskRequest &task // This an actor which requires no resources. // Pick a random node to to avoid all scheduling all actors on the local node. if (nodes_.size() > 0) { - int idx = std::rand() % nodes_.size(); + std::uniform_int_distribution distribution(0, nodes_.size() - 1); + int idx = distribution(gen_); for (auto &node : nodes_) { if (idx == 0) { best_nodes.emplace_back(node.first); diff --git a/src/ray/raylet/scheduling/cluster_resource_scheduler.h b/src/ray/raylet/scheduling/cluster_resource_scheduler.h index ebb34f42a..5abd1a26c 100644 --- a/src/ray/raylet/scheduling/cluster_resource_scheduler.h +++ b/src/ray/raylet/scheduling/cluster_resource_scheduler.h @@ -436,6 +436,8 @@ class ClusterResourceScheduler : public ClusterResourceSchedulerInterface { absl::flat_hash_map nodes_; /// Identifier of local node. int64_t local_node_id_; + /// Internally maintained random number generator. + std::mt19937_64 gen_; /// Resources of local node. NodeResourceInstances local_resources_; /// Keep the mapping between node and resource IDs in string representation