本文整理汇总了Python中dbt.logger.GLOBAL_LOGGER.error方法的典型用法代码示例。如果您正苦于以下问题:Python GLOBAL_LOGGER.error方法的具体用法?Python GLOBAL_LOGGER.error怎么用?Python GLOBAL_LOGGER.error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dbt.logger.GLOBAL_LOGGER
的用法示例。
在下文中一共展示了GLOBAL_LOGGER.error方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_cli_vars
# 需要导入模块: from dbt.logger import GLOBAL_LOGGER [as 别名]
# 或者: from dbt.logger.GLOBAL_LOGGER import error [as 别名]
def parse_cli_vars(var_string):
try:
cli_vars = yaml_helper.load_yaml_text(var_string)
var_type = type(cli_vars)
if var_type == dict:
return cli_vars
else:
type_name = var_type.__name__
dbt.exceptions.raise_compiler_error(
"The --vars argument must be a YAML dictionary, but was "
"of type '{}'".format(type_name))
except dbt.exceptions.ValidationException as e:
logger.error(
"The YAML provided in the --vars argument is not valid.\n")
raise
示例2: safe_run
# 需要导入模块: from dbt.logger import GLOBAL_LOGGER [as 别名]
# 或者: from dbt.logger.GLOBAL_LOGGER import error [as 别名]
def safe_run(self, manifest):
catchable_errors = (CompilationException, RuntimeException)
# result = self.DefaultResult(self.node)
started = time.time()
timing = []
error = None
node = self.node
result = None
try:
with collect_timing_info('compile') as timing_info:
# if we fail here, we still have a compiled node to return
# this has the benefit of showing a build path for the errant
# model
node = self.compile(manifest)
timing.append(timing_info)
# for ephemeral nodes, we only want to compile, not run
if not node.is_ephemeral_model:
with collect_timing_info('execute') as timing_info:
result = self.run(node, manifest)
node = result.node
timing.append(timing_info)
# result.extend(item.serialize() for item in timing)
except catchable_errors as e:
if e.node is None:
e.node = node
error = dbt.compat.to_string(e)
except InternalException as e:
build_path = self.node.build_path
prefix = 'Internal error executing {}'.format(build_path)
error = "{prefix}\n{error}\n\n{note}".format(
prefix=dbt.ui.printer.red(prefix),
error=str(e).strip(),
note=INTERNAL_ERROR_STRING)
logger.debug(error)
error = dbt.compat.to_string(e)
except Exception as e:
node_description = self.node.get('build_path')
if node_description is None:
node_description = self.node.unique_id
prefix = "Unhandled error while executing {description}".format(
description=node_description)
error = "{prefix}\n{error}".format(
prefix=dbt.ui.printer.red(prefix),
error=str(e).strip())
logger.error(error)
logger.debug('', exc_info=True)
error = dbt.compat.to_string(e)
finally:
exc_str = self._safe_release_connection()
# if releasing failed and the result doesn't have an error yet, set
# an error
if exc_str is not None and result.error is None:
error = exc_str
if error is not None:
# we could include compile time for runtime errors here
result = self.error_result(node, error, started, [])
elif result is not None:
result = self.from_run_result(result, started, timing)
else:
result = self.ephemeral_result(node, started, timing)
return result