def loop_forever(self):
try:
while 1:
try:
self.status_changed = False
self.phone_home()
except Exception as e:
self.logger.error('Failed to contact server. %s' % e)
if self.need_restart and not self.container.running_jobs and not self.container.finished_jobs:
print 'Restarting...'
# End current process and launch a new one with the same command line parameters
#os.execvp('python.exe', ['python.exe'] + sys.argv)
exit(3)
if not self.status_changed:
self.cpu_percent = psutil.cpu_percent(interval=self.PHONEHOME_DELAY)
except KeyboardInterrupt:
pass
finally:
print 'Exiting...'
self.notify_exit()
评论列表
文章目录