API Reference#
Sync Module#
Rsync-based file synchronization for remote SLURM servers.
- class srunx.sync.rsync.RsyncResult(returncode, stdout, stderr)[source]#
Bases:
objectResult of an rsync operation.
-
returncode:
int#
-
stdout:
str#
-
stderr:
str#
- property success: bool#
- __init__(returncode, stdout, stderr)#
-
returncode:
- class srunx.sync.rsync.RsyncClient(hostname, username, port=22, key_filename=None, proxy_jump=None, ssh_config_path=None, exclude_patterns=None)[source]#
Bases:
objectRsync wrapper for syncing files to/from remote SLURM servers.
Handles SSH connection options (port, key, ProxyJump, ssh_config) and builds rsync commands with sensible defaults for development workflow synchronization.
-
DEFAULT_EXCLUDES:
ClassVar[list[str]] = ['.git/', '__pycache__/', '.venv/', '*.pyc', '.mypy_cache/', '.pytest_cache/', '.ruff_cache/', '*.egg-info/', '.tox/', 'node_modules/', '.DS_Store']#
- __init__(hostname, username, port=22, key_filename=None, proxy_jump=None, ssh_config_path=None, exclude_patterns=None)[source]#
- push(local_path, remote_path=None, *, delete=True, dry_run=False, exclude_patterns=None)[source]#
Sync a local directory/file to the remote server.
- Parameters:
local_path (
str|Path) – Local file or directory to push.remote_path (
str|None) – Destination path on the remote server. If None, usesget_default_remote_path().delete (
bool) – Remove remote files not present locally (default True).dry_run (
bool) – Perform a trial run with no changes made.exclude_patterns (
list[str] |None) – Additional exclude patterns for this call only.
- Return type:
- Returns:
RsyncResult with returncode, stdout, and stderr.
- pull(remote_path, local_path, *, delete=False, dry_run=False, exclude_patterns=None)[source]#
Sync a remote directory/file to the local machine.
- Parameters:
remote_path (
str) – Source path on the remote server.local_path (
str|Path) – Local destination path.delete (
bool) – Remove local files not present on the remote (default False).dry_run (
bool) – Perform a trial run with no changes made.exclude_patterns (
list[str] |None) – Additional exclude patterns for this call only.
- Return type:
- Returns:
RsyncResult with returncode, stdout, and stderr.
- static get_default_remote_path(local_path=None)[source]#
Derive a default remote workspace path from the git repo or cwd.
- Parameters:
local_path (
str|Path|None) – Optional local directory to derive the project name from. If None, uses the current working directory.- Return type:
str- Returns:
A path like
~/.config/srunx/workspace/<project_name>/.
-
DEFAULT_EXCLUDES: