Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[App] Remove --instance-types from cluster creation #15314

Merged
merged 10 commits into from
Oct 31, 2022
4 changes: 4 additions & 0 deletions src/lightning_app/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Added support for adding requirements to commands and installing them when missing when running an app command ([#15198](https://github.com/Lightning-AI/lightning/pull/15198)
- Added Lightning CLI Connection to be terminal session instead of global ([#15241](https://github.com/Lightning-AI/lightning/pull/15241)

## Changed

- Removed the `--instance-types` option when creating clusters ([#15314](https://github.com/Lightning-AI/lightning/pull/15314))

### Fixed

- Fixed an issue when using the CLI without arguments ([#14877](https://github.com/Lightning-AI/lightning/pull/14877))
Expand Down
4 changes: 0 additions & 4 deletions src/lightning_app/cli/cmd_clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
V1ClusterState,
V1ClusterType,
V1CreateClusterRequest,
V1InstanceSpec,
V1KubernetesClusterDriver,
)
from rich.console import Console
Expand Down Expand Up @@ -86,7 +85,6 @@ def create(
role_arn: str = None,
region: str = "us-east-1",
external_id: str = None,
instance_types: List[str] = [],
edit_before_creation: bool = False,
wait: bool = False,
) -> None:
Expand All @@ -98,7 +96,6 @@ def create(
role_arn: AWS IAM Role ARN used to provision resources
region: AWS region containing compute resources
external_id: AWS IAM Role external ID
instance_types: AWS instance types supported by the cluster
edit_before_creation: Enables interactive editing of requests before submitting it to Lightning AI.
wait: Waits for the cluster to be in a RUNNING state. Only use this for debugging.
"""
Expand All @@ -119,7 +116,6 @@ def create(
region=region,
role_arn=role_arn,
external_id=external_id,
instance_types=[V1InstanceSpec(name=x) for x in instance_types],
)
)
),
Expand Down
10 changes: 0 additions & 10 deletions src/lightning_app/cli/lightning_cli_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ def create() -> None:
default="us-east-1",
help="AWS region that is used to host the associated resources.",
)
@click.option(
"--instance-types",
"instance_types",
type=str,
required=False,
default=None,
help="Instance types that you want to support, for computer jobs within the cluster.",
)
@click.option(
"--enable-performance",
"enable_performance",
Expand Down Expand Up @@ -65,7 +57,6 @@ def create_cluster(
role_arn: str,
external_id: str,
provider: str,
instance_types: str,
edit_before_creation: bool,
enable_performance: bool,
wait: bool,
Expand All @@ -81,7 +72,6 @@ def create_cluster(
region=region,
role_arn=role_arn,
external_id=external_id,
instance_types=instance_types.split(",") if instance_types is not None else [],
edit_before_creation=edit_before_creation,
cost_savings=not enable_performance,
wait=wait,
Expand Down
13 changes: 4 additions & 9 deletions tests/tests_app/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,13 @@ def test_main_lightning_cli_help():
@mock.patch("lightning_cloud.login.Auth.authenticate", MagicMock())
@mock.patch("lightning_app.cli.cmd_clusters.AWSClusterManager.create")
@pytest.mark.parametrize(
"extra_arguments,expected_instance_types,expected_cost_savings_mode",
"extra_arguments,expected_cost_savings_mode",
[
(["--instance-types", "t3.xlarge"], ["t3.xlarge"], True),
(["--instance-types", "t3.xlarge,t3.2xlarge"], ["t3.xlarge", "t3.2xlarge"], True),
([], [], True),
(["--enable-performance"], [], False),
([], True),
(["--enable-performance"], False),
],
)
def test_create_cluster(
create_command: mock.MagicMock, extra_arguments, expected_instance_types, expected_cost_savings_mode
):
def test_create_cluster(create_command: mock.MagicMock, extra_arguments, expected_cost_savings_mode):
runner = CliRunner()
runner.invoke(
create_cluster,
Expand All @@ -125,7 +121,6 @@ def test_create_cluster(
region="us-east-1",
role_arn="arn:aws:iam::1234567890:role/lai-byoc",
external_id="dummy",
instance_types=expected_instance_types,
edit_before_creation=False,
cost_savings=expected_cost_savings_mode,
wait=False,
Expand Down
3 changes: 0 additions & 3 deletions tests/tests_app/cli/test_cmd_clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
V1ClusterStatus,
V1ClusterType,
V1CreateClusterRequest,
V1InstanceSpec,
V1KubernetesClusterDriver,
V1ListClustersResponse,
)
Expand Down Expand Up @@ -43,7 +42,6 @@ def test_create_cluster(api: mock.MagicMock):
cluster_name="test-7",
external_id="dummy",
role_arn="arn:aws:iam::1234567890:role/lai-byoc",
instance_types=["t2.small"],
region="us-west-2",
)

Expand All @@ -59,7 +57,6 @@ def test_create_cluster(api: mock.MagicMock):
region="us-west-2",
role_arn="arn:aws:iam::1234567890:role/lai-byoc",
external_id="dummy",
instance_types=[V1InstanceSpec(name="t2.small")],
)
)
),
Expand Down