diff --git a/sky/check.py b/sky/check.py index 6818d80f3bf..14924cce1a7 100644 --- a/sky/check.py +++ b/sky/check.py @@ -7,6 +7,7 @@ import rich from sky import clouds +from sky import skypilot_config from sky import exceptions from sky import global_user_state from sky.adaptors import cloudflare @@ -45,10 +46,20 @@ def check_one_cloud(cloud_tuple: Tuple[str, clouds.Cloud]) -> None: else: echo(f' Reason: {reason}') - clouds_to_check = [ - (repr(cloud), cloud) for cloud in clouds.CLOUD_REGISTRY.values() - ] - clouds_to_check.append(('Cloudflare, for R2 object store', cloudflare)) + # Use candidate_clouds from config if it exists, otherwise check all clouds. + config_candidate_clouds = skypilot_config.get_nested(['candidate_clouds'], + None) + if config_candidate_clouds: + # TODO: Handle cloudflare here since it is not in CLOUD_REGISTRY. + clouds_to_check = [ + (cloud_name, clouds.CLOUD_REGISTRY.from_str(cloud_name)) + for cloud_name in config_candidate_clouds + ] + else: + clouds_to_check = [ + (repr(cloud), cloud) for cloud in clouds.CLOUD_REGISTRY.values() + ] + clouds_to_check.append(('Cloudflare, for R2 object store', cloudflare)) for cloud_tuple in sorted(clouds_to_check): check_one_cloud(cloud_tuple) diff --git a/sky/utils/schemas.py b/sky/utils/schemas.py index c50e15185a3..13eacd5644d 100644 --- a/sky/utils/schemas.py +++ b/sky/utils/schemas.py @@ -722,6 +722,14 @@ def get_config_schema(): }, } + candidate_clouds = { + # A list of cloud names that should be used for execution + 'type': 'array', + 'items': { + 'type': 'string', + } + } + for cloud, config in cloud_configs.items(): if cloud == 'aws': config['properties'].update(_REMOTE_IDENTITY_SCHEMA_AWS) @@ -738,6 +746,7 @@ def get_config_schema(): 'jobs': controller_resources_schema, 'spot': controller_resources_schema, 'serve': controller_resources_schema, + 'candidate_clouds': candidate_clouds, **cloud_configs, }, # Avoid spot and jobs being present at the same time.