Skip to content

Commit

Permalink
Remove questionary dependency (#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
parasj authored Jun 29, 2022
1 parent 1598038 commit 7402a15
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 35 deletions.
18 changes: 0 additions & 18 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ google-cloud-compute = ">=1.0.0"
google-cloud-storage = ">=1.30.0"
pandas = ">=1.0.0"
paramiko = ">=2.7.2"
questionary = ">=1.5.2"
rich = ">=9.0.0"
sshtunnel = ">=0.3.0"
typer = ">=0.4.0"
Expand Down
25 changes: 14 additions & 11 deletions skyplane/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from shlex import split
import traceback

import questionary
import typer

import skyplane.cli.cli_aws
Expand Down Expand Up @@ -337,16 +336,20 @@ def ssh():

instance_map = {f"{i.region_tag}, {i.public_ip()} ({i.instance_state()})": i for i in instances}
choices = list(sorted(instance_map.keys()))
instance_name = questionary.select("Select an instance", choices=choices).ask()
if instance_name is not None and instance_name in instance_map:
instance = instance_map[instance_name]
cmd = instance.get_ssh_cmd()
logger.info(f"Running SSH command: {cmd}")
logger.info("It may ask for a private key password, try `skyplane`.")
proc = subprocess.Popen(split(cmd))
proc.wait()
else:
typer.secho(f"No instance selected", fg="red")

# ask for selection
typer.secho("Select an instance:", fg="yellow", bold=True)
for i, choice in enumerate(choices):
typer.secho(f"{i+1}) {choice}", fg="yellow")
choice = typer.prompt(f"Enter a number: ", validators=[typer.Range(1, len(choices))])
instance = instance_map[choices[choice - 1]]

# ssh
cmd = instance.get_ssh_cmd()
logger.info(f"Running SSH command: {cmd}")
logger.info("It may ask for a private key password, try `skyplane`.")
proc = subprocess.Popen(split(cmd))
proc.wait()


@app.command()
Expand Down
9 changes: 4 additions & 5 deletions skyplane/cli/experiments/cli_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from typing import List, Optional, Tuple

import pandas as pd
import questionary
import typer

from rich.progress import Progress
Expand Down Expand Up @@ -253,7 +252,7 @@ def setup(server: Server):
logger.debug(f"Log directory: {log_dir}")
sys.stdout.flush()
sys.stderr.flush()
if not questionary.confirm(f"Launch experiment {experiment_tag}?", default=False).ask():
if not typer.confirm(f"\nRun experiment? (tag: {experiment_tag})", default=True):
logger.error("Exiting")
sys.exit(1)

Expand Down Expand Up @@ -427,9 +426,9 @@ def setup(server: Server):
logger.debug(f"Log directory: {log_dir}")
sys.stdout.flush()
sys.stderr.flush()
# if not questionary.confirm(f"Launch experiment {experiment_tag}?", default=False).ask():
# logger.error("Exiting")
# sys.exit(1)
if not typer.confirm(f"\nRun experiment? (tag: {experiment_tag})", default=True):
logger.error("Exiting")
sys.exit(1)

# define ping command
def client_fn(instance_pair):
Expand Down

0 comments on commit 7402a15

Please sign in to comment.