def burn_cpu(self):
"""Consume REQUEST_CPUTIME_SEC core seconds.
This method consumes REQUEST_CPUTIME_SEC core seconds. If unable to
complete within REQUEST_TIMEOUT_SEC walltime seconds, it times out and
terminates the process.
"""
start_walltime_sec = self.get_walltime()
start_cputime_sec = self.get_user_cputime()
while (self.get_user_cputime() <
start_cputime_sec + REQUEST_CPUTIME_SEC):
self.busy_wait()
if (self.get_walltime() >
start_walltime_sec + REQUEST_TIMEOUT_SEC):
sys.exit(1)
评论列表
文章目录