Skip to content

Commit

Permalink
fix printer output
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Wigley committed Dec 15, 2020
1 parent 37af0e0 commit b60e533
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
7 changes: 5 additions & 2 deletions core/dbt/task/freshness.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from dbt.contracts.results import (
FreshnessExecutionResultArtifact,
FreshnessResult, NodeStatus, PartialSourceFreshnessResult,
FreshnessResult, PartialSourceFreshnessResult,
SourceFreshnessResult, FreshnessStatus
)
from dbt.exceptions import RuntimeException, InternalException
Expand Down Expand Up @@ -167,7 +167,10 @@ def get_result(self, results, elapsed_time, generated_at):

def task_end_messages(self, results):
for result in results:
if result.status == NodeStatus.Error:
if result.status in (
FreshnessStatus.Error,
FreshnessStatus.RuntimeErr
):
print_run_result_error(result)

print_timestamped_line('Done.')
15 changes: 10 additions & 5 deletions core/dbt/task/printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def get_printable_result(
result, success: str, error: str) -> Tuple[str, str, Callable]:
if result.status == NodeStatus.Error:
info = 'ERROR {}'.format(error)
status = ui.red(result.message)
status = ui.red(result.status.upper())
logger_fn = logger.error
else:
info = 'OK {}'.format(success)
Expand Down Expand Up @@ -292,12 +292,13 @@ def print_run_result_error(
result.node.original_file_path))

try:
int(result.status)
# if message is int, must be rows returned for a test
int(result.message)
except ValueError:
logger.error(" Status: {}".format(result.status))
else:
status = utils.pluralize(result.status, 'result')
logger.error(" Got {}, expected 0.".format(status))
num_rows = utils.pluralize(result.message, 'result')
logger.error(" Got {}, expected 0.".format(num_rows))

if result.node.build_path is not None:
with TextOnly():
Expand Down Expand Up @@ -348,7 +349,11 @@ def print_end_of_run_summary(
def print_run_end_messages(results, keyboard_interrupt: bool = False) -> None:
errors, warnings = [], []
for r in results:
if r.status in (NodeStatus.Error, NodeStatus.Fail):
if r.status in (
NodeStatus.RuntimeErr,
NodeStatus.Error,
NodeStatus.Fail
):
errors.append(r)
elif r.status == NodeStatus.Skipped and r.message is not None:
# this means we skipped a node because of an issue upstream,
Expand Down

0 comments on commit b60e533

Please sign in to comment.