srunx.ssh.cli package#

Submodules#

srunx.ssh.cli.commands module#

Typer-based SSH CLI commands for srunx.

This module provides a clean typer-based interface for SSH SLURM operations, replacing the mixed argparse/typer architecture.

srunx.ssh.cli.commands.setup_logging(verbose=False)[source]#

Configure logging for SSH operations.

srunx.ssh.cli.commands.send_slack_notification(slack_client, message)[source]#

Send a notification to Slack.

Return type:

None

srunx.ssh.cli.commands.submit_job(script_path, host=None, profile=None, hostname=None, username=None, key_file=None, port=22, config=None, ssh_config=None, job_name=None, poll_interval=10, timeout=None, no_monitor=False, no_cleanup=False, env=None, env_local=None, slack=False, verbose=False)[source]#

Submit a SLURM job script to a remote server via SSH.

srunx.ssh.cli.commands.show_logs(job_id, host=None, profile=None, hostname=None, username=None, key_file=None, port=22, config=None, ssh_config=None, follow=False, last=None, job_name=None, verbose=False)[source]#

Display job logs from remote SLURM server via SSH.

srunx.ssh.cli.commands.test_connection(host=None, profile=None, hostname=None, username=None, key_file=None, port=22, config=None, ssh_config=None, verbose=False)[source]#

Test SSH connection and SLURM availability.

srunx.ssh.cli.commands.sync_mount(profile_name=None, mount_name=None, exclude=None, dry_run=False, config=None)[source]#

Sync a mount’s local directory to the remote via rsync.

With no arguments, auto-detects the profile and mount from the current working directory. Works even when inside a subdirectory of the mount.

Examples

srunx ssh sync # auto-detect from cwd srunx ssh sync pyxis ml-project # explicit profile and mount srunx ssh sync pyxis ml-project –dry-run

srunx.ssh.cli.commands.ssh_main(ctx)[source]#

Submit and monitor SLURM jobs on remote servers via SSH.

This command allows you to submit local script files to remote SLURM servers and monitor their execution. It supports SSH config hosts, connection profiles, and direct connections.

Examples

srunx ssh test –host dgx-server srunx ssh submit train.py –host dgx-server srunx ssh submit experiment.sh –profile ml-cluster srunx ssh submit script.py –hostname server.com –username user –key-file ~/.ssh/key

srunx.ssh.cli.commands.list_profiles(config=None)[source]#

List all connection profiles.

srunx.ssh.cli.commands.add_profile(name, ssh_host=None, hostname=None, username=None, key_file=None, port=22, proxy_jump=None, description=None, config=None)[source]#

Add a new connection profile.

srunx.ssh.cli.commands.remove_profile(name, config=None)[source]#

Remove a connection profile.

srunx.ssh.cli.commands.set_current_profile(name, config=None)[source]#

Set the current default profile.

srunx.ssh.cli.commands.show_profile(name=None, config=None)[source]#

Show profile details.

srunx.ssh.cli.commands.update_profile(name, ssh_host=None, hostname=None, username=None, key_file=None, port=None, proxy_jump=None, description=None, config=None)[source]#

Update an existing profile.

srunx.ssh.cli.commands.set_env_var(profile_name, key, value, config=None)[source]#

Set an environment variable for a profile.

srunx.ssh.cli.commands.unset_env_var(profile_name, key, config=None)[source]#

Unset an environment variable for a profile.

srunx.ssh.cli.commands.list_env_vars(profile_name, config=None)[source]#

List environment variables for a profile.

srunx.ssh.cli.commands.mount_add(profile_name, name, local, remote, exclude=None, config=None)[source]#

Add a path mount to a profile.

Return type:

None

srunx.ssh.cli.commands.mount_list(profile_name, config=None)[source]#

List all mounts for a profile.

Return type:

None

srunx.ssh.cli.commands.mount_remove(profile_name, name, config=None)[source]#

Remove a mount from a profile.

Return type:

None

srunx.ssh.cli.main module#

srunx.ssh.cli.main.show_ssh_help()[source]#

Show comprehensive SSH help with examples.

Return type:

None

srunx.ssh.cli.main.run_from_argv(argv)[source]#

Main CLI entry point with clean subcommand routing for ssh integration.

Delegates to profile, test, or submit handlers depending on first arg.

If no arguments provided, shows help with examples.

Return type:

None

srunx.ssh.cli.profile module#

srunx.ssh.cli.profile.handle_profile_command(args)[source]#

Handle profile subcommands with SSH config support

srunx.ssh.cli.profile.cmd_add(args, config_manager)[source]#
srunx.ssh.cli.profile.cmd_remove(args, config_manager)[source]#
srunx.ssh.cli.profile.cmd_list(args, config_manager)[source]#
srunx.ssh.cli.profile.cmd_set(args, config_manager)[source]#
srunx.ssh.cli.profile.cmd_show(args, config_manager)[source]#
srunx.ssh.cli.profile.cmd_update(args, config_manager)[source]#
srunx.ssh.cli.profile.cmd_env(args, config_manager)[source]#

Manage environment variables for a profile

srunx.ssh.cli.profile.cmd_env_set(args, config_manager, profile)[source]#

Set an environment variable for a profile

srunx.ssh.cli.profile.cmd_env_unset(args, config_manager, profile)[source]#

Unset an environment variable for a profile

srunx.ssh.cli.profile.cmd_env_list(args, config_manager, profile)[source]#

List environment variables for a profile

srunx.ssh.cli.profile_impl module#

Profile management implementations for typer-based SSH CLI.

This module contains the actual implementation functions for profile management, separated from the CLI command definitions for better organization.

srunx.ssh.cli.profile_impl.list_profiles_impl(config=None)[source]#

Implementation for listing all profiles.

srunx.ssh.cli.profile_impl.add_profile_impl(name, ssh_host=None, hostname=None, username=None, key_file=None, port=22, proxy_jump=None, description=None, config=None)[source]#

Implementation for adding a new profile.

srunx.ssh.cli.profile_impl.remove_profile_impl(name, config=None)[source]#

Implementation for removing a profile.

srunx.ssh.cli.profile_impl.set_current_profile_impl(name, config=None)[source]#

Implementation for setting the current profile.

srunx.ssh.cli.profile_impl.show_profile_impl(name=None, config=None)[source]#

Implementation for showing profile details.

srunx.ssh.cli.profile_impl.update_profile_impl(name, ssh_host=None, hostname=None, username=None, key_file=None, port=None, proxy_jump=None, description=None, config=None)[source]#

Implementation for updating an existing profile.

srunx.ssh.cli.profile_impl.set_env_var_impl(profile_name, key, value, config=None)[source]#

Implementation for setting an environment variable for a profile.

srunx.ssh.cli.profile_impl.unset_env_var_impl(profile_name, key, config=None)[source]#

Implementation for unsetting an environment variable for a profile.

srunx.ssh.cli.profile_impl.list_env_vars_impl(profile_name, config=None)[source]#

Implementation for listing environment variables for a profile.

srunx.ssh.cli.profile_impl.add_mount_impl(profile_name, name, local, remote, config=None, exclude_patterns=None)[source]#

Implementation for adding a mount to a profile.

Return type:

None

srunx.ssh.cli.profile_impl.list_mounts_impl(profile_name, config=None)[source]#

Implementation for listing mounts for a profile.

Return type:

None

srunx.ssh.cli.profile_impl.remove_mount_impl(profile_name, name, config=None)[source]#

Implementation for removing a mount from a profile.

Return type:

None

srunx.ssh.cli.submit module#

srunx.ssh.cli.submit.send_slack_notification(slack_client, message, color='good')[source]#

Send a notification to Slack.

Return type:

None

srunx.ssh.cli.submit.setup_logging(verbose=False)[source]#
srunx.ssh.cli.submit.run_from_argv(argv)[source]#
Return type:

None

srunx.ssh.cli.test module#

srunx.ssh.cli.test.handle_test_command(argv)[source]#

Handle SSH connection test command.

Return type:

None

Module contents#

Command-line interface modules for srunx SSH utilities.

This package groups CLI entry points and command implementations used to interact with SSH-related functionality in srunx.