Skip to content

Rework of mila init following changes #154

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 2 additions & 34 deletions milatools/cli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@
from milatools.cli import console
from milatools.cli.code import code
from milatools.cli.init_command import (
print_welcome_message,
setup_keys_on_login_node,
setup_passwordless_ssh_access,
setup_ssh_config,
setup_vscode_settings,
setup_windows_ssh_config_from_wsl,
init,
)
from milatools.cli.profile import ensure_program, setup_profile
from milatools.cli.utils import (
Expand All @@ -54,7 +49,6 @@
get_fully_qualified_name,
get_hostname_to_use_for_compute_node,
randname,
running_inside_WSL,
with_control_file,
)
from milatools.utils.disk_quota import check_disk_quota_v1
Expand Down Expand Up @@ -108,6 +102,7 @@ def main():
github_issue_url = (
f"https://github.com/mila-iqia/milatools/issues/new?{urlencode(options)}"
)

print(
T.bold_yellow(
f"An error occurred during the execution of the command `{command}`. "
Expand Down Expand Up @@ -508,33 +503,6 @@ def intranet(search: Sequence[str]) -> None:
webbrowser.open(url)


def init():
"""Set up your configuration and credentials."""

#############################
# Step 1: SSH Configuration #
#############################

print("Checking ssh config")

ssh_config = setup_ssh_config()

success = setup_passwordless_ssh_access(ssh_config=ssh_config)
if not success:
exit()

# if we're running on WSL, we actually just copy the id_rsa + id_rsa.pub and the
# ~/.ssh/config to the Windows ssh directory (taking care to remove the
# ControlMaster-related entries) so that the user doesn't need to install Python on
# the Windows side.
if running_inside_WSL():
setup_windows_ssh_config_from_wsl(linux_ssh_config=ssh_config)

setup_keys_on_login_node()
setup_vscode_settings()
print_welcome_message()


def forward(
remote: str,
page: str | None,
Expand Down
Loading