本文整理汇总了Python中scalrpy.LOG.critical方法的典型用法代码示例。如果您正苦于以下问题:Python LOG.critical方法的具体用法?Python LOG.critical怎么用?Python LOG.critical使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scalrpy.LOG
的用法示例。
在下文中一共展示了LOG.critical方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __call__
# 需要导入模块: from scalrpy import LOG [as 别名]
# 或者: from scalrpy.LOG import critical [as 别名]
def __call__(self):
poller_ps, plotter_ps = None, None
if self.args['--plotter']:
plotter = Plotter(self.config)
plotter_ps = plotter.run_in_process()
time.sleep(5)
if not plotter_ps.is_alive():
LOG.critical('Failed to start CherryPy web server')
sys.exit(1)
self.change_permissions()
if self.args['--poller']:
poller = Poller(self.config, self.scalr_config)
while True:
start_time = time.time()
try:
LOG.info('Start poller iteration')
rrdcached_sock_file = self.config['rrd']['rrdcached_sock_path']
if not os.path.exists(rrdcached_sock_file):
raise Exception('rrdcached process is not running')
poller_ps = poller.run_in_process()
poller_ps.join(self.config['interval'] * 2)
if poller_ps.is_alive():
LOG.error('Poller iteration timeout. Terminating')
try:
poller_ps.terminate()
except:
msg = 'Unable to terminate, reason: {error}'.format(
error=helper.exc_info())
raise Exception(msg)
LOG.info('Poller iteration time: %.2f' % (time.time() - start_time))
except KeyboardInterrupt:
raise
except:
msg = 'Poller iteration failed, reason: {error}'.format(
error=helper.exc_info())
LOG.error(msg)
finally:
sleep_time = start_time + self.config['interval'] - time.time() - 0.1
if sleep_time > 0:
time.sleep(sleep_time)
if plotter_ps:
plotter_ps.join()