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

Use COBalD log channels for logging in TARDIS #146

Merged
merged 9 commits into from
Jun 3, 2020

Conversation

giffels
Copy link
Member

@giffels giffels commented Apr 28, 2020

This pull request introduces logging channels as suggested in COBalDs documentation and #137 correspondingly. This will improve the user's ability to filter log messages according their needs.

@giffels giffels force-pushed the add-log-channels branch 2 times, most recently from fc81414 to 59b157a Compare May 13, 2020 14:29
@giffels giffels marked this pull request as ready for review May 13, 2020 14:29
@giffels giffels changed the title WIP: Use COBalD log channels for logging in TARDIS Use COBalD log channels for logging in TARDIS May 13, 2020
@giffels giffels added the Improvement Code Improvements label May 13, 2020
@giffels giffels requested review from a team, rcaspart, eileen-kuehn and maxfischer2781 and removed request for a team May 13, 2020 14:41
@eileen-kuehn
Copy link
Member

Oh that is great! I am really looking forward on how practical this is going to be. If it is as good as expected, we should also go for it in other projects! :)

Copy link
Member

@eileen-kuehn eileen-kuehn left a comment

Choose a reason for hiding this comment

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

Many log levels did change during this PR. Some also from debug to warning. It might be helpful to introduce a helping information for maintainers on what actually the reasoning for selecting proper levels is.

Comment on lines 142 to 143
logger.info(f"Draining failed with: {str(cef)}")
logger.info(
Copy link
Member

Choose a reason for hiding this comment

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

Why is the log level changed from debug to info?

Comment on lines 101 to 104
logging.info("Quota exceeded")
logging.debug(str(ce))
logger.warning("Quota exceeded")
logger.warning(str(ce))
Copy link
Member

Choose a reason for hiding this comment

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

Here are also interesting changes of log level, info -> warning and debug -> warning. Especially the jump from debug to warning is interesting. As this is actually not two warnings, we might think about joining the strings?

@giffels giffels force-pushed the add-log-channels branch from 59b157a to ec41685 Compare May 14, 2020 11:30
@giffels
Copy link
Member Author

giffels commented May 15, 2020

Many log levels did change during this PR. Some also from debug to warning. It might be helpful to introduce a helping information for maintainers on what actually the reasoning for selecting proper levels is.

Yes, many log levels did change since there was no convention on this. :-/

@maxfischer2781 has proposed something in #137.

  • Log Levels: We have the standard Python log levels. IMO these should be:

    • CRITICAL: COBalD or TARDIS can't go on anymore and shuts down
    • ERROR: Basically unused.
    • WARNING: Recoverable errors. Dropped connections, timeouts, the like. Default for monitoring health when you know things generally work.
    • INFO: High-level description of what goes on. Default for monitoring behaviour when you want to understand why things happen.
    • DEBUG: Low-level/Implementation details. If things go wrong and you want to report them.

I would suggest to add this to the COBalDdocumentation. @maxfischer2781, would do you think about this?

@maxfischer2781
Copy link
Member

Yes, adding the log level convention as well would be helpful.

@giffels
Copy link
Member Author

giffels commented May 15, 2020

Yes, adding the log level convention as well would be helpful.

Thanks for opening an issue.

@giffels giffels linked an issue May 15, 2020 that may be closed by this pull request
@giffels giffels added this to the 0.4.0 - Release milestone May 15, 2020
@giffels giffels requested a review from eileen-kuehn May 15, 2020 14:42
@giffels
Copy link
Member Author

giffels commented May 22, 2020

Hi @rcaspart, @eileen-kuehn, @maxfischer2781,

this pull request needs two reviews. ;-)

Thanks,
Manuel

maxfischer2781
maxfischer2781 previously approved these changes May 22, 2020
Copy link
Member

@maxfischer2781 maxfischer2781 left a comment

Choose a reason for hiding this comment

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

Log channels and levels look okay to me. Thanks for cleaning this up.

Copy link
Member

@rcaspart rcaspart left a comment

Choose a reason for hiding this comment

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

thanks a lot for the introduction of the log channels and cleaning up of the log levels.
I have a few minor suggestions related to consistent usage of assertLogs in the unittests. Can you please have a look at them?

tests/utilities_t/test_asynccachemap.py Outdated Show resolved Hide resolved
tests/utilities_t/test_asynccachemap.py Outdated Show resolved Hide resolved
tests/adapters_t/batchsystems_t/test_htcondor.py Outdated Show resolved Hide resolved
tests/adapters_t/batchsystems_t/test_htcondor.py Outdated Show resolved Hide resolved
tests/adapters_t/batchsystems_t/test_htcondor.py Outdated Show resolved Hide resolved
Co-authored-by: Rene Caspart <rene.caspart@cern.ch>
@codecov-commenter
Copy link

codecov-commenter commented May 25, 2020

Codecov Report

Merging #146 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #146   +/-   ##
=======================================
  Coverage   99.07%   99.08%           
=======================================
  Files          40       40           
  Lines        1520     1524    +4     
=======================================
+ Hits         1506     1510    +4     
  Misses         14       14           
Impacted Files Coverage Δ
tardis/adapters/batchsystems/htcondor.py 100.00% <100.00%> (ø)
tardis/adapters/sites/cloudstack.py 100.00% <100.00%> (ø)
tardis/adapters/sites/htcondor.py 100.00% <100.00%> (ø)
tardis/adapters/sites/moab.py 100.00% <100.00%> (ø)
tardis/adapters/sites/openstack.py 100.00% <100.00%> (ø)
tardis/adapters/sites/slurm.py 100.00% <100.00%> (ø)
tardis/plugins/prometheusmonitoring.py 100.00% <100.00%> (ø)
tardis/plugins/sqliteregistry.py 100.00% <100.00%> (ø)
tardis/plugins/telegrafmonitoring.py 100.00% <100.00%> (ø)
tardis/resources/drone.py 100.00% <100.00%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ad7a8e5...4e6cd21. Read the comment docs.

@giffels
Copy link
Member Author

giffels commented May 25, 2020

thanks a lot for the introduction of the log channels and cleaning up of the log levels.
I have a few minor suggestions related to consistent usage of assertLogs in the unittests. Can you please have a look at them?

Thanks for your suggestions, I have applied them to the code.

Copy link
Member

@rcaspart rcaspart left a comment

Choose a reason for hiding this comment

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

Thanks, looks good to go 👍

Copy link
Member

@maxfischer2781 maxfischer2781 left a comment

Choose a reason for hiding this comment

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

Whoops, sorry for the delay. Go for it!

Copy link
Member

@eileen-kuehn eileen-kuehn left a comment

Choose a reason for hiding this comment

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

Go for it! 👍

@giffels giffels merged commit 068ad68 into MatterMiners:master Jun 3, 2020
@giffels giffels deleted the add-log-channels branch June 3, 2020 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Code Improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC] Log levels in COBalD / TARDIS
5 participants