[autoscaler] Flag flip for resource_demand_scheduler should take into account queue (#11615)

This commit is contained in:
Ameer Haj Ali
2020-11-02 12:41:22 -08:00
committed by GitHub
parent cce91b51bd
commit 8d74a04a42
4 changed files with 124 additions and 2 deletions
+11 -1
View File
@@ -12,6 +12,8 @@ from ray.autoscaler._private.autoscaler import StandardAutoscaler
from ray.autoscaler._private.commands import teardown_cluster
from ray.autoscaler._private.constants import AUTOSCALER_UPDATE_INTERVAL_S
from ray.autoscaler._private.load_metrics import LoadMetrics
from ray.autoscaler._private.constants import \
AUTOSCALER_MAX_RESOURCE_DEMAND_VECTOR_SIZE
import ray.gcs_utils
import ray.utils
import ray.ray_constants as ray_constants
@@ -56,9 +58,17 @@ def parse_resource_demands(resource_load_by_shape):
backlog_queue = waiting_bundles
for _ in range(resource_demand_pb.backlog_size):
backlog_queue.append(request_shape)
if len(waiting_bundles+infeasible_bundles) > \
AUTOSCALER_MAX_RESOURCE_DEMAND_VECTOR_SIZE:
break
except Exception:
logger.exception("Failed to parse resource demands.")
return waiting_bundles, infeasible_bundles
# Bound the total number of bundles to 2xMAX_RESOURCE_DEMAND_VECTOR_SIZE.
# This guarantees the resource demand scheduler bin packing algorithm takes
# a reasonable amount of time to run.
return waiting_bundles[:AUTOSCALER_MAX_RESOURCE_DEMAND_VECTOR_SIZE], \
infeasible_bundles[:AUTOSCALER_MAX_RESOURCE_DEMAND_VECTOR_SIZE]
class Monitor: