py-remoteexec / test.py

#!/usr/bin/env python

import socket
import sys

mods = {
    'test1': '\n'.join([
        'import test',
        'import test2',
        'def print_stuff():',
        '  print "Hello from test1"',
        '  print test2.hello',
        '  print test.mods',
        '  test.hostname()',
        ]),
    'test2': '\n'.join([
        'hello = "Hello from test2"',
        ]),
    }

def hostname():
    print socket.gethostname()

if __name__ == '__main__':
    import remoteexec
    p, s = remoteexec.remote_exec(
        hostname=sys.argv[1],
        module_filenames=['test.py', 'remoteexec.py'],
        literal_modules=mods,
        main_func='test1.print_stuff',
        verbose_load=True)
    f = s.makefile('r')
    s.close()
    print f.read()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.