Skip to content

Commit

Permalink
Allow calling generate cluster with no options, and gather tham from …
Browse files Browse the repository at this point in the history
…the prompt
  • Loading branch information
GeorgianaElena committed Aug 30, 2023
1 parent 45cdccb commit 658b8b1
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions deployer/generate/generate_gcp_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"""
import jinja2
import typer
from typing_extensions import Annotated

from ..cli_app import app
from ..utils import print_colour
Expand Down Expand Up @@ -43,20 +44,28 @@ def generate_terraform_file(vars):

@app.command()
def generate_gcp_cluster(
cluster_name: str = typer.Option(..., prompt="Name of the cluster"),
cluster_region: str = typer.Option(..., prompt="Cluster region"),
project_id: str = typer.Option(..., prompt="Project ID of the GCP project"),
hub_type: str = typer.Option(
..., prompt="Type of hub. Choose from `basehub` or `daskhub`"
),
hub_name: str = typer.Option(..., prompt="Name of the first hub"),
cluster_name: Annotated[
str, typer.Option(prompt="Please type the name of the new cluster")
],
project_id: Annotated[
str, typer.Option(prompt="Please insert the Project ID of the GCP project")
],
hub_name: Annotated[
str,
typer.Option(
prompt="Please insert the name of first hub to add to the cluster"
),
],
cluster_region: Annotated[
str, typer.Option(prompt="Please insert the name of the cluster region")
] = "us-central1",
hub_type: Annotated[
str, typer.Option(prompt="Please insert the hub type of the first hub")
] = "basehub",
):
"""
Automatically generates the initial files, required to setup a new cluster on GCP
"""
# Automatically generate the terraform config file
generate_terraform_file(cluster_name, cluster_region, project_id, hub_type)

# These are the variables needed by the templates used to generate the cluster config file
# and support files
vars = {
Expand All @@ -67,6 +76,9 @@ def generate_gcp_cluster(
"hub_name": hub_name,
}

# Automatically generate the terraform config file
generate_terraform_file(vars)

# Automatically generate the config directory
cluster_config_directory = generate_config_directory(vars)

Expand Down

0 comments on commit 658b8b1

Please sign in to comment.