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

Set logger levels through handler #209

Merged
merged 5 commits into from
Jan 18, 2024
Merged

Set logger levels through handler #209

merged 5 commits into from
Jan 18, 2024

Conversation

lukaspie
Copy link
Collaborator

Configures logging with a handler. If you only configure a level for your logger, but no handlers, the internal handler is used which is set to output just the message (with no other formatting) at the WARNING level (see this reference). Currently, this prevents the printing of INFO level loggings to the console (including when using the generate-template flag).

Fixes #208.

@lukaspie lukaspie linked an issue Jan 17, 2024 that may be closed by this pull request
@coveralls
Copy link

coveralls commented Jan 17, 2024

Pull Request Test Coverage Report for Build 7559203886

  • 18 of 18 (100.0%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 44.535%

Totals Coverage Status
Change from base Build 7531218463: -0.02%
Covered Lines: 4861
Relevant Lines: 10915

💛 - Coveralls

@sherjeelshabih
Copy link
Collaborator

@lukaspie @domna I could test running the converter locally and everything works fine for me.

I couldn't find any outputs in the Nomad GUI both before and after these changes. And I also couldn't find any call from Nomad to the dataconverter with a logger being passed.

@domna
Copy link
Collaborator

domna commented Jan 17, 2024

@lukaspie @domna I could test running the converter locally and everything works fine for me.

I couldn't find any outputs in the Nomad GUI both before and after these changes. And I also couldn't find any call from Nomad to the dataconverter with a logger being passed.

Here is the comment from Rubel where he reports that this works in nomad: #191 (comment)
However, it looks like he just tested this locally and we still need to pass the logger to the convert function in nomad. @sherjeelshabih Did you also try to pass it to convert in nomad and see if it is then logged in the gui?

@sherjeelshabih
Copy link
Collaborator

@lukaspie @domna I could test running the converter locally and everything works fine for me.
I couldn't find any outputs in the Nomad GUI both before and after these changes. And I also couldn't find any call from Nomad to the dataconverter with a logger being passed.

Here is the comment from Rubel where he reports that this works in nomad: #191 (comment) However, it looks like he just tested this locally and we still need to pass the logger to the convert function in nomad. @sherjeelshabih Did you also try to pass it to convert in nomad and see if it is then logged in the gui?

I changed the way Nomad deals with this. I do not want to have a hot potato being passed around in function arguments. 😄

I just access the logging object of pynxtool during runtime from Nomad and switch it to what Nomad needs it to work. This way we don't have to change much in our code or add a special check if we are running under Nomad etc.

See this MR on Nomad: https://gitlab.mpcdf.mpg.de/nomad-lab/nomad-FAIR/-/merge_requests/1638
Let me know what you think.

@domna
Copy link
Collaborator

domna commented Jan 17, 2024

@lukaspie @domna I could test running the converter locally and everything works fine for me.
I couldn't find any outputs in the Nomad GUI both before and after these changes. And I also couldn't find any call from Nomad to the dataconverter with a logger being passed.

Here is the comment from Rubel where he reports that this works in nomad: #191 (comment) However, it looks like he just tested this locally and we still need to pass the logger to the convert function in nomad. @sherjeelshabih Did you also try to pass it to convert in nomad and see if it is then logged in the gui?

I changed the way Nomad deals with this. I do not want to have a hot potato being passed around in function arguments. 😄

I just access the logging object of pynxtool during runtime from Nomad and switch it to what Nomad needs it to work. This way we don't have to change much in our code or add a special check if we are running under Nomad etc.

See this MR on Nomad: https://gitlab.mpcdf.mpg.de/nomad-lab/nomad-FAIR/-/merge_requests/1638 Let me know what you think.

That's perfect 👍️

This PR looks also good, I think it just needs some more replacements of the pynxtools logger import. But from my view this should be good to go then.

Copy link
Collaborator

@domna domna left a comment

Choose a reason for hiding this comment

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

LGTM, except one small question whether we need to set the streamhandler manually (but there is probably a good reason).

pynxtools/dataconverter/convert.py Show resolved Hide resolved
@lukaspie
Copy link
Collaborator Author

LGTM, feel free to merge anytime you guys are happy with it.

@lukaspie lukaspie merged commit ba03f57 into master Jan 18, 2024
5 checks passed
@lukaspie lukaspie deleted the 208-logger-level branch January 18, 2024 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dataconverter does not correctly pick up --generate template flag
4 participants