efro.cloudshell
My nifty ssh/mosh/rsync mishmash.
1# Released under the MIT License. See LICENSE for details. 2# 3"""My nifty ssh/mosh/rsync mishmash.""" 4 5from __future__ import annotations 6 7from enum import Enum 8from dataclasses import dataclass 9 10from efro.dataclassio import ioprepped 11 12 13class LockType(Enum): 14 """Types of locks that can be acquired on a host.""" 15 16 HOST = 'host' 17 WORKSPACE = 'workspace' 18 PYCHARM = 'pycharm' 19 CLION = 'clion' 20 21 22@ioprepped 23@dataclass 24class HostConfig: 25 """Config for a cloud machine to run commands on. 26 27 precommand, if set, will be run before the passed commands. 28 Note that it is not run in interactive mode (when no command is given). 29 """ 30 31 address: str | None = None 32 user: str = 'ubuntu' 33 port: int = 22 34 mosh_port: int | None = None 35 mosh_server_path: str | None = None 36 mosh_shell: str = 'sh' 37 workspaces_root: str = '/home/${USER}/cloudshell_workspaces' 38 sync_perms: bool = True 39 precommand: str | None = None 40 managed: bool = False 41 idle_minutes: int = 5 42 can_sudo_reboot: bool = False 43 max_sessions: int = 4 44 reboot_wait_seconds: int = 20 45 reboot_attempts: int = 1 46 47 def resolved_workspaces_root(self) -> str: 48 """Returns workspaces_root with standard substitutions.""" 49 return self.workspaces_root.replace('${USER}', self.user)
class
LockType(enum.Enum):
14class LockType(Enum): 15 """Types of locks that can be acquired on a host.""" 16 17 HOST = 'host' 18 WORKSPACE = 'workspace' 19 PYCHARM = 'pycharm' 20 CLION = 'clion'
Types of locks that can be acquired on a host.
HOST =
<LockType.HOST: 'host'>
WORKSPACE =
<LockType.WORKSPACE: 'workspace'>
PYCHARM =
<LockType.PYCHARM: 'pycharm'>
CLION =
<LockType.CLION: 'clion'>
Inherited Members
- enum.Enum
- name
- value
@ioprepped
@dataclass
class
HostConfig:
23@ioprepped 24@dataclass 25class HostConfig: 26 """Config for a cloud machine to run commands on. 27 28 precommand, if set, will be run before the passed commands. 29 Note that it is not run in interactive mode (when no command is given). 30 """ 31 32 address: str | None = None 33 user: str = 'ubuntu' 34 port: int = 22 35 mosh_port: int | None = None 36 mosh_server_path: str | None = None 37 mosh_shell: str = 'sh' 38 workspaces_root: str = '/home/${USER}/cloudshell_workspaces' 39 sync_perms: bool = True 40 precommand: str | None = None 41 managed: bool = False 42 idle_minutes: int = 5 43 can_sudo_reboot: bool = False 44 max_sessions: int = 4 45 reboot_wait_seconds: int = 20 46 reboot_attempts: int = 1 47 48 def resolved_workspaces_root(self) -> str: 49 """Returns workspaces_root with standard substitutions.""" 50 return self.workspaces_root.replace('${USER}', self.user)
Config for a cloud machine to run commands on.
precommand, if set, will be run before the passed commands. Note that it is not run in interactive mode (when no command is given).
HostConfig( address: str | None = None, user: str = 'ubuntu', port: int = 22, mosh_port: int | None = None, mosh_server_path: str | None = None, mosh_shell: str = 'sh', workspaces_root: str = '/home/${USER}/cloudshell_workspaces', sync_perms: bool = True, precommand: str | None = None, managed: bool = False, idle_minutes: int = 5, can_sudo_reboot: bool = False, max_sessions: int = 4, reboot_wait_seconds: int = 20, reboot_attempts: int = 1)