Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(result logs): Use three logging levels #2723

Merged
merged 6 commits into from
Sep 9, 2020

Conversation

tpilewicz
Copy link
Contributor

resolves #2680

Description

I've added an argument logger_fn to the function print_fancy_output_line of module printer.py, that determines the logging level used to print logs. Then I've used it accordingly where the function is called. Also, I've modified the function get_printable_result from this module to determine a logger_fn from model / seed / snapshot results.

I have not added tests because this module was not tested, and I don't really know how to test logging functions yet. Tell me if you think it is better to add some.

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt next" section.

@cla-bot cla-bot bot added the cla:yes label Aug 24, 2020
@jtcohen6
Copy link
Contributor

jtcohen6 commented Sep 1, 2020

Thanks for this contribution, @tpilewicz!

I'm going to hold off on merging this into the dev/marian-anderson branch, as we're currently in release-candidate phase and will be releasing v0.18.0 very soon.

This is a good change; what's less clear to me is whether it'd be a breaking change for users who deploy dbt via orchestration tools, such as Airflow, that have native behavior corresponding to log levels. Should we wait to merge this until the next minor version (0.19), or would it be okay to include in a patch release? @beckjake I'd be curious to hear your thoughts here.

@beckjake
Copy link
Contributor

beckjake commented Sep 1, 2020

Well, first of all, does this actually have any significant change in log level, in the sense of "an error was logged"? I assume that's what airflow looks at.

This adds an error log if there is an ERROR SKIP (if this doesn't log an error already, that seems like a bug!) or if the run is canceled with SIGINT. I think I'm fine with it if this change happens to break someone's airflow environment by causing those two cases to fail when they previously didn't. It does the same for warning on warn results, which seems similarly fine.

I think saying that log levels can only be changed in minor/major revs is a really inconvenient precedent to set. Where does it end? Can we rev dependencies? Change print output? Change error handling?

Copy link
Contributor

@beckjake beckjake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me! When we figure out the merge situation and get this pointed at appropriate branch, I will ask you to add yourself+this PR to a new Contributors section for that release.

@jtcohen6
Copy link
Contributor

jtcohen6 commented Sep 1, 2020

I think saying that log levels can only be changed in minor/major revs is a really inconvenient precedent to set. Where does it end? Can we rev dependencies? Change print output? Change error handling?

Cool, let's pull this into v0.18.1.

@tpilewicz
Copy link
Contributor Author

Great, thanks for your review guys 😄

@jtcohen6 jtcohen6 changed the base branch from dev/marian-anderson to dev/0.18.1 September 4, 2020 19:28
Copy link
Contributor

@jtcohen6 jtcohen6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks + works great! Thanks for the contribution @tpilewicz

CHANGELOG.md Outdated
@@ -30,6 +30,7 @@
- Macros in the current project can override internal dbt macros that are called through `execute_macros`. ([#2301](https://github.com/fishtown-analytics/dbt/issues/2301), [#2686](https://github.com/fishtown-analytics/dbt/pull/2686))
- Add state:modified and state:new selectors ([#2641](https://github.com/fishtown-analytics/dbt/issues/2641), [#2695](https://github.com/fishtown-analytics/dbt/pull/2695))
- Add two new flags `--use-colors` and `--no-use-colors` to `dbt run` command to enable or disable log colorization from the command line ([#2708](https://github.com/fishtown-analytics/dbt/pull/2708))
- Specify all three logging levels (`INFO`, `WARNING`, `ERROR`) in result logs for commands `test`, `seed`, `run`, `snapshot` and `source snapshot-freshness`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Specify all three logging levels (`INFO`, `WARNING`, `ERROR`) in result logs for commands `test`, `seed`, `run`, `snapshot` and `source snapshot-freshness`
- Specify all three logging levels (`INFO`, `WARNING`, `ERROR`) in result logs for commands `test`, `seed`, `run`, `snapshot` and `source snapshot-freshness` ([#2680](https://github.com/fishtown-analytics/dbt/pull/2680), [#2723](https://github.com/fishtown-analytics/dbt/pull/2723))

Could you:

  • merge changelog conflicts
  • move this entry to v0.18.1
  • create a Contributors section
  • add yourself!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FreshnessStatus.Error causes exit status of 1 but no error level logging.
3 participants