When my longer-running programm starts, I want to lower its priority so it does not consume all resources avaiable on the machine it runs. Circumstances make it necessary that the programm limits itself.
Is there a nice-like python-command I could use so that the programm does not utilize the full capacity of the computer it is running on?
you can always run the process with
nice pythonscript,but if you want to set the nice-level within the script you can do:
You could progressively increment the nice level the longer the script is running, so it uses less and less resources over time, which is a simple matter of integrating it into the script.
Alternatively, from outside the script, once it’s running you should be able to use
renice -p <pid>