Skip to content

Commit

Permalink
minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Al-Saffar committed Jul 16, 2024
1 parent d07b315 commit 7a1106f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion myresources/crocodile/cluster/templates/run_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def run_on_remote():
config = RemoteMachineConfig(
# connection
# ssh_obj=SelfSSH(), # overrides ssh_params
ssh_params=dict(host="thinkpad"), # dict(host="239wsl"),
ssh_params=dict(host="ts"), # dict(host="239wsl"),
description="Description of running an expensive function", # job_id=, base_dir="",
# data
copy_repo=False, update_repo=True, install_repo=False, update_essential_repos=True, data=data, transfer_method="sftp",
Expand Down
3 changes: 1 addition & 2 deletions myresources/crocodile/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ def get_header(wdir: OPLike, toolbox: bool): return f"""

class SSH: # inferior alternative: https://github.com/fabric/fabric
def __init__(self, host: Optional[str] = None, username: Optional[str] = None, hostname: Optional[str] = None, sshkey: Optional[str] = None, pwd: Optional[str] = None, port: int = 22, ve: Optional[str] = "ve", compress: bool = False): # https://stackoverflow.com/questions/51027192/execute-command-script-using-different-shell-in-ssh-paramiko
# self.tmate_sess = tmate_sess
self.pwd = pwd
self.ve = ve
self.compress = compress # Defaults: (1) use localhost if nothing provided.
Expand Down Expand Up @@ -363,7 +362,7 @@ def view_bar(slf: Any, a: Any, b: Any):
self.platform = platform
self.remote_env_cmd = rf"""~/venvs/{self.ve}/Scripts/Activate.ps1""" if self.get_remote_machine() == "Windows" else rf"""source ~/venvs/{self.ve}/bin/activate"""
self.local_env_cmd = rf"""~/venvs/{self.ve}/Scripts/Activate.ps1""" if self.platform.system() == "Windows" else rf"""source ~/venvs/{self.ve}/bin/activate""" # works for both cmd and pwsh
def __getstate__(self): return {attr: self.__getattribute__(attr) for attr in ["username", "hostname", "host", "tmate_sess", "port", "sshkey", "compress", "pwd", "ve"]}
def __getstate__(self): return {attr: self.__getattribute__(attr) for attr in ["username", "hostname", "host", "port", "sshkey", "compress", "pwd", "ve"]}
def __setstate__(self, state: dict[str, Any]): SSH(**state)
def get_remote_machine(self) -> MACHINE:
if self._remote_machine is None:
Expand Down

0 comments on commit 7a1106f

Please sign in to comment.