python API to execute asynchronous remote tasks with ssh
rcontrol is a python library based on paramiko intended to work with remote machines via ssh.
Unlike fabric, it is intended to perform tasks in an asynchronous way, and to work with python >= 2.7 (including python 3).
Please note that this is under development! I am waiting for feedback, ideas and contributors to make this tool evolve.
from rcontrol.ssh import SshSession, ssh_client from rcontrol.core import SessionManager def log(task, line): print("%r: %s" % (task, line)) with SessionManager() as sessions: # create sessions on two hosts sessions.bilbo = SshSession( ssh_client('http://bilbo.domain.com', 'user', 'pwd')) sessions.nazgul = SshSession( ssh_client('http://nazgul.domain.com', 'user', 'pwd')) # run commands in parallel sessions.bilbo.execute("uname -a && sleep 3", on_stdout=log) sessions.nazgul.execute("uname -a && sleep 3", on_stdout=log)
This example just show you how rcontrol looks like. Look at the documentation on http://rcontrol.readthedocs.org/en/latest/ if you’re interested to see more!
pip install -U rcontrol
See the CHANGELOG.rst file.