jwst icon indicating copy to clipboard operation
jwst copied to clipboard

Remove redundant level-setting, logs in Pipelines, use logging ancestry

Open tapastro opened this issue 4 years ago • 3 comments

Closes #[TBD] Resolves JP-TBD

Description

This PR addresses some hanging questions about logging implementation and utilizes the logging ancestry by defining the package logger in jwst/init.py - from here, loggers underneath jwst will inherit the level set there. Additionally, a few of the pipelines were using loggers set in calwebb_{pipeline}.py, when they have a log already defined when created as a sub-class of Pipeline with self.log.

I've tested this with a variety of calls with strun and pipelines/steps, using --verbose and without, and no features appear to have changed, but I could be missing something. I'd appreciate any suggestions on how this might have snuck a broken thing into the logging setup that I could have missed.

Checklist

  • [ ] Tests
  • [ ] Documentation
  • [ ] Change log
  • [x] Milestone
  • [x] Label(s)

tapastro avatar Oct 12 '21 15:10 tapastro

Codecov Report

Merging #6390 (c822b03) into master (e083b5e) will decrease coverage by 3.21%. The diff coverage is 42.30%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6390      +/-   ##
==========================================
- Coverage   77.73%   74.52%   -3.22%     
==========================================
  Files         408      408              
  Lines       34919    41397    +6478     
==========================================
+ Hits        27145    30851    +3706     
- Misses       7774    10546    +2772     
Flag Coverage Δ *Carryforward flag
nightly 77.73% <66.66%> (+<0.01%) :arrow_up: Carriedforward from b8f9c7d
unit 56.25% <16.66%> (+0.20%) :arrow_up:

*This pull request uses carry forward flags. Click here to find out more.

Impacted Files Coverage Δ
jwst/ami/ami_analyze.py 62.50% <ø> (-17.10%) :arrow_down:
jwst/ami/find_affine2d_parameters.py 67.50% <ø> (-28.66%) :arrow_down:
jwst/ami/instrument_data.py 68.68% <ø> (-20.05%) :arrow_down:
jwst/ami/utils.py 76.62% <ø> (-9.71%) :arrow_down:
jwst/assign_mtwcs/assign_mtwcs_step.py 80.76% <ø> (+2.99%) :arrow_up:
jwst/assign_mtwcs/moving_target_wcs.py 86.48% <ø> (-0.31%) :arrow_down:
jwst/assign_wcs/assign_wcs.py 84.05% <ø> (+4.42%) :arrow_up:
jwst/assign_wcs/assign_wcs_step.py 89.47% <ø> (+0.18%) :arrow_up:
jwst/assign_wcs/fgs.py 72.41% <ø> (-22.46%) :arrow_down:
jwst/assign_wcs/miri.py 87.56% <ø> (-2.40%) :arrow_down:
... and 194 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 f14978e...c822b03. Read the comment docs.

codecov[bot] avatar Oct 12 '21 16:10 codecov[bot]

Naive question, but why do the step modules need to import logging and call getLogger, but the pipeline modules don't?

hbushouse avatar Oct 22 '21 12:10 hbushouse

Naive question, but why do the step modules need to import logging and call getLogger, but the pipeline modules don't?

For logging inside of Steps and Pipelines, the Step class sets a self.log in Step.init to which we can route messages. For code inside a step directory but not enclosed within a Step, no logger is defined and so one has to be created.

I think there is a lot left to be done with logging - consider this PR as still a work in progress.

tapastro avatar Oct 22 '21 13:10 tapastro