本文整理汇总了Python中dbt.logger.GLOBAL_LOGGER.info方法的典型用法代码示例。如果您正苦于以下问题:Python GLOBAL_LOGGER.info方法的具体用法?Python GLOBAL_LOGGER.info怎么用?Python GLOBAL_LOGGER.info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dbt.logger.GLOBAL_LOGGER
的用法示例。
在下文中一共展示了GLOBAL_LOGGER.info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from dbt.logger import GLOBAL_LOGGER [as 别名]
# 或者: from dbt.logger.GLOBAL_LOGGER import info [as 别名]
def open(cls, connection):
if connection.state == 'open':
logger.debug('Connection is already open, skipping open.')
return connection
try:
handle = cls.get_bigquery_client(connection.credentials)
except google.auth.exceptions.DefaultCredentialsError as e:
logger.info("Please log into GCP to continue")
dbt.clients.gcloud.setup_default_credentials()
handle = cls.get_bigquery_client(connection.credentials)
except Exception as e:
raise
logger.debug("Got an error when attempting to create a bigquery "
"client: '{}'".format(e))
connection.handle = None
connection.state = 'fail'
raise dbt.exceptions.FailedToConnectException(str(e))
connection.handle = handle
connection.state = 'open'
return connection
示例2: run_dbt_and_check
# 需要导入模块: from dbt.logger import GLOBAL_LOGGER [as 别名]
# 或者: from dbt.logger.GLOBAL_LOGGER import info [as 别名]
def run_dbt_and_check(self, args=None):
if args is None:
args = ["run"]
args = ["--strict"] + args
logger.info("Invoking dbt with {}".format(args))
return dbt.handle_and_check(args)
示例3: find_schema_yml
# 需要导入模块: from dbt.logger import GLOBAL_LOGGER [as 别名]
# 或者: from dbt.logger.GLOBAL_LOGGER import info [as 别名]
def find_schema_yml(cls, package_name, root_dir, relative_dirs):
"""This is common to both v1 and v2 - look through the relative_dirs
under root_dir for .yml files yield pairs of filepath and loaded yaml
contents.
"""
extension = "[!.#~]*.yml"
file_matches = dbt.clients.system.find_matching(
root_dir,
relative_dirs,
extension)
for file_match in file_matches:
file_contents = dbt.clients.system.load_file_contents(
file_match.get('absolute_path'), strip=False)
test_path = file_match.get('relative_path', '')
original_file_path = os.path.join(file_match.get('searched_path'),
test_path)
try:
test_yml = dbt.clients.yaml_helper.load_yaml_text(
file_contents
)
except dbt.exceptions.ValidationException as e:
test_yml = None
logger.info("Error reading {}:{} - Skipping\n{}".format(
package_name, test_path, e))
if test_yml is None:
continue
yield original_file_path, test_yml
示例4: path_info
# 需要导入模块: from dbt.logger import GLOBAL_LOGGER [as 别名]
# 或者: from dbt.logger.GLOBAL_LOGGER import info [as 别名]
def path_info(self):
open_cmd = dbt.clients.system.open_dir_cmd()
message = PROFILE_DIR_MESSAGE.format(
open_cmd=open_cmd,
profiles_dir=self.profiles_dir
)
logger.info(message)
示例5: print_end_of_run_summary
# 需要导入模块: from dbt.logger import GLOBAL_LOGGER [as 别名]
# 或者: from dbt.logger.GLOBAL_LOGGER import info [as 别名]
def print_end_of_run_summary(num_errors, early_exit=False):
if early_exit:
message = yellow('Exited because of keyboard interrupt.')
elif num_errors > 0:
message = red('Completed with {} errors:'.format(num_errors))
else:
message = green('Completed successfully')
logger.info('')
logger.info('{}'.format(message))
示例6: run_dbt
# 需要导入模块: from dbt.logger import GLOBAL_LOGGER [as 别名]
# 或者: from dbt.logger.GLOBAL_LOGGER import info [as 别名]
def run_dbt(self, args=None, expect_pass=True, strict=True):
if args is None:
args = ["run"]
if strict:
args = ["--strict"] + args
args.append('--log-cache-events')
logger.info("Invoking dbt with {}".format(args))
res, success = dbt.handle_and_check(args)
self.assertEqual(
success, expect_pass,
"dbt exit state did not match expected")
return res
示例7: print_run_status_line
# 需要导入模块: from dbt.logger import GLOBAL_LOGGER [as 别名]
# 或者: from dbt.logger.GLOBAL_LOGGER import info [as 别名]
def print_run_status_line(results):
stats = {
'error': 0,
'skip': 0,
'pass': 0,
'total': 0,
}
for r in results:
result_type = interpret_run_result(r)
stats[result_type] += 1
stats['total'] += 1
stats_line = "\nDone. PASS={pass} ERROR={error} SKIP={skip} TOTAL={total}"
logger.info(stats_line.format(**stats))
示例8: print_compile_stats
# 需要导入模块: from dbt.logger import GLOBAL_LOGGER [as 别名]
# 或者: from dbt.logger.GLOBAL_LOGGER import info [as 别名]
def print_compile_stats(stats):
names = {
NodeType.Model: 'models',
NodeType.Test: 'tests',
NodeType.Archive: 'archives',
NodeType.Analysis: 'analyses',
NodeType.Macro: 'macros',
NodeType.Operation: 'operations',
NodeType.Seed: 'seed files',
NodeType.Source: 'sources',
}
results = {k: 0 for k in names.keys()}
results.update(stats)
stat_line = ", ".join(
["{} {}".format(ct, names.get(t)) for t, ct in results.items()])
logger.info("Found {}".format(stat_line))
示例9: show_table
# 需要导入模块: from dbt.logger import GLOBAL_LOGGER [as 别名]
# 或者: from dbt.logger.GLOBAL_LOGGER import info [as 别名]
def show_table(self, result):
table = result.node.agate_table
rand_table = table.order_by(lambda x: random.random())
schema = result.node.schema
alias = result.node.alias
header = "Random sample of table: {}.{}".format(schema, alias)
logger.info("")
logger.info(header)
logger.info("-" * len(header))
rand_table.print_table(max_rows=10, max_columns=None)
logger.info("")
示例10: run
# 需要导入模块: from dbt.logger import GLOBAL_LOGGER [as 别名]
# 或者: from dbt.logger.GLOBAL_LOGGER import info [as 别名]
def run(self):
project_dir = self.args.project_name
profiles_dir = dbt.config.PROFILES_DIR
profiles_file = os.path.join(profiles_dir, 'profiles.yml')
self.create_profiles_dir(profiles_dir)
self.create_profiles_file(profiles_file)
msg = "Creating dbt configuration folder at {}"
logger.info(msg.format(profiles_dir))
if os.path.exists(project_dir):
raise RuntimeError("directory {} already exists!".format(
project_dir
))
self.clone_starter_repo(project_dir)
addendum = self.get_addendum(project_dir, profiles_dir)
logger.info(addendum)
示例11: run
# 需要导入模块: from dbt.logger import GLOBAL_LOGGER [as 别名]
# 或者: from dbt.logger.GLOBAL_LOGGER import info [as 别名]
def run(self):
os.chdir(self.config.target_path)
port = self.args.port
shutil.copyfile(DOCS_INDEX_FILE_PATH, 'index.html')
logger.info("Serving docs at 0.0.0.0:{}".format(port))
logger.info(
"To access from your browser, navigate to http://localhost:{}."
.format(port)
)
logger.info("Press Ctrl+C to exit.\n\n")
httpd = TCPServer(
('0.0.0.0', port),
SimpleHTTPRequestHandler
)
try:
webbrowser.open_new_tab('http://127.0.0.1:{}'.format(port))
except webbrowser.Error as e:
pass
try:
httpd.serve_forever() # blocks
finally:
httpd.shutdown()
httpd.server_close()
return None
示例12: get_nodes_from_spec
# 需要导入模块: from dbt.logger import GLOBAL_LOGGER [as 别名]
# 或者: from dbt.logger.GLOBAL_LOGGER import info [as 别名]
def get_nodes_from_spec(self, graph, spec):
filter_map = {
SELECTOR_FILTERS.FQN: self.get_nodes_by_qualified_name,
SELECTOR_FILTERS.TAG: self.get_nodes_by_tag,
SELECTOR_FILTERS.SOURCE: self.get_nodes_by_source,
}
filter_method = filter_map.get(spec.selector_type)
if filter_method is None:
valid_selectors = ", ".join(filter_map.keys())
logger.info("The '{}' selector specified in {} is invalid. Must "
"be one of [{}]".format(
spec.selector_type,
spec.raw,
valid_selectors))
return set()
collected = set(filter_method(graph, spec.selector_value))
collected.update(self.collect_models(graph, collected, spec))
collected.update(self.collect_tests(graph, collected))
return collected
示例13: run
# 需要导入模块: from dbt.logger import GLOBAL_LOGGER [as 别名]
# 或者: from dbt.logger.GLOBAL_LOGGER import info [as 别名]
def run(self):
"""
Run dbt for the query, based on the graph.
"""
self._runtime_initialize()
adapter = get_adapter(self.config)
if len(self._flattened_nodes) == 0:
logger.info("WARNING: Nothing to do. Try checking your model "
"configs and model specification args")
return []
else:
logger.info("")
selected_uids = frozenset(n.unique_id for n in self._flattened_nodes)
try:
self.before_hooks(adapter)
started = time.time()
self.before_run(adapter, selected_uids)
res = self.execute_nodes()
self.after_run(adapter, res)
elapsed = time.time() - started
self.after_hooks(adapter, res, elapsed)
finally:
adapter.cleanup_connections()
result = self.get_result(
results=res,
elapsed_time=elapsed,
generated_at=dbt.utils.timestring()
)
result.write(self.result_path())
self.task_end_messages(res)
return res
示例14: print_fancy_output_line
# 需要导入模块: from dbt.logger import GLOBAL_LOGGER [as 别名]
# 或者: from dbt.logger.GLOBAL_LOGGER import info [as 别名]
def print_fancy_output_line(msg, status, index, total, execution_time=None):
if index is None or total is None:
progress = ''
else:
progress = '{} of {} '.format(index, total)
prefix = "{timestamp} | {progress}{message}".format(
timestamp=get_timestamp(),
progress=progress,
message=msg)
justified = prefix.ljust(80, ".")
if execution_time is None:
status_time = ""
else:
status_time = " in {execution_time:0.2f}s".format(
execution_time=execution_time)
status_txt = status
output = "{justified} [{status}{status_time}]".format(
justified=justified, status=status_txt, status_time=status_time)
logger.info(output)
示例15: print_timestamped_line
# 需要导入模块: from dbt.logger import GLOBAL_LOGGER [as 别名]
# 或者: from dbt.logger.GLOBAL_LOGGER import info [as 别名]
def print_timestamped_line(msg, use_color=None):
if use_color is not None:
msg = color(msg, use_color)
logger.info("{} | {}".format(get_timestamp(), msg))