Asynchroneous Parallel ssh
Project description
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 theappull
andappush
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 anasynciojob
'sScheduler
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 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 codePull
orPush
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 asasynciojobs'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.
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-script
folder in <https://github.com/fit-r2lab/demos - and in particular the 2 versions named
demo-v1.py
anddemo-v2.py
that 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
File details
Details for the file apssh-0.26.0.tar.gz
.
File metadata
- Download URL: apssh-0.26.0.tar.gz
- Upload date:
- Size: 54.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f59badcb631b14753291b83853a2b5077414746d1c1b350cf5eb366d5d0eb47 |
|
MD5 | d786ddbe078f45e2ccfbe153050831d0 |
|
BLAKE2b-256 | b211f98d87f69776b9e11fd3d91de0d5c035f6ca8dc3bda4571c0020e606000f |
File details
Details for the file apssh-0.26.0-py3-none-any.whl
.
File metadata
- Download URL: apssh-0.26.0-py3-none-any.whl
- Upload date:
- Size: 50.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e39db276d80632719f318bead1e8b73e0ee985e4331f61fc35daa3fa9d527a1b |
|
MD5 | 5e0c8e92fd26e3b11cadf12d0ed1d7ca |
|
BLAKE2b-256 | b3e792650a225b1dc2e10034bbf9facfad0dece730d1bef03f49af0119514930 |