Skip to main content

apssh - asynchronous parallel ssh

what's included ?

This tool leverages the Python asynchronous paradigm and comes with

  • a standalone apssh command for running remote commands on a bunch of hosts in parallel, as well as the appull and appush commands to perform parallel copies, that sysadmins might find useful for their routine jobs,
  • an API with which one can create SshJob objects in conjunction with an asynciojob's Scheduler for orchestrating them.

Please refer to http://apssh.readthedocs.io/ for a complete documentation bundle.

what is nepi-ng ?

Originally, the idea presented here addresses the needs of experimental research, where an experiment often boils down to running jobs like preparing a set of nodes, initializing them, running some bash script, collecting results, all of them having temporal relationships.

To that end, the 2 libraries asynciojobs and apssh complement each other to offer a powerful programing environment that we have branded nepi-ng; its 2 parts are thus:

asynciojobs

asynciojobs is a microscopic orchestration scheduler for asyncio-based jobs - see this link for details. This is the part that handles the temporal relationships.

apssh

apssh ships with a few classes that allow you to write jobs in the asynciojobs sense, that will actually run on ssh:

  • SshNode : describe how to reach a node (possible through a gateway)
  • SshJob : to run one or several remote commands; each of these can be
    • Run : that is designed to run a command readily available on the target node
    • RunScript : when you have a local script file to run remotely, so there is a need to push it over there prior to running it
    • RunString : same idea, but you do not even have a local file, it's just a python string in memory; useful to embed your shell code inside a python code
    • Pull or Push for file transfers over SFTP

As the names may suggest:

  • an SshNode instance contains the details of the target node (hostname, username, gateway if relevant, etc...), and it can be thought of as an ssh connection;
  • SshJob, is suitable to run as asynciojobs's jobs, i.e. inside a scheduler;
  • an SshJob instance contains a list of the actual commands to run, that can be a mix of remote executions and file transfers.

using your ssh config

apssh, appush and appull read ~/.ssh/config (or the file given with -F; use --no-config to ignore it), so that with e.g.

Host fit*
  User root
  ProxyJump gw

apssh -t fit01 -t fit02 uname -a reaches both nodes through a single shared connection to gw. Command-line settings (-g, user@host, -l) take precedence over the config. Note that Host wildcards are matchers: -t 'fit*' is not expanded. Use -n to see how each target gets resolved.

examples

You can see a very simple example of that idea implemented in 2 files

Another, simpler example, illustrates how to take advantage of the YAML loader, see

Metadata

Release files for apssh 0.28.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for apssh 0.28.0
File Size Uploaded Provenance Actions
apssh-0.28.0.tar.gz 768.7 kB Without provenance Details for apssh-0.28.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for apssh 0.28.0
File Interpreter ABI Platform Actions
apssh-0.28.0-py3-none-any.whl Python 3 none any Details for apssh-0.28.0-py3-none-any.whl

Total release size: 822.4 kB

Release files / apssh-0.28.0.tar.gz

Download URL apssh-0.28.0.tar.gz
Size 768.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6b6b8001768cb3386e005ae37fd77b3cf4eabff1f77bd3ae71ed1e370b3d655b
BLAKE2b-256 checksum
How to use checksums
5375db7cede8cbd826023721013ae1cabdad6667a43a81757f04485ccf65d6ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.8

Release files / apssh-0.28.0-py3-none-any.whl

Download URL apssh-0.28.0-py3-none-any.whl
Size 53.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1aa03536744285212957ea5a0c58d725d3d0ddf5554c7e47dfb196df92a70f2b
BLAKE2b-256 checksum
How to use checksums
68e2b0d5e4a540b54f9b6002743f08c274f50b648333cd04778ef574ae0c4739
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.8

Security for apssh 0.28.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.28.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page