create AWS infra
This commit is contained in:
39
src/main.py
Normal file
39
src/main.py
Normal file
@@ -0,0 +1,39 @@
|
||||
from pathlib import Path
|
||||
|
||||
import typer
|
||||
import yaml
|
||||
from rich.console import Console
|
||||
|
||||
from src.commands import infra
|
||||
from src.config import Config
|
||||
|
||||
app = typer.Typer(
|
||||
help="qai-cli: End-to-end model managment for Qualcomm AI Hub.",
|
||||
no_args_is_help=True,
|
||||
)
|
||||
app.add_typer(infra.app, name="infra")
|
||||
|
||||
console = Console()
|
||||
|
||||
|
||||
@app.command()
|
||||
def init(
|
||||
output: str = typer.Option("config.yaml", help="Destination path for the config file"),
|
||||
force: bool = typer.Option(False, "--force", "-f", help="Overwrite an existing config file"),
|
||||
) -> None:
|
||||
"""Write a starter config.yaml to the current directory."""
|
||||
dest = Path(output)
|
||||
if dest.exists() and not force:
|
||||
console.print(f"[yellow]{dest} already exists.[/yellow] Use --force to overwrite.")
|
||||
raise typer.Exit(1)
|
||||
|
||||
config = Config()
|
||||
dest.parent.mkdir(parents=True, exist_ok=True)
|
||||
with open(dest, "w") as f:
|
||||
yaml.safe_dump(config.model_dump(mode="json"), f, sort_keys=False)
|
||||
|
||||
console.print(f"[green]✓[/green] Config written to [bold]{dest}[/bold]")
|
||||
console.print(
|
||||
"Edit it (especially [cyan]s3.bucket[/cyan] and [cyan]sagemaker.training.image_uri[/cyan]) "
|
||||
"before running other commands."
|
||||
)
|
||||
Reference in New Issue
Block a user