Asynchroneous Parallel ssh
Project description
apssh - asynchronous parallel ssh
what's included ?
This tool leverages the Python asynchronous paradigm and comes with
- a standalone
apsshcommand for running remote commands on a bunch of hosts in parallel, as well as theappullandappushcommands to perform parallel copies, that sysadmins might find useful for their routine jobs, - an API with which one can create
SshJobobjects in conjunction with anasynciojob'sSchedulerfor 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 beRun: that is designed to run a command readily available on the target nodeRunScript: when you have a local script file to run remotely, so there is a need to push it over there prior to running itRunString: 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 codePullorPushfor file transfers over SFTP
As the names may suggest:
- an
SshNodeinstance 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 asasynciojobs'sjobs, i.e. inside a scheduler;- an
SshJobinstance contains a list of the actual commands to run, that can be a mix of remote executions and file transfers.
examples
You can see a very simple example of that idea implemented in 2 files
- the python code
- and the related shell script
- plus, a summary of the objects involved is depicted in this figure
Another, simpler example, illustrates how to take advantage of the YAML loader, see
- the
my-first-nepi-ng-scriptfolder in <https://github.com/fit-r2lab/demos - and in particular the 2 versions named
demo-v1.pyanddemo-v2.pythat implement the exact same behaviour but that use- a pure Python approach (v1)
- the YAML loader (v2)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file apssh-0.27.0.tar.gz.
File metadata
- Download URL: apssh-0.27.0.tar.gz
- Upload date:
- Size: 765.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
946cec33c7d32df74302e2666d49d2a86cc9ee664d05e4c27f9dbcd6e04d39cc
|
|
| MD5 |
f0186587a79b15e1de8ada6a740a1691
|
|
| BLAKE2b-256 |
c814351c05d436e0d6fdb06ad0ee0aec6adafb50a64ff8e79736b76e5b045440
|
File details
Details for the file apssh-0.27.0-py3-none-any.whl.
File metadata
- Download URL: apssh-0.27.0-py3-none-any.whl
- Upload date:
- Size: 50.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48916aa38e00195d44dd40f550c59d0c5c16e28076160d4d78a38d2d3de81948
|
|
| MD5 |
b2ef3c8f8f69b5be0589ac4566bc9784
|
|
| BLAKE2b-256 |
41f3015db8d254587575fc8312a3a6b40e7ffae6f2d56c0e72802c4e7b5ba538
|