I have a Python
script which spawns a daemon process. Inside the process, I am using multiprocessing.pool
to run 1
to 4
p
Quoting from the documentation of multiprocessing:
daemon
The process’s daemon flag, a Boolean value. This must be set before start() is called.
The initial value is inherited from the creating process.
When a process exits, it attempts to terminate all of its daemonic child processes.
Note that a daemonic process is not allowed to create child processes. Otherwise a daemonic process would leave its children orphaned if it gets terminated when its parent process exits. Additionally, these are not Unix daemons or services, they are normal processes that will be terminated (and not joined) if non-daemonic processes have exited.
Since multiprocessing.Pool
has to create worker processes, you cannot daemonaize a process using it.