def stop(self):
"""
Stop process if it's running.
"""
if self.cleaned:
raise ValueError("Can't call stop on process after cleanup was performed.")
if self.poll() is None:
# process is running
self.terminate()
try:
logger.debug('Waiting for {} process to terminate.'.format(type(self).__name__))
self.wait(timeout=10)
except subprocess.TimeoutExpired:
self.kill()
logger.warning('Process {} killed after unsuccessful termination.'.format(type(self).__name__))
else:
logger.debug('Process {} terminated.'.format(type(self).__name__))
self.update()
评论列表
文章目录