mirror of
https://github.com/vale981/ray
synced 2025-03-06 02:21:39 -05:00
[autoscaler][commands] Fix load metrics summary (#20623)
Running ray status with the changes from #20359 while running an autoscaler older than those changes results in an error on input "head_ip" to LoadMetricsSummary. See #20359 (comment) This PR fixes the bug by restoring head_ip as an optional parameter of LoadMetricsSummary.
This commit is contained in:
parent
a912b68375
commit
76a01862cb
2 changed files with 9 additions and 1 deletions
|
@ -4,7 +4,7 @@ from functools import reduce
|
|||
import logging
|
||||
from numbers import Number
|
||||
import time
|
||||
from typing import Dict, List, Tuple
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
|
||||
import numpy as np
|
||||
import ray.ray_constants
|
||||
|
@ -34,6 +34,8 @@ class LoadMetricsSummary:
|
|||
# Counts of demand bundles requested by autoscaler.sdk.request_resources
|
||||
request_demand: List[DictCount]
|
||||
node_types: List[DictCount]
|
||||
# Optionally included for backwards compatibility: IP of the head node.
|
||||
head_ip: Optional[NodeIP] = None
|
||||
|
||||
|
||||
def add_resources(dict1: Dict[str, float],
|
||||
|
|
|
@ -1409,6 +1409,12 @@ class LoadMetricsTest(unittest.TestCase):
|
|||
# Ensure summary_dict is json-serializable
|
||||
json.dumps(summary_dict)
|
||||
|
||||
# Backwards compatibility check: head_ip is correctly processed
|
||||
# when included as an argument to LoadMetricsSummary.
|
||||
summary_dict["head_ip"] = "1.1.1.1"
|
||||
# No compatibility issue.
|
||||
LoadMetricsSummary(**summary_dict)
|
||||
|
||||
|
||||
class AutoscalingTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue