mirror of
https://github.com/wassname/ray.git
synced 2026-07-14 11:17:54 +08:00
[autoscaler] Add a 'request_cores' function for manual autoscaling (#4754)
This commit is contained in:
committed by
Richard Liaw
parent
d9e81da3b8
commit
06fec63c87
@@ -275,6 +275,33 @@ class AutoscalingTest(unittest.TestCase):
|
||||
autoscaler.update()
|
||||
self.waitForNodes(2)
|
||||
|
||||
def testManualAutoscaling(self):
|
||||
config = SMALL_CLUSTER.copy()
|
||||
config["min_workers"] = 0
|
||||
config["max_workers"] = 50
|
||||
cores_per_node = 2
|
||||
config["worker_nodes"] = {"Resources": {"CPU": cores_per_node}}
|
||||
config_path = self.write_config(config)
|
||||
self.provider = MockProvider()
|
||||
autoscaler = StandardAutoscaler(
|
||||
config_path,
|
||||
LoadMetrics(),
|
||||
max_launch_batch=5,
|
||||
max_concurrent_launches=5,
|
||||
max_failures=0,
|
||||
update_interval_s=0)
|
||||
assert len(self.provider.non_terminated_nodes({})) == 0
|
||||
autoscaler.update()
|
||||
self.waitForNodes(0)
|
||||
autoscaler.request_resources({"CPU": cores_per_node * 10})
|
||||
for _ in range(3): # Maximum launch batch is 5
|
||||
autoscaler.update()
|
||||
self.waitForNodes(10)
|
||||
autoscaler.request_resources({"CPU": cores_per_node * 30})
|
||||
for _ in range(4): # Maximum launch batch is 5
|
||||
autoscaler.update()
|
||||
self.waitForNodes(30)
|
||||
|
||||
def testTerminateOutdatedNodesGracefully(self):
|
||||
config = SMALL_CLUSTER.copy()
|
||||
config["min_workers"] = 5
|
||||
|
||||
Reference in New Issue
Block a user