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

Log refactoring #39

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft

Log refactoring #39

wants to merge 12 commits into from

Conversation

burnout87
Copy link
Collaborator

Refactoring ongoing

@codecov
Copy link

codecov bot commented Mar 29, 2021

Codecov Report

Merging #39 (4b59ce3) into master (8e979a1) will increase coverage by 1.69%.
The diff coverage is 73.41%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #39      +/-   ##
==========================================
+ Coverage   57.78%   59.47%   +1.69%     
==========================================
  Files          33       33              
  Lines        4157     4163       +6     
==========================================
+ Hits         2402     2476      +74     
+ Misses       1755     1687      -68     
Impacted Files Coverage Δ
...plugins/dummy_instrument/data_server_dispatcher.py 87.32% <ø> (ø)
cdci_data_analysis/analysis/instrument.py 58.33% <44.44%> (+4.63%) ⬆️
cdci_data_analysis/flask_app/dispatcher_query.py 66.26% <76.19%> (+2.63%) ⬆️
cdci_data_analysis/analysis/queries.py 57.77% <85.71%> (+4.24%) ⬆️
cdci_data_analysis/analysis/parameters.py 64.69% <0.00%> (+0.51%) ⬆️
cdci_data_analysis/flask_app/app.py 63.02% <0.00%> (+0.84%) ⬆️
cdci_data_analysis/analysis/products.py 44.18% <0.00%> (+2.13%) ⬆️

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 8e979a1...4b59ce3. Read the comment docs.

@burnout87
Copy link
Collaborator Author

burnout87 commented Mar 29, 2021

@volodymyrss Remember if this TODO was discussed at some point in time?

# TODO
# decide if it is worth to add the logger also in this case
#self.set_scratch_dir(self.par_dic['session_id'], verbose=verbose)
#self.set_session_logger(self.scratch_dir, verbose=verbose, config=config)
# self.set_sentry_client()

I think some log might still be useful, but perhaps without the scratch_dir

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Mar 29, 2021

This pull request introduces 2 alerts when merging 37a0eb8 into 2f47456 - view on LGTM.com

new alerts:

  • 2 for Wrong number of arguments in a call

@volodymyrss
Copy link
Member

@volodymyrss Remember if this TODO was discussed at some point in time?

# TODO
# decide if it is worth to add the logger also in this case
#self.set_scratch_dir(self.par_dic['session_id'], verbose=verbose)
#self.set_session_logger(self.scratch_dir, verbose=verbose, config=config)
# self.set_sentry_client()

I think some log might still be useful, but perhaps without the scratch_dir

I think it would be still good to store log in the individual scratch directory of the job. It allows to inspect the job for each request easily near data. In some cases it is still useful.
Except now it did not work, and caused some issues, I do not remember, perhaps with overcreation of loggers.

jdata=c.json()

assert c.status_code == 200

Copy link
Member

Choose a reason for hiding this comment

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

can we add a test to check if log was created? because the problem was that it was not, that's why it was commented, I think

Copy link
Collaborator Author

@burnout87 burnout87 Mar 31, 2021

Choose a reason for hiding this comment

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

It was crashing mainly because the job_id was not set for that specific case, and when trying to create the folder it would not find that job_id.

I will add the check

Copy link
Member

Choose a reason for hiding this comment

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

and also that it does not create a new logger for each request. That's what was happening at some points too.
I find it is convenient to inspect loggers with logging_tree, but simply logging would do too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am trying to use logging_tree to inspect the log, but I am struggling a bt, what do you think of verifying that the log file is actually created? Will this be enugh for us?

Copy link
Member

Choose a reason for hiding this comment

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

it will be necessary but not sufficient, since it will not catch an problem which happened in the wild. but it might be unclear what I am trying to explain with the logging, so let me maybe to that part myself.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Apr 28, 2021

This pull request introduces 2 alerts and fixes 6 when merging e78527a into e71a9cd - view on LGTM.com

new alerts:

  • 1 for Unused local variable
  • 1 for Syntax error

fixed alerts:

  • 4 for Module is imported more than once
  • 1 for Unused import
  • 1 for Module is imported with 'import' and 'import from'

@volodymyrss
Copy link
Member

I would not necessarily deal with this for 21.05

@volodymyrss
Copy link
Member

I just merged master and better coverage testing to see how far it is, and it is not too close anymore. Perhaps it's too much effort right now. I hope no merges were destructive.

@burnout87
Copy link
Collaborator Author

I just merged master and better coverage testing to see how far it is, and it is not too close anymore. Perhaps it's too much effort right now. I hope no merges were destructive.

Thanks! It is not necessary at the moment. So it can be labelled as an enhancement and we can deal with that at a later stage after the release.

@burnout87 burnout87 added the enhancement New feature or request label Apr 28, 2021
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Apr 29, 2021

This pull request introduces 1 alert and fixes 1 when merging 4b59ce3 into 8e979a1 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

fixed alerts:

  • 1 for Unused local variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactoring
Projects
None yet
2 participants