A remote process launcher.
Project description
yassh
This project contains a python library used to run asynchronous and dependent ssh tasks.
Usage
import logging
from yassh import Reactor, Command
logging.basicConfig(level=logging.DEBUG)
r = Reactor()
c1 = Command('cmd1', r, 'localhost', 'user', 'sleep 5')
c2 = Command('cmd2', r, 'localhost', 'user', 'echo ok')
c3 = Command('cmd3', r, 'localhost', 'user', 'echo "finished" && sleep 1')
# Start cmd2 when cmd1 complete
def start_c2(): c2.start()
c1.register_exit_monitor(start_c2)
# Start cmd3 when cmd2 complete
def start_c3(): c3.start()
c2.register_monitor(u'ok', start_c3)
# Print dummy message when c3 is near terminaison
def on_c3_finished(): print 'c3 almost finished'
c3.register_monitor(u'finished', on_c3_finished)
# Start first task
c1.start()
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-SA/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 Distributions
yassh-0.4.1b1.tar.gz
(5.4 kB
view hashes)
Close
Hashes for yassh-0.4.1b1.linux-x86_64.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a49aa149445c210fc6c11f52912dfcd6b3c33fa29b4335b25c3512b47742690 |
|
MD5 | ce7a71d958783eac52b9af0a14b3dbdc |
|
BLAKE2b-256 | 0c5fda2353229bee2828e9a9558d21507ec0a8929a4f07c535e735e488b3b188 |