Instantly share code, notes, and snippets.

@dw /mito.py
Last active Sep 21, 2017

Embed
What would you like to do?
Mitogen (local and remote loop example)
import subprocess
import mitogen
def main(router):
u = router.ssh(hostname='u')
root = router.sudo(via=u, password='x')
for x in xrange(100):
root.call(subprocess.check_call, ['true'])
if __name__ == '__main__' and mitogen.is_master:
import mitogen.utils
mitogen.utils.run_with_router(main)
import subprocess
import mitogen
def x():
for x in xrange(100):
subprocess.check_call(['true'])
def main(router):
u = router.ssh(hostname='u')
root = router.sudo(via=u, password='x')
root.call(x)
if __name__ == '__main__' and mitogen.is_master:
import mitogen.utils
mitogen.utils.run_with_router(main)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment