From 8d31b41787dee91205d0c480280f5473157b4f73 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Tue, 5 Jun 2018 09:24:37 -0700 Subject: [PATCH 1/5] Ignore size low pri --- aztk_cli/spark/endpoints/cluster/cluster_create.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/aztk_cli/spark/endpoints/cluster/cluster_create.py b/aztk_cli/spark/endpoints/cluster/cluster_create.py index 1b02f551..d3108fc4 100644 --- a/aztk_cli/spark/endpoints/cluster/cluster_create.py +++ b/aztk_cli/spark/endpoints/cluster/cluster_create.py @@ -13,6 +13,8 @@ def setup_parser(parser: argparse.ArgumentParser): parser.add_argument('--size', type=int, help='Number of vms in your cluster') parser.add_argument('--size-low-pri', type=int, + help='Number of low priority vms in your cluster (Deprecated') + parser.add_argument('--size-low-priority', type=int, help='Number of low priority vms in your cluster') parser.add_argument('--vm-size', help='VM size for nodes in your cluster') @@ -29,7 +31,7 @@ def setup_parser(parser: argparse.ArgumentParser): parser.add_argument('--no-wait', dest='wait', action='store_false') parser.add_argument('--wait', dest='wait', action='store_true') - parser.set_defaults(wait=None, size=None, size_low_priority=None) + parser.set_defaults(wait=None, size=None, size_low_pri=None, size_low_priority=None) def execute(args: typing.NamedTuple): @@ -40,10 +42,12 @@ def execute(args: typing.NamedTuple): # read cluster.yaml configuartion file, overwrite values with args file_config, wait = config.read_cluster_config() cluster_conf.merge(file_config) + if args.size_low_pri: + deprecate("--size-low-pri has been deprecated. Please use --size-low-priority") cluster_conf.merge(ClusterConfiguration( cluster_id=args.cluster_id, size=args.size, - size_low_priority=args.size_low_priority, + size_low_priority=args.size_low_priority or args.size_low_pri, vm_size=args.vm_size, subnet_id=args.subnet_id, user_configuration=UserConfiguration( From 88d34cd9b49d6bdb4df05cdb5cd6085d596d3daf Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Tue, 5 Jun 2018 09:24:58 -0700 Subject: [PATCH 2/5] Import --- aztk_cli/spark/endpoints/cluster/cluster_create.py | 1 + 1 file changed, 1 insertion(+) diff --git a/aztk_cli/spark/endpoints/cluster/cluster_create.py b/aztk_cli/spark/endpoints/cluster/cluster_create.py index d3108fc4..8262fc3a 100644 --- a/aztk_cli/spark/endpoints/cluster/cluster_create.py +++ b/aztk_cli/spark/endpoints/cluster/cluster_create.py @@ -3,6 +3,7 @@ import aztk.spark from aztk.spark.models import ClusterConfiguration, UserConfiguration +from aztk.utils import deprecate from aztk_cli import config, log, utils from aztk_cli.config import load_aztk_spark_config From 475a84257b3f1a3a54dfebf76db7ed24dd24063d Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Tue, 5 Jun 2018 09:27:54 -0700 Subject: [PATCH 3/5] Tweak text --- aztk_cli/spark/endpoints/cluster/cluster_create.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aztk_cli/spark/endpoints/cluster/cluster_create.py b/aztk_cli/spark/endpoints/cluster/cluster_create.py index 8262fc3a..e5e1beaf 100644 --- a/aztk_cli/spark/endpoints/cluster/cluster_create.py +++ b/aztk_cli/spark/endpoints/cluster/cluster_create.py @@ -14,7 +14,7 @@ def setup_parser(parser: argparse.ArgumentParser): parser.add_argument('--size', type=int, help='Number of vms in your cluster') parser.add_argument('--size-low-pri', type=int, - help='Number of low priority vms in your cluster (Deprecated') + help='Number of low priority vms in your cluster (Deprecated, use --size-low-priority)') parser.add_argument('--size-low-priority', type=int, help='Number of low priority vms in your cluster') parser.add_argument('--vm-size', From 4f8a9c3907e73c26c150866f4b8952b26fa080f0 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Tue, 5 Jun 2018 09:29:08 -0700 Subject: [PATCH 4/5] Handle 0 case being falsy --- aztk_cli/spark/endpoints/cluster/cluster_create.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/aztk_cli/spark/endpoints/cluster/cluster_create.py b/aztk_cli/spark/endpoints/cluster/cluster_create.py index e5e1beaf..9facf482 100644 --- a/aztk_cli/spark/endpoints/cluster/cluster_create.py +++ b/aztk_cli/spark/endpoints/cluster/cluster_create.py @@ -43,12 +43,14 @@ def execute(args: typing.NamedTuple): # read cluster.yaml configuartion file, overwrite values with args file_config, wait = config.read_cluster_config() cluster_conf.merge(file_config) - if args.size_low_pri: + if args.size_low_pri is not None: deprecate("--size-low-pri has been deprecated. Please use --size-low-priority") + args.size_low_priority = args.size_low_pri + cluster_conf.merge(ClusterConfiguration( cluster_id=args.cluster_id, size=args.size, - size_low_priority=args.size_low_priority or args.size_low_pri, + size_low_priority=args.size_low_priority, vm_size=args.vm_size, subnet_id=args.subnet_id, user_configuration=UserConfiguration( From b4d32cbbfc3d6b0593a3be30dc42bd237cd24877 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Tue, 5 Jun 2018 09:35:08 -0700 Subject: [PATCH 5/5] Fix typo --- aztk_cli/spark/endpoints/cluster/cluster_create.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aztk_cli/spark/endpoints/cluster/cluster_create.py b/aztk_cli/spark/endpoints/cluster/cluster_create.py index 9facf482..e24d6439 100644 --- a/aztk_cli/spark/endpoints/cluster/cluster_create.py +++ b/aztk_cli/spark/endpoints/cluster/cluster_create.py @@ -40,7 +40,7 @@ def execute(args: typing.NamedTuple): cluster_conf = ClusterConfiguration() cluster_conf.spark_configuration = load_aztk_spark_config() - # read cluster.yaml configuartion file, overwrite values with args + # read cluster.yaml configuration file, overwrite values with args file_config, wait = config.read_cluster_config() cluster_conf.merge(file_config) if args.size_low_pri is not None: