A process remote launcher.
Project description
yassh
This project contains a python library used to run asynchronous and dependent ssh tasks.
Usage
import logging
from yassh import *
logging.basicConfig(level=logging.DEBUG)
r = Reactor()
c1 = Command('cmd1', r, 'localhost', 'user', 'sleep 5')
c2 = Command('cmd2', r, 'localhost', 'user', 'echo ok; sleep 15')
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)
# Stop reactor when cmd3 complete
def quit(): r.stop()
c2.register_exit_monitor(quit)
# Print dummy message when c3 is near terminaison
def on_c3_finished(): print 'c3 almost finished'
c3.register_monitor(u'finished', on_c3_finished)
# Stop reactor when cmd3 complete
c3.register_exit_monitor(quit)
# 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 Distribution
yassh-0.1.0b3.tar.gz
(5.6 kB
view hashes)
Built Distribution
Close
Hashes for yassh-0.1.0b3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82602c384f11586082fd5c9d7b5746aa7dd49920778f8e8eec6d638fed095e5a |
|
MD5 | 11addf8742c5ad063f999b511d70a23e |
|
BLAKE2b-256 | 67f3c3b3c6968d6240746ad41aa22d5405edde5ba5791089ed37cbe7cf1e2822 |