graflag.ssh

SSH operations for GraFlag.

class graflag.ssh.SSHManager(manager_ip: str, ssh_port: str = '22', ssh_key: str = None)[source]

Bases: object

Handle SSH operations to remote manager.

execute(command: str, capture_output: bool = True) CompletedProcess[source]

Execute command on manager via SSH.

path_exists(remote_shared_dir: str, path: str) bool[source]

Check if path exists on remote manager.

read_file(remote_shared_dir: str, path: str) str[source]

Read file content from remote manager.

mkdir(remote_shared_dir: str, path: str) bool[source]

Create directory on remote manager.

list_dir(remote_shared_dir: str, path: str) List[str][source]

List directory contents on remote manager.

copy_files(source_paths, dest_path: str, recursive: bool = False, from_remote: bool = False) str[source]

Copy files/directories bidirectionally via rsync.

Parameters:
  • source_paths – Source path(s) - can be single string or list

  • dest_path – Destination path

  • recursive – Include recursive flag (automatically added for directories)

  • from_remote – If True, copy from remote to local; if False (default), copy from local to remote

Returns:

Destination path