From 5afa3c4a66f0da39b638966b2f960463f574ab13 Mon Sep 17 00:00:00 2001 From: Zongheng Yang Date: Fri, 15 Dec 2023 19:58:27 -0800 Subject: [PATCH] Azure: allow spot instances. (#2871) --- sky/cli.py | 9 --------- sky/clouds/azure.py | 8 ++------ sky/clouds/service_catalog/azure_catalog.py | 1 - 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/sky/cli.py b/sky/cli.py index 6ac0290bd828..0425b9999e18 100644 --- a/sky/cli.py +++ b/sky/cli.py @@ -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, diff --git a/sky/clouds/azure.py b/sky/clouds/azure.py index 21731bdb0b37..6046d4b38058 100644 --- a/sky/clouds/azure.py +++ b/sky/clouds/azure.py @@ -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 @@ -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: diff --git a/sky/clouds/service_catalog/azure_catalog.py b/sky/clouds/service_catalog/azure_catalog.py index d7188cb0be56..97f23e8fa787 100644 --- a/sky/clouds/service_catalog/azure_catalog.py +++ b/sky/clouds/service_catalog/azure_catalog.py @@ -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.')