diff --git a/sky/utils/controller_utils.py b/sky/utils/controller_utils.py index eef48dc558c..7ed5a722e05 100644 --- a/sky/utils/controller_utils.py +++ b/sky/utils/controller_utils.py @@ -324,6 +324,8 @@ def get_controller_resources( if res.cloud is not None and not clouds.cloud_in_iterable( res.cloud, requested_clouds): requested_clouds.add(res.cloud) + if not requested_clouds: + return {controller_resources_to_use} return { controller_resources_to_use.copy(cloud=controller_cloud) for controller_cloud in requested_clouds diff --git a/tests/unit_tests/test_controller_utils.py b/tests/unit_tests/test_controller_utils.py index 57490139f8b..673d208a642 100644 --- a/tests/unit_tests/test_controller_utils.py +++ b/tests/unit_tests/test_controller_utils.py @@ -52,8 +52,12 @@ def get_custom_controller_resources(keys, default): monkeypatch.setattr('sky.skypilot_config.get_nested', get_custom_controller_resources) - controller_resources = controller_utils.get_controller_resources( - controller_type, controller_resources_config) + controller_resources = list( + controller_utils.get_controller_resources( + controller_type=controller_type, + controller_name='dummy', + controller_resources_config=controller_resources_config, + task_resources=[]))[0] controller_resources_config = controller_resources.to_yaml_config() for k, v in expected.items(): assert controller_resources_config[k] == v, (