當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。