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

Already on GitHub? Sign in to your account

Transition mila init to RemoteV2 #110

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
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
59 changes: 12 additions & 47 deletions milatools/cli/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,11 @@
import rich.logging
from typing_extensions import TypedDict

from milatools.__version__ import __version__
from milatools.cli import console
from milatools.utils.local_v1 import LocalV1
from milatools.utils.remote_v1 import RemoteV1, SlurmRemote
from milatools.utils.remote_v2 import RemoteV2
from milatools.utils.vscode_utils import (
get_code_command,
# install_local_vscode_extensions_on_remote,
sync_vscode_extensions,
sync_vscode_extensions_with_hostnames,
)

from ..__version__ import __version__
from .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,
)
from .profile import ensure_program, setup_profile
from .utils import (
from milatools.cli.init import init
from milatools.cli.profile import ensure_program, setup_profile
from milatools.cli.utils import (
CLUSTERS,
Cluster,
CommandNotFoundError,
Expand All @@ -69,6 +52,14 @@
running_inside_WSL,
with_control_file,
)
from milatools.utils.local_v1 import LocalV1
from milatools.utils.remote_v1 import RemoteV1, SlurmRemote
from milatools.utils.remote_v2 import RemoteV2
from milatools.utils.vscode_utils import (
get_code_command,
sync_vscode_extensions,
sync_vscode_extensions_with_hostnames,
)

if typing.TYPE_CHECKING:
from typing_extensions import Unpack
Expand Down Expand Up @@ -492,32 +483,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()

# 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)

success = setup_passwordless_ssh_access(ssh_config=ssh_config)
if not success:
exit()
setup_keys_on_login_node()
setup_vscode_settings()
print_welcome_message()


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