Skip to content

Commit

Permalink
candidate_clouds
Browse files Browse the repository at this point in the history
  • Loading branch information
romilbhardwaj committed May 15, 2024
1 parent 5a2f1b8 commit c3bee42
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
19 changes: 15 additions & 4 deletions sky/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions sky/utils/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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.
Expand Down

0 comments on commit c3bee42

Please sign in to comment.