From 9e39de60eb080cfd7c28785e65bf9a80a032bc35 Mon Sep 17 00:00:00 2001 From: Zhanghao Wu Date: Wed, 31 May 2023 17:05:55 -0700 Subject: [PATCH] [Spot] Retry until up for spot (#2004) * Fix retry-until-up for spot launch * format * abbr * Update sky/cli.py Co-authored-by: Zongheng Yang * format --------- Co-authored-by: Zongheng Yang --- sky/cli.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/sky/cli.py b/sky/cli.py index b9eddccd944..9f9768fcef8 100644 --- a/sky/cli.py +++ b/sky/cli.py @@ -3353,9 +3353,9 @@ def spot(): help=('If True, as soon as a job is submitted, return from this call ' 'and do not stream execution logs.')) @click.option( - '--retry-until-up', - '-r', - default=True, + '--retry-until-up/--no-retry-until-up', + '-r/-no-r', + default=None, is_flag=True, required=False, help=('(Default: True; this flag is deprecated and will be removed in a ' @@ -3429,6 +3429,18 @@ def spot_launch( disk_tier=disk_tier, spot_recovery=spot_recovery, ) + # Deprecation. + if retry_until_up is not None: + flag_str = '--retry-until-up' + if not retry_until_up: + flag_str = '--no-retry-until-up' + click.secho( + f'Flag {flag_str} is deprecated and will be removed in a ' + 'future release (managed spot jobs will always be retried). ' + 'Please file an issue if this does not work for you.', + fg='yellow') + else: + retry_until_up = True if not yes: prompt = f'Launching a new spot task {name!r}. Proceed?' @@ -3444,14 +3456,6 @@ def spot_launch( if resources.cloud is not None else clouds.Cloud) task_cloud.check_cluster_name_is_valid(name) - # Deprecation. - if not retry_until_up: - click.secho( - 'Flag --retry-until-up is deprecated and will be removed in a ' - 'future release (defaults to True). Please file an issue if this ' - 'does not work for you.', - fg='yellow') - sky.spot_launch(task, name, detach_run=detach_run,