Skip to content

Commit

Permalink
[Autoscaler] Remove duplicate util function is_head_node (ray-proje…
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin85421 authored Feb 16, 2025
1 parent 52d5eb9 commit 4976d0e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
2 changes: 1 addition & 1 deletion python/ray/autoscaler/v2/instance_manager/reconciler.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from ray.autoscaler.v2.metrics_reporter import AutoscalerMetricsReporter
from ray.autoscaler.v2.scheduler import IResourceScheduler, SchedulingRequest
from ray.autoscaler.v2.schema import AutoscalerInstance, NodeType
from ray.autoscaler.v2.sdk import is_head_node
from ray.autoscaler.v2.utils import is_head_node
from ray.core.generated.autoscaler_pb2 import (
AutoscalingState,
ClusterResourceState,
Expand Down
14 changes: 0 additions & 14 deletions python/ray/autoscaler/v2/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
ClusterResourceState,
GetClusterResourceStateReply,
GetClusterStatusReply,
NodeState,
)

DEFAULT_RPC_TIMEOUT_S = 10
Expand Down Expand Up @@ -95,16 +94,3 @@ def get_cluster_resource_state(gcs_client: GcsClient) -> ClusterResourceState:
reply = GetClusterResourceStateReply()
reply.ParseFromString(str_reply)
return reply.cluster_resource_state


def is_head_node(node_state: NodeState) -> bool:
"""
Check if the node is a head node from the node state.
Args:
node_state: the node state
Returns:
is_head: True if the node is a head node, False otherwise.
"""
# TODO: we should include this bit of information in the future. e.g.
# from labels.
return "node:__internal_head__" in dict(node_state.total_resources)

0 comments on commit 4976d0e

Please sign in to comment.