Skip to content

Commit

Permalink
Azure: allow spot instances. (skypilot-org#2871)
Browse files Browse the repository at this point in the history
  • Loading branch information
concretevitamin authored and remyleone committed Dec 22, 2023
1 parent 69d9682 commit 5afa3c4
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
9 changes: 0 additions & 9 deletions sky/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1413,15 +1413,6 @@ def launch(
if backend_name is None:
backend_name = backends.CloudVmRayBackend.NAME

# A basic check. Programmatic calls will have a proper (but less
# informative) error from optimizer.
if (cloud is not None and cloud.lower() == 'azure' and
use_spot is not None and use_spot):
raise click.UsageError(
'SkyPilot currently has not implemented '
'support for spot instances on Azure. Please file '
'an issue if you need this feature.')

task_or_dag = _make_task_or_dag_from_entrypoint_with_overrides(
entrypoint=entrypoint,
name=name,
Expand Down
8 changes: 2 additions & 6 deletions sky/clouds/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,8 @@ class Azure(clouds.Cloud):
def _cloud_unsupported_features(
cls) -> Dict[clouds.CloudImplementationFeatures, str]:
return {
clouds.CloudImplementationFeatures.CLONE_DISK_FROM_CLUSTER: f'Migrating disk is not supported in {cls._REPR}.',
# TODO(zhwu): our azure subscription offer ID does not support spot.
# Need to support it.
clouds.CloudImplementationFeatures.SPOT_INSTANCE: f'Spot instances are not supported in {cls._REPR}.',
clouds.CloudImplementationFeatures.CLONE_DISK_FROM_CLUSTER:
(f'Migrating disk is not supported in {cls._REPR}.'),
}

@classmethod
Expand Down Expand Up @@ -244,8 +242,6 @@ def make_deploy_resources_variables(
region_name = region.name

r = resources
assert not r.use_spot, \
'Our subscription offer ID does not support spot instances.'
# r.accelerators is cleared but .instance_type encodes the info.
acc_dict = self.get_accelerators_from_instance_type(r.instance_type)
if acc_dict is not None:
Expand Down
1 change: 0 additions & 1 deletion sky/clouds/service_catalog/azure_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def get_hourly_cost(instance_type: str,
region: Optional[str] = None,
zone: Optional[str] = None) -> float:
# Ref: https://azure.microsoft.com/en-us/support/legal/offer-details/
assert not use_spot, 'Current Azure subscription does not support spot.'
if zone is not None:
with ux_utils.print_exception_no_traceback():
raise ValueError('Azure does not support zones.')
Expand Down

0 comments on commit 5afa3c4

Please sign in to comment.