A remote process launcher.
Project description
yassh
Yassh is a python library used to run asynchronous, dependent remote and local tasks.
Usage
import logging
from yassh import Reactor, RemoteRun, LocalRun
logging.basicConfig(level=logging.DEBUG)
r = Reactor()
c1 = RemoteRun(r, 'localhost', 'user', 'sleep 5')
c2 = LocalRun(r, 'echo ok')
c3 = RemoteRun(r, 'localhost', 'user', 'echo "finished" && sleep 1')
def start_c2():
# Start cmd2 when cmd1 complete
c2.start()
c1.register_exit_monitor(start_c2)
def start_c3():
# Start cmd3 when cmd2 complete
c3.start()
c2.register_monitor(u'ok', start_c3)
def on_c3_finished():
# 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)
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
yassh-0.8.2.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for yassh-0.8.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f317a2a74d2a7590c7b2e882f5e22c2152d8171ee6b9188bd9c040f821b03e05 |
|
MD5 | 516afcf61f460024a49b1f705cc53fa6 |
|
BLAKE2b-256 | fa7ceaa728e31e6bba87d688c04eefcfc760f0eb14c5c5731e4d326b0ddf0bf0 |