当前位置: 首页>>代码示例>>Python>>正文


Python GLOBAL_LOGGER.error方法代码示例

本文整理汇总了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
开发者ID:analyst-collective,项目名称:dbt,代码行数:17,代码来源:utils.py

示例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
开发者ID:analyst-collective,项目名称:dbt,代码行数:79,代码来源:node_runners.py


注:本文中的dbt.logger.GLOBAL_LOGGER.error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。