Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #71047

Re: python-daemon interaction with multiprocessing (secure-smtpd)

From Grant Edwards <invalid@invalid.invalid>
Newsgroups comp.lang.python
Subject Re: python-daemon interaction with multiprocessing (secure-smtpd)
Date 2014-05-07 19:11 +0000
Organization PANIX Public Access Internet and UNIX, NYC
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>

Show all headers | 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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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