# `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](https://github.com/parmentelat/asynciojobs/blob/master/README.md).
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.
## examples
You can see a very simple example of that idea implemented in 2 files
* [the python code](https://github.com/fit-r2lab/r2lab-demos/blob/master/orion/angle-measure.py)
* and [the related shell script](https://github.com/fit-r2lab/r2lab-demos/blob/master/orion/angle-measure.sh)
* plus, a summary of the objects involved [is depicted in this
figure](https://github.com/fit-r2lab/r2lab-demos/blob/master/orion/jobs.png)
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](https://github.com/fit-r2lab/r2lab-demos/tree/master/my-first-nepi-ng-script)
* and in particular the 2 versions named `demo-v1.py` and `demo-v2.py` that
implement the exact same behaviour but that use
* a pure Python approach (v1)
* the YAML loader (v2)
Raw data
{
"_id": null,
"home_page": null,
"name": "apssh",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.5",
"maintainer_email": null,
"keywords": "asyncio, remote shell, parallel ssh",
"author": "Thierry Parmentelat",
"author_email": "thierry.parmentelat@inria.fr",
"download_url": "https://files.pythonhosted.org/packages/b2/11/f98d87f69776b9e11fd3d91de0d5c035f6ca8dc3bda4571c0020e606000f/apssh-0.26.0.tar.gz",
"platform": null,
"description": "# `apssh` - asynchronous parallel ssh\n\n## what's included ?\n\nThis tool leverages the Python asynchronous paradigm and comes with\n\n* a standalone `apssh` command for running remote commands on a bunch of hosts\n in parallel, as well as the `appull` and `appush` commands to perform parallel\n copies, that sysadmins might find useful for their routine jobs,\n* an API with which one can create **`SshJob`** objects\n in conjunction with an `asynciojob`'s **`Scheduler`** for\n **orchestrating** them.\n\nPlease refer to <http://apssh.readthedocs.io/> for a complete documentation bundle.\n\n## what is `nepi-ng` ?\n\nOriginally, the idea presented here addresses the needs of experimental\nresearch, where an experiment often boils down to running jobs like preparing a\nset of nodes, initializing them, running some bash script, collecting results,\nall of them having temporal relationships.\n\nTo that end, the 2 libraries `asynciojobs` and `apssh` complement each other\nto offer a powerful programing environment that we have branded `nepi-ng`; its 2 parts are thus:\n\n## `asynciojobs`\n`asynciojobs` is a microscopic orchestration scheduler for asyncio-based jobs -\n[see this link for\ndetails](https://github.com/parmentelat/asynciojobs/blob/master/README.md).\nThis is the part that handles the temporal relationships.\n\n## `apssh`\n\n`apssh` ships with a few classes that allow you to write jobs in the\n`asynciojobs` sense, that will actually run on ssh:\n\n* `SshNode` : describe how to reach a node (possible through a gateway)\n* `SshJob` : to run one or several remote commands; each of these can be\n * `Run` : that is designed to run a command readily available on the target\n node\n * `RunScript` : when you have a local script file to run remotely, so there is\n a need to push it over there prior to running it\n * `RunString` : same idea, but you do not even have a local file, it's just a\n python string in memory; useful to embed your shell code inside a python\n code\n * `Pull` or `Push` for file transfers over SFTP\n\nAs the names may suggest:\n\n* an `SshNode` instance contains the details of the target node (hostname,\n username, gateway if relevant, etc...), and it can be thought of as an ssh\n connection;\n* `SshJob`, is suitable to run as `asynciojobs's` jobs, i.e. inside a scheduler;\n* an `SshJob` instance contains a list of the actual commands to run, that can\n be a mix of remote executions and file transfers.\n\n## examples\n\nYou can see a very simple example of that idea implemented in 2 files\n\n* [the python code](https://github.com/fit-r2lab/r2lab-demos/blob/master/orion/angle-measure.py)\n* and [the related shell script](https://github.com/fit-r2lab/r2lab-demos/blob/master/orion/angle-measure.sh)\n* plus, a summary of the objects involved [is depicted in this\n figure](https://github.com/fit-r2lab/r2lab-demos/blob/master/orion/jobs.png)\n\nAnother, simpler example, illustrates how to take advantage of the YAML loader, see\n\n* [the `my-first-nepi-ng-script` folder in\n <https://github.com/fit-r2lab/demos](https://github.com/fit-r2lab/r2lab-demos/tree/master/my-first-nepi-ng-script)\n* and in particular the 2 versions named `demo-v1.py` and `demo-v2.py` that\n implement the exact same behaviour but that use\n * a pure Python approach (v1)\n * the YAML loader (v2)\n",
"bugtrack_url": null,
"license": "CC BY-SA 4.0",
"summary": "Asynchroneous Parallel ssh",
"version": "0.26.0",
"project_urls": {
"documentation": "http://apssh.readthedocs.io/",
"source": "http://github.com/parmentelat/apssh"
},
"split_keywords": [
"asyncio",
" remote shell",
" parallel ssh"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b3e792650a225b1dc2e10034bbf9facfad0dece730d1bef03f49af0119514930",
"md5": "5e0c8e92fd26e3b11cadf12d0ed1d7ca",
"sha256": "e39db276d80632719f318bead1e8b73e0ee985e4331f61fc35daa3fa9d527a1b"
},
"downloads": -1,
"filename": "apssh-0.26.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5e0c8e92fd26e3b11cadf12d0ed1d7ca",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.5",
"size": 50451,
"upload_time": "2024-07-09T15:48:26",
"upload_time_iso_8601": "2024-07-09T15:48:26.585552Z",
"url": "https://files.pythonhosted.org/packages/b3/e7/92650a225b1dc2e10034bbf9facfad0dece730d1bef03f49af0119514930/apssh-0.26.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b211f98d87f69776b9e11fd3d91de0d5c035f6ca8dc3bda4571c0020e606000f",
"md5": "d786ddbe078f45e2ccfbe153050831d0",
"sha256": "7f59badcb631b14753291b83853a2b5077414746d1c1b350cf5eb366d5d0eb47"
},
"downloads": -1,
"filename": "apssh-0.26.0.tar.gz",
"has_sig": false,
"md5_digest": "d786ddbe078f45e2ccfbe153050831d0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5",
"size": 54430,
"upload_time": "2024-07-09T15:48:28",
"upload_time_iso_8601": "2024-07-09T15:48:28.453721Z",
"url": "https://files.pythonhosted.org/packages/b2/11/f98d87f69776b9e11fd3d91de0d5c035f6ca8dc3bda4571c0020e606000f/apssh-0.26.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-09 15:48:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "parmentelat",
"github_project": "apssh",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "apssh"
}