Limit CPU usage for a script

Solution 1:

Maybe try Python's resource package?

The resource package is basically a wraparound of setrlimit in UNIX. So you can set constrains for CPU/Memory usage, etc.

More about setrlimit in Linux