Extending remote subprocess.Popen class from rpyc client

23 views
Skip to first unread message

M S Vishwanath Bhat

unread,
Jan 22, 2015, 4:09:54 AM1/22/15
to rp...@googlegroups.com
Hi,

I am quite inexperienced in Object Oriented concepts and I'm learning OOP concepts of python and trying to apply it.

Is it really possible to extend the subprocess.Popen class of remote machines? I am using zero-deploy and can't have my custom services in remote nodes.

Any help/pointer is appreciated.

Thanks,
MS

Tomer Filiba

unread,
Jan 22, 2015, 4:23:13 AM1/22/15
to rpyc
first of all you can execute code remotely, e.g.,

conn.execute(""
class Foo(subprocess.Popen):
    ...
""")

or send files (rpyc.upload) and import them.

but i can recommend not trying to extend classes. i find the OO model very weak, and would prefer to build "stacks" of objects wrapping one another (much more composable).
you can have a look at https://plumbum.readthedocs.org/en/latest/ -- another library of mine and see how it's done there (or just use it :))


-tomer


-----------------------------------------------------------------
    
Tomer Filiba 
tomerfiliba.com        

--

---
You received this message because you are subscribed to the Google Groups "rpyc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rpyc+uns...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

M S Vishwanath Bhat

unread,
Jan 22, 2015, 6:45:51 AM1/22/15
to rp...@googlegroups.com
On 22 January 2015 at 14:53, Tomer Filiba <tomer...@gmail.com> wrote:
first of all you can execute code remotely, e.g.,

conn.execute(""
class Foo(subprocess.Popen):
    ...
""")

or send files (rpyc.upload) and import them.
Thanks Tomer for the reply.
 

but i can recommend not trying to extend classes. i find the OO model very weak, and would prefer to build "stacks" of objects wrapping one another (much more composable).
you can have a look at https://plumbum.readthedocs.org/en/latest/ -- another library of mine and see how it's done there (or just use it :))

TBH I want to implement a method/property called value to subprocess.Popen, just to be compatible with my existing code. My existing code is using .value property of AsyncResult (returned by rpyc.async). Now henceforth I will be using a Popen object where .value method/property is not present. So I wanted to extend Popen just to make sure that existing code does not break.

If you have any idea to add a new property to Popen, please let me know. Thanks in advance.

Best Regards,
MS


-tomer


-----------------------------------------------------------------
    
Tomer Filiba 
tomerfiliba.com        

On Thu, Jan 22, 2015 at 11:09 AM, M S Vishwanath Bhat <msv...@gmail.com> wrote:
Hi,

I am quite inexperienced in Object Oriented concepts and I'm learning OOP concepts of python and trying to apply it.

Is it really possible to extend the subprocess.Popen class of remote machines? I am using zero-deploy and can't have my custom services in remote nodes.

Any help/pointer is appreciated.

Thanks,
MS

--

---
You received this message because you are subscribed to the Google Groups "rpyc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rpyc+uns...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--

---
You received this message because you are subscribed to a topic in the Google Groups "rpyc" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rpyc/Yu7aYGaptBU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rpyc+uns...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages