mirror of
https://github.com/wassname/ray.git
synced 2026-09-12 12:51:15 +08:00
[autoscaler] Add an aggressive_autoscaling flag (#4285)
This commit is contained in:
committed by
Robert Nishihara
parent
56a78baf67
commit
3e1adafbce
@@ -51,6 +51,9 @@ CLUSTER_CONFIG_SCHEMA = {
|
||||
# The number of workers to launch initially, in addition to the head node.
|
||||
"initial_workers": (int, OPTIONAL),
|
||||
|
||||
# The mode of the autoscaler e.g. default, aggressive
|
||||
"autoscaling_mode": (str, OPTIONAL),
|
||||
|
||||
# The autoscaler will scale up the cluster to this target fraction of
|
||||
# resources usage. For example, if a cluster of 8 nodes is 100% busy
|
||||
# and target_utilization was 0.8, it would resize the cluster to 10.
|
||||
@@ -519,9 +522,13 @@ class StandardAutoscaler(object):
|
||||
ideal_num_nodes = int(np.ceil(cur_used / float(target_frac)))
|
||||
ideal_num_workers = ideal_num_nodes - 1 # subtract 1 for head node
|
||||
|
||||
initial_workers = self.config["initial_workers"]
|
||||
aggressive = self.config["autoscaling_mode"] == "aggressive"
|
||||
if self.bringup:
|
||||
ideal_num_workers = max(ideal_num_workers,
|
||||
self.config["initial_workers"])
|
||||
ideal_num_workers = max(ideal_num_workers, initial_workers)
|
||||
elif aggressive and cur_used > 0:
|
||||
# If we want any workers, we want at least initial_workers
|
||||
ideal_num_workers = max(ideal_num_workers, initial_workers)
|
||||
|
||||
return min(self.config["max_workers"],
|
||||
max(self.config["min_workers"], ideal_num_workers))
|
||||
|
||||
Reference in New Issue
Block a user