Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16460
| References | <4ED69A1A.3080609@gmail.com> <CABicbJLHtVBwObTkSK_yS9aMZvvdLOAmy-YdMvCJRUhqpwWz5w@mail.gmail.com> <4ED6ABFB.2040808@gmail.com> |
|---|---|
| From | Devin Jeanpierre <jeanpierreda@gmail.com> |
| Date | 2011-11-30 17:41 -0500 |
| Subject | Re: Need some IPC pointers |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3179.1322692937.27778.python-list@python.org> (permalink) |
> Sounds interesting, but I'm not familiar with threading (not that I
> wouldn't be willing to learn).
> Is it even possible to pipe into a running process, though?
You create the pipe to the process when you start it. e.g.
subprocess.Popen(['ls', 'foo'], stdout=subprocess.PIPE,
stdin=subprocess.PIPE)
Irmen de Jong mentions the multiprocessing module, that might be a
better approach. I don't use it for production purposes because it has
bad properties when processes are killed abruptly (it can't tell
necessarily the difference between a truncated message and a normal
message). It doesn't feel safe, you know? (Of course, neither do
threads!)
Devin
On Wed, Nov 30, 2011 at 5:19 PM, Andrew Berg <bahamutzero8825@gmail.com> wrote:
> On 11/30/2011 3:32 PM, Devin Jeanpierre wrote:
>> You could also use threads and pipes. (I'm not actually
>> sure how threads+pipes works, but I'm told that it's a viable
>> approach).
> Sounds interesting, but I'm not familiar with threading (not that I
> wouldn't be willing to learn).
> Is it even possible to pipe into a running process, though?
>
>> For what it's worth, I wrote something potentially similar using Twisted
>> and AMP. AMP is an Asynchronous Messaging Protocol: this basically
>> means that clients and servers can send messages to each other at any
>> time in any order. Twisted makes sure that the right response gets
>> associated with the right message. This can be very convenient -- you
>> might request something from another process, and then to compute its
>> answer it might ask for some additional information from you, and then
>> you give it that information, and it sends back the final result.
>>
>> All the communication is done over TCP, usually using Twisted. So this
>> does involve bringing in a fairly large dependency.
> Sounds like overkill, but I'll take a look.
>
> --
> CPython 3.2.2 | Windows NT 6.1.7601.17640 | Thunderbird 7.0
> --
> http://mail.python.org/mailman/listinfo/python-list
>
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Need some IPC pointers Devin Jeanpierre <jeanpierreda@gmail.com> - 2011-11-30 17:41 -0500
csiph-web