python - Resource limits on Windows? -


what windows equivalents resource limit mechanisms exposed on unix systems python's resource module, , posix setrlimit?

specifically, i'm limiting processor time child process several seconds. if hasn't completed within constraint, it's terminated.

afaik, there no portable way of getting information amount of processor time used child process in python. subprocess module (assuming you're starting child subprocess.popen, recommended) give process id of child process in popen.pid. on windows run tasklist (see manual) using subprocess.check_output repeatedly , extract info child proces output, using pid filter.

as child process has has enough cpu time , if used subprocess.popen() start child process, use popen.kill method kill it.

but think easier kill child process after after specified number of seconds of wall time using timer. because if child process hangs without using cpu time (for whatever reason), python program waiting consume cpu time.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -