[Python-il] remote execution of python code

Dov Grobgeld dov.grobgeld at gmail.com
Thu Jul 22 10:52:40 IDT 2010


Here is another idea that hasn't been raised.

On the remote host use sshfs to mount the disk of the invoking host and then
just cd to the directory of the source code and run your code the code.

(In case your invoking host is not accessible due to a firewall you can
easily get around this by doing:

     ssh -R1234:localhost:22 remote

and then on remote invoke sshfs through:

    sshfs -p 1234 localhost /home/foo/mnt/bar
)


Regards,
Dov

On Thu, Jul 22, 2010 at 09:47, Amit Dor-Shifer <amitds at oversi.com> wrote:

>  I wish to execute some python code on a remote host, accessed via SSH. The
> module containing the code is available locally, but not on the remote host.
> I can copy the code over to the remote host, and execute it there, but I was
> wondering whether there's some programmatic alternative to that: E.G:
>
>    1. wrap the code in a method,
>     2. extract the method via an object's __dict__
>     3. Serialize the method over to the remote host
>     4. execute result on a remote python interpreter.
>
> Or:
>
>    1. Somehow retrieve the source lines of the method.
>    2. pass those to a remote "python -c" execution.
>
>
> Are such options available in python?
>
> Amit
>
> _______________________________________________
> Python-il mailing list
> Python-il at hamakor.org.il
> http://hamakor.org.il/cgi-bin/mailman/listinfo/python-il
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://hamakor.org.il/pipermail/python-il/attachments/20100722/41d751af/attachment.htm 


More information about the Python-il mailing list