Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71047
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!bloom-beacon.mit.edu!panix!not-for-mail |
|---|---|
| From | Grant Edwards <invalid@invalid.invalid> |
| Newsgroups | comp.lang.python |
| Subject | Re: python-daemon interaction with multiprocessing (secure-smtpd) |
| Date | Wed, 7 May 2014 19:11:37 +0000 (UTC) |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Lines | 38 |
| Message-ID | <lke0h9$7ts$1@reader1.panix.com> (permalink) |
| References | <lkdp2i$s9c$1@reader1.panix.com> <lkds31$dqv$1@reader1.panix.com> <mailman.9747.1399489328.18130.python-list@python.org> |
| NNTP-Posting-Host | dsl.comtrol.com |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | reader1.panix.com 1399489897 8124 64.122.56.22 (7 May 2014 19:11:37 GMT) |
| X-Complaints-To | abuse@panix.com |
| NNTP-Posting-Date | Wed, 7 May 2014 19:11:37 +0000 (UTC) |
| User-Agent | slrn/1.0.1 (Linux) |
| Xref | csiph.com comp.lang.python:71047 |
Show key headers only | View raw
On 2014-05-07, Ben Finney <ben@benfinney.id.au> wrote:
> Grant Edwards <invalid@invalid.invalid> writes:
>
>> On 2014-05-07, Grant Edwards <invalid@invalid.invalid> wrote:
>> > How do you terminate a Python program that's using multiprocessing?
>>
>> It looks like you have to kill all the threads individually. :/
>
> As I understand it, the ‘multiprocessing’ module
><URL:https://docs.python.org/3/library/multiprocessing.html> does not
> create multiple threads; it creates multiple processes.
Right. I should have written processes rather than threads.
> It also closely follows the API for the ‘threading’ module. That
> includes the ability to manage a pool of workers
><URL:https://docs.python.org/3/library/multiprocessing.html#module-multiprocessing.pool>.
Except when you kill the parent of a bunch of threads, they all get
killed. That doesn't seem to be the case for multiprocessing.
> You can ask the pool of workers to close when they're done
><URL:https://docs.python.org/3/library/multiprocessing.html#multiprocessing.pool.Pool.close>.
> Does that address the requirement?
I'm not sure. It's not really my code that's creating and managing
the pool: that's happening inside the secure-smtpd module from
https://github.com/bcoe/secure-smtpd. There's a little bit of wrapper
code that configures the server and then starts it -- after that I
don't have much control over anything.
Mainly, I'm just trying to figure out the right way to terminate the
server from an /etc/init script.
--
Grant Edwards grant.b.edwards Yow! We're going to a
at new disco!
gmail.com
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
python-daemon interaction with multiprocessing (secure-smtpd) Grant Edwards <invalid@invalid.invalid> - 2014-05-07 17:04 +0000
Re: python-daemon interaction with multiprocessing (secure-smtpd) Grant Edwards <invalid@invalid.invalid> - 2014-05-07 17:55 +0000
Re: python-daemon interaction with multiprocessing (secure-smtpd) Ben Finney <ben@benfinney.id.au> - 2014-05-08 05:01 +1000
Re: python-daemon interaction with multiprocessing (secure-smtpd) Grant Edwards <invalid@invalid.invalid> - 2014-05-07 19:11 +0000
Re: python-daemon interaction with multiprocessing (secure-smtpd) Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2014-05-07 21:45 +0200
Re: python-daemon interaction with multiprocessing (secure-smtpd) Grant Edwards <invalid@invalid.invalid> - 2014-05-07 21:07 +0000
csiph-web