Python – How to name the processes in a multiprocessing.pool


If I create a pool with 4 workers and set them to do some task (using pool.apply_async(..)), I can access the name of each process from within using multiprocessing.current_process().name, but how do I set the name from the parent process (this is mostly for logging)?

Best Solution is just a setter, you can freely assign to it.

The Pool takes an initializer argument. This can be any callable, and it'll be called once when each subprocess starts up. You can point this to a function that sets the name property of that process to whatever you want.