yassh
Yassh is a python library used to run asynchronous, dependent remote and local tasks.
Usage
import logging
from yassh import Reactor, RemoteRun, RemoteConfiguration, LocalRun
logging.basicConfig(level=logging.DEBUG)
# Create a remote ; only host parameter is mandatory
remote = RemoteConfiguration(host='localhost', username='user')
# ssh_config(5) options can be set in RemoteConfiguration object
remote.set('Compression', 'yes')
remote.set('CompressionLevel', '9')
r = Reactor()
c1 = RemoteRun(r, remote, 'sleep 5')
c2 = LocalRun(r, 'echo ok')
c3 = RemoteRun(r, remote, 'echo "finished" && sleep 1')
def start_c2(run):
# Start cmd2 when cmd1 complete successfully
if run.result == 0:
c2.start()
c1.register_exit_monitor(start_c2)
def start_c3(run):
# Start cmd3 when cmd2 complete
c3.start()
c2.register_monitor(u'ok', start_c3)
def on_c3_finished(run):
# Print dummy message when c3 is near terminaison
print('c3 almost finished')
c3.register_monitor(u'finished', on_c3_finished)
# Start first task
c1.start()
# Infinite
timeout = -1
while r.run(timeout) > 0:
pass
Installation
To install latest release:
pip install yassh
To install latest code:
pip install git+https://github.com/enyx-opensource/yassh.git
Testing
Run from project root:
behave
License
MIT License (see LICENSE)
Release files for yassh 2.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| yassh-2.0.3.tar.gz | 6.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yassh-2.0.3-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 15.6 kB
Release files / yassh-2.0.3.tar.gz
| Download URL | yassh-2.0.3.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f5e2979dfef09a713ac9c25ca41b8f96a4842360859d1b374213f7739f4b7238
|
|
BLAKE2b-256 checksum How to use checksums |
22e7a4bede1846edf63bfe0d3373109390346f1421b88a94fdec11f868b71db9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.15
|
Release files / yassh-2.0.3-py2.py3-none-any.whl
| Download URL | yassh-2.0.3-py2.py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
dbcf11973bc15499af6bd85afacc36fb261fd1dd9bc0357d1b88fe6c8c2abbfb
|
|
BLAKE2b-256 checksum How to use checksums |
f59aff72d7fbbe20c614fb8ff2e8a28dfd4f2b4fc487ba5d037b6db84781b703
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.15
|