本文整理汇总了Python中openquake.logs.LOG.warn方法的典型用法代码示例。如果您正苦于以下问题:Python LOG.warn方法的具体用法?Python LOG.warn怎么用?Python LOG.warn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openquake.logs.LOG
的用法示例。
在下文中一共展示了LOG.warn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: spawn_job_supervisor
# 需要导入模块: from openquake.logs import LOG [as 别名]
# 或者: from openquake.logs.LOG import warn [as 别名]
def spawn_job_supervisor(job_id, pid):
"""
Spawn a supervisor process as configured in openquake.cfg.
:param int job_id: the id of the job to be supervised
:param int pid: the process id of the job to be supervised
:return: the id of the supervisor process or None if no supervisor was
configured
:rtype: int or None
"""
exe = oq_config.get('supervisor', 'exe')
if exe:
if oq_config.get('logging', 'backend') != 'amqp':
LOG.warn('If you want to run supervised jobs it\'s better '
'to set [logging] backend=amqp in openquake.cfg')
if not os.path.isabs(exe):
exe = os.path.join(OPENQUAKE_ROOT, exe)
cmd = [exe, str(job_id), str(pid)]
supervisor_pid = subprocess.Popen(cmd, env=os.environ).pid
job = OqJob.objects.get(id=job_id)
job.supervisor_pid = supervisor_pid
job.job_pid = pid
job.save()
# Ensure the supervisor amqp queue exists
supervisor.bind_supervisor_queue(job_id)
return supervisor_pid
else:
LOG.warn('This job won\'t be supervised, '
'because no supervisor is configured in openquake.cfg')