本文整理汇总了Python中cylc.flow.LOG.log方法的典型用法代码示例。如果您正苦于以下问题:Python LOG.log方法的具体用法?Python LOG.log怎么用?Python LOG.log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cylc.flow.LOG
的用法示例。
在下文中一共展示了LOG.log方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _kill_task_job_callback
# 需要导入模块: from cylc.flow import LOG [as 别名]
# 或者: from cylc.flow.LOG import log [as 别名]
def _kill_task_job_callback(self, suite, itask, cmd_ctx, line):
"""Helper for _kill_task_jobs_callback, on one task job."""
ctx = SubProcContext(self.JOBS_KILL, None)
ctx.out = line
try:
ctx.timestamp, _, ctx.ret_code = line.split("|", 2)
except ValueError:
ctx.ret_code = 1
ctx.cmd = cmd_ctx.cmd # print original command on failure
else:
ctx.ret_code = int(ctx.ret_code)
if ctx.ret_code:
ctx.cmd = cmd_ctx.cmd # print original command on failure
log_task_job_activity(ctx, suite, itask.point, itask.tdef.name)
log_lvl = INFO
log_msg = 'killed'
if ctx.ret_code: # non-zero exit status
log_lvl = WARNING
log_msg = 'kill failed'
itask.state.kill_failed = True
elif itask.state.status == TASK_STATUS_SUBMITTED:
self.task_events_mgr.process_message(
itask, CRITICAL, self.task_events_mgr.EVENT_SUBMIT_FAILED,
ctx.timestamp)
elif itask.state.status == TASK_STATUS_RUNNING:
self.task_events_mgr.process_message(
itask, CRITICAL, TASK_OUTPUT_FAILED)
else:
log_lvl = DEBUG
log_msg = (
'ignoring job kill result, unexpected task state: %s' %
itask.state.status)
itask.set_summary_message(log_msg)
LOG.log(log_lvl, "[%s] -job(%02d) %s" % (
itask.identity, itask.submit_num, log_msg))
示例2: upgrade
# 需要导入模块: from cylc.flow import LOG [as 别名]
# 或者: from cylc.flow.LOG import log [as 别名]
def upgrade(self):
warnings = OrderedDict()
for vn, upgs in self.upgrades.items():
for u in upgs:
try:
exp = self.expand(u)
except (KeyError, UpgradeError):
continue
for upg in exp:
try:
old = self.get_item(upg['old'])
except KeyError:
# OK: deprecated item not found
pass
else:
msg = self.show_keys(upg['old'])
if upg['new']:
msg += ' -> ' + self.show_keys(upg['new'])
else:
upg['new'] = upg['old']
msg += " - " + upg['cvt'].describe()
if not upg['silent']:
warnings.setdefault(vn, [])
warnings[vn].append(msg)
self.del_item(upg['old'])
if upg['cvt'].describe() != "DELETED (OBSOLETE)":
self.put_item(upg['new'], upg['cvt'].convert(old))
if warnings:
level = WARNING
if self.descr == self.SITE_CONFIG:
# Site level configuration, user cannot easily fix.
# Only log at debug level.
level = DEBUG
else:
# User level configuration, user should be able to fix.
# Log at warning level.
level = WARNING
LOG.log(
level,
"deprecated items were automatically upgraded in '%s':",
self.descr)
for vn, msgs in warnings.items():
for msg in msgs:
LOG.log(level, ' * (%s) %s', vn, msg)