I'm running Centos 7 and Python 3.6.
I have a python script that uses multi-treading.
I want to renice or change the niceness value for all of the treads the script spawns.
At present, I am able to change the niceness value of the parent process using the command below.
while read -r pid; do renice -n -20 "$pid" ; done < <(ps -o pid= -C "python /path/script.py")
Then, when I use htop to view the status of the scripts processes, only the parent process shows the updated or 'reniced' value.
The 'child' processes all show the standard nice value (I can manually change these using the F7 key in htop)
I have found a few similar questions here and on the web and I have tried the solutions suggested, but these do not seem to work on Centos 7 so they maybe distro specific.
Please can anyone point me in the right direction on how to amend the above command to be able to renice the parent and child processes at the same time or if there is a better solution I should use, then I'm happy to try it.
*** Please note that the script is running in a Centos 7 docker container on a Centos 7 host. I am unable to start the script in the container with the nice value I want due to permission issues in docker, so I want to renice the script process on the host, which I can do using the above process.