Change process's name from multiprocess.Pool name on the fly or get PID of which process is submitted

Viewed 27

Is there any method to change the process's name from a pool of processes on the fly? More exactly when submitting the execution through apply_async?

Mention: The subprocess is running in a while True loop, so it's alive.

Eg:

Change from:

<SpawnProcess name='SpawnPoolWorker-4' pid=17680 parent=34172 started daemon>

to

<SpawnProcess name='Custom_Name' pid=17680 parent=34172 started daemon>

Or can I get the PID of the which process from the pool has been assigned?

I know it can be changed through initializer when creating the pool but I want on the fly depending on the input I receive to set the name of it and then loop through multiprocess.active_children to determine the PID.

Thank you!

0 Answers
Related