From 474af365911da9ed1a9634fd94e353d8feafc022 Mon Sep 17 00:00:00 2001 From: SangBin Cho Date: Wed, 30 Sep 2020 00:11:57 -0700 Subject: [PATCH] [Core] Fix random bugs found. (#11128) --- python/ray/autoscaler/_private/load_metrics.py | 8 ++++++-- python/ray/util/placement_group.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/python/ray/autoscaler/_private/load_metrics.py b/python/ray/autoscaler/_private/load_metrics.py index 4d7463703..9d1799308 100644 --- a/python/ray/autoscaler/_private/load_metrics.py +++ b/python/ray/autoscaler/_private/load_metrics.py @@ -32,10 +32,14 @@ class LoadMetrics: static_resources, dynamic_resources, resource_load, - waiting_bundles=[], - infeasible_bundles=[]): + waiting_bundles=None, + infeasible_bundles=None): self.resource_load_by_ip[ip] = resource_load self.static_resources_by_ip[ip] = static_resources + if not waiting_bundles: + waiting_bundles = [] + if not infeasible_bundles: + infeasible_bundles = [] # We are not guaranteed to have a corresponding dynamic resource for # every static resource because dynamic resources are based on the diff --git a/python/ray/util/placement_group.py b/python/ray/util/placement_group.py index d908b74ea..b0c346407 100644 --- a/python/ray/util/placement_group.py +++ b/python/ray/util/placement_group.py @@ -51,7 +51,7 @@ class PlacementGroup: resource_name, value = self._get_none_zero_resource(bundle) num_cpus = 0 num_gpus = 0 - resources = None + resources = {} if resource_name == "CPU": num_cpus = value elif resource_name == "GPU":