mirror of
https://github.com/wassname/ray.git
synced 2026-07-07 10:08:07 +08:00
[GCS]GCS based Actor Scheduling support actor colocation (#12707)
* [GCS]GCS based Actor Scheduling support actor colocation * fix review comment Co-authored-by: 灵洵 <fengbin.ffb@antgroup.com>
This commit is contained in:
@@ -45,7 +45,18 @@ void GcsActorScheduler::Schedule(std::shared_ptr<GcsActor> actor) {
|
||||
RAY_CHECK(actor->GetNodeID().IsNil() && actor->GetWorkerID().IsNil());
|
||||
|
||||
// Select a node to lease worker for the actor.
|
||||
auto node = SelectNodeRandomly();
|
||||
std::shared_ptr<rpc::GcsNodeInfo> node;
|
||||
|
||||
// If an actor is non-detached and has resource requirements, We will try to schedule it
|
||||
// on the same node as the owner if possible.
|
||||
const auto &task_spec = actor->GetCreationTaskSpecification();
|
||||
if (!actor->IsDetached() && !task_spec.GetRequiredResources().IsEmpty()) {
|
||||
auto maybe_node = gcs_node_manager_.GetNode(actor->GetOwnerNodeID());
|
||||
node = maybe_node.has_value() ? maybe_node.value() : SelectNodeRandomly();
|
||||
} else {
|
||||
node = SelectNodeRandomly();
|
||||
}
|
||||
|
||||
if (node == nullptr) {
|
||||
// There are no available nodes to schedule the actor, so just trigger the failed
|
||||
// handler.
|
||||
|
||||
Reference in New Issue
Block a user