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

Logger Widget 2 (based on #2700) #2867

Closed
wants to merge 17 commits into from

Conversation

atharva-2001
Copy link
Member

📝 Description

Type: 🪲 bugfix | 🚀 feature | ☣️ breaking change | 🚦 testing | 📝 documentation | 🎢 infrastructure

Refactors #2700

📌 Resources

Examples, notebooks, and links to useful references.

🚦 Testing

How did you test these changes?

  • Testing pipeline
  • Other method (describe)
  • My changes can't be tested (explain why)

☑️ Checklist

  • I requested two reviewers for this pull request
  • I updated the documentation according to my changes
  • I built the documentation by applying the build_docs label

Note: If you are not allowed to perform any of these actions, ping (@) a contributor.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@tardis-bot
Copy link
Contributor

tardis-bot commented Oct 28, 2024

*beep* *bop*
Hi human,
I ran ruff on the latest commit (603d146).
Here are the outputs produced.
Results can also be downloaded as artifacts here.
Summarised output:

29	W293  	[*] Blank line contains whitespace
8	G004  	[ ] Logging statement uses f-string
8	W291  	[*] Trailing whitespace
7	E902  	[ ] No such file or directory (os error 2)
3	FA102 	[*] Missing `from __future__ import annotations`, but uses PEP 585 collection
2	E701  	[ ] Multiple statements on one line (colon)
2	E999  	[ ] SyntaxError: Expected an expression
2	W605  	[*] Invalid escape sequence: `\A`
1	RET505	[ ] Unnecessary `else` after `return` statement
1	RET506	[ ] Unnecessary `else` after `raise` statement
1	I001  	[*] Import block is un-sorted or un-formatted
1	W292  	[*] No newline at end of file
1	D204  	[*] 1 blank line required after class docstring
1	F401  	[*] `IPython.display.display` imported but unused
1	TRY300	[ ] Consider moving this statement to an `else` block

Complete output(might be large):

.github/workflows/codestyle.yml:7:4: E999 SyntaxError: Expected an expression
.github/workflows/codestyle.yml:21:8: W291 [*] Trailing whitespace
.github/workflows/codestyle.yml:25:11: E701 Multiple statements on one line (colon)
.github/workflows/codestyle.yml:30:11: E701 Multiple statements on one line (colon)
.github/workflows/codestyle.yml:38:1: W293 [*] Blank line contains whitespace
.github/workflows/codestyle.yml:40:15: W291 [*] Trailing whitespace
.github/workflows/codestyle.yml:44:1: W293 [*] Blank line contains whitespace
.github/workflows/codestyle.yml:53:1: W293 [*] Blank line contains whitespace
.github/workflows/codestyle.yml:57:1: W293 [*] Blank line contains whitespace
.github/workflows/codestyle.yml:65:1: W293 [*] Blank line contains whitespace
.github/workflows/codestyle.yml:77:26: W291 [*] Trailing whitespace
.github/workflows/codestyle.yml:81:1: W293 [*] Blank line contains whitespace
.github/workflows/codestyle.yml:89:1: W293 [*] Blank line contains whitespace
.github/workflows/codestyle.yml:100:22: W291 [*] Trailing whitespace
.github/workflows/codestyle.yml:101:89: W291 [*] Trailing whitespace
.github/workflows/codestyle.yml:103:84: W291 [*] Trailing whitespace
.github/workflows/codestyle.yml:119:1: W293 [*] Blank line contains whitespace
.github/workflows/codestyle.yml:123:1: W293 [*] Blank line contains whitespace
.mailmap:1:38: E999 SyntaxError: Expected an expression
docs/quickstart.ipynb:cell 12:1:39: W291 [*] Trailing whitespace
docs/quickstart.ipynb:cell 12:5:35: W291 [*] Trailing whitespace
docs/quickstart.ipynb:cell 16:10:26: W605 [*] Invalid escape sequence: `\A`
docs/quickstart.ipynb:cell 16:11:40: W605 [*] Invalid escape sequence: `\A`
docs/workflows/simple_workflow.ipynb:1:1: E902 No such file or directory (os error 2)
docs/workflows/standard_workflow.ipynb:1:1: E902 No such file or directory (os error 2)
tardis/io/logger/colored_logger.py:1:1: E902 No such file or directory (os error 2)
tardis/io/logger/logger.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/logger/logger.py:9:13: FA102 Missing `from __future__ import annotations`, but uses PEP 585 collection
tardis/io/logger/logger.py:18:13: FA102 Missing `from __future__ import annotations`, but uses PEP 585 collection
tardis/io/logger/logger.py:18:18: FA102 Missing `from __future__ import annotations`, but uses PEP 604 union
tardis/io/logger/logger.py:26:1: W293 [*] Blank line contains whitespace
tardis/io/logger/logger.py:43:1: W293 [*] Blank line contains whitespace
tardis/io/logger/logger.py:56:1: W293 [*] Blank line contains whitespace
tardis/io/logger/logger.py:67:21: G004 Logging statement uses f-string
tardis/io/logger/logger.py:112:1: W293 [*] Blank line contains whitespace
tardis/io/logger/logger.py:115:1: W293 [*] Blank line contains whitespace
tardis/io/logger/logger.py:120:1: W293 [*] Blank line contains whitespace
tardis/io/logger/logger.py:125:1: W293 [*] Blank line contains whitespace
tardis/io/logger/logger.py:128:1: W293 [*] Blank line contains whitespace
tardis/io/logger/logger.py:140:1: W293 [*] Blank line contains whitespace
tardis/io/logger/logger.py:143:1: W293 [*] Blank line contains whitespace
tardis/io/logger/logger.py:151:1: W293 [*] Blank line contains whitespace
tardis/io/logger/logger.py:157:1: W293 [*] Blank line contains whitespace
tardis/io/logger/logger.py:159:1: W293 [*] Blank line contains whitespace
tardis/io/logger/logger.py:165:1: W293 [*] Blank line contains whitespace
tardis/io/logger/logger.py:169:1: W293 [*] Blank line contains whitespace
tardis/io/logger/logger.py:175:1: W293 [*] Blank line contains whitespace
tardis/io/logger/logger.py:179:1: W293 [*] Blank line contains whitespace
tardis/io/logger/logger.py:186:1: W293 [*] Blank line contains whitespace
tardis/io/logger/logger.py:191:1: W293 [*] Blank line contains whitespace
tardis/io/logger/logger.py:198:5: D204 [*] 1 blank line required after class docstring
tardis/io/logger/logger.py:201:1: W293 [*] Blank line contains whitespace
tardis/io/logger/logger.py:209:34: W292 [*] No newline at end of file
tardis/simulation/base.py:8:29: F401 [*] `IPython.display.display` imported but unused
tardis/simulation/base.py:197:13: RET506 Unnecessary `else` after `raise` statement
tardis/simulation/base.py:261:17: G004 Logging statement uses f-string
tardis/simulation/base.py:268:9: RET505 Unnecessary `else` after `return` statement
tardis/simulation/base.py:449:13: G004 Logging statement uses f-string
tardis/simulation/base.py:547:13: G004 Logging statement uses f-string
tardis/simulation/base.py:636:21: G004 Logging statement uses f-string
tardis/simulation/base.py:639:13: G004 Logging statement uses f-string
tardis/simulation/base.py:644:13: G004 Logging statement uses f-string
tardis/simulation/base.py:695:13: TRY300 Consider moving this statement to an `else` block
tardis/simulation/base.py:697:26: G004 Logging statement uses f-string
tardis/workflows/__init__.py:1:1: E902 No such file or directory (os error 2)
tardis/workflows/simple_tardis_workflow.py:1:1: E902 No such file or directory (os error 2)
tardis/workflows/standard_tardis_workflow.py:1:1: E902 No such file or directory (os error 2)
tardis/workflows/workflow_logging.py:1:1: E902 No such file or directory (os error 2)
Found 68 errors.
[*] 43 fixable with the `--fix` option (3 hidden fixes can be enabled with the `--unsafe-fixes` option).

Copy link

codecov bot commented Oct 28, 2024

Codecov Report

Attention: Patch coverage is 88.18182% with 13 lines in your changes missing coverage. Please review.

Project coverage is 69.68%. Comparing base (6e5ae60) to head (603d146).
Report is 11 commits behind head on master.

Files with missing lines Patch % Lines
tardis/io/logger/logger.py 87.50% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2867      +/-   ##
==========================================
- Coverage   71.09%   69.68%   -1.42%     
==========================================
  Files         213      215       +2     
  Lines       15824    16080     +256     
==========================================
- Hits        11250    11205      -45     
- Misses       4574     4875     +301     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@atharva-2001 atharva-2001 marked this pull request as ready for review October 28, 2024 13:57
print(
"log_level is defined both in Functional Argument & YAML Configuration {debug section}"
)
print(
Copy link
Contributor

@jvshields jvshields Oct 28, 2024

Choose a reason for hiding this comment

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

Slightly odd for this to be two print statements. Also, even though this refers to the logger, I would still think this would be a logging statement and not a print message. Maybe just at Debug level so that it always displays.

@andrewfullard
Copy link
Contributor

andrewfullard commented Oct 28, 2024

  1. Make ALL tab display first
  2. Make ALL tab scrollable

docstr-cov seems to fail too, though I do see plenty of docstrings.

@tardis-bot
Copy link
Contributor

*beep* *bop*
Hi human,
I ran benchmarks as you asked comparing master (6e5ae60) and the latest commit (670d373).
Here are the logs produced by ASV.
Results can also be downloaded as artifacts here.

Significantly changed benchmarks:

All benchmarks:

Benchmarks that have stayed the same:

| Change   | Before [6e5ae60d] <master>   | After [670d3738]    | Ratio   | Benchmark (Parameter)                                                                                                               |
|----------|------------------------------|---------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------|
|          | 41.3±20μs                    | 50.1±20μs           | ~1.21   | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_emission                                         |
|          | 541±200ns                    | 611±100ns           | ~1.13   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation                              |
|          | 601±100ns                    | 541±100ns           | ~0.90   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation                                |
|          | 3.36±0.6μs                   | 2.45±0.3μs          | ~0.73   | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_bad_vpacket                                       |
|          | 2.47±0ms                     | 2.50±0ms            | 1.01    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('scatter')                                     |
|          | 39.5±0s                      | 39.8±0.04s          | 1.01    | run_tardis.BenchmarkRunTardis.time_run_tardis                                                                                       |
|          | 3.37±0.01ms                  | 3.35±0ms            | 1.00    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('macroatom')                                   |
|          | 1.05±0m                      | 1.05±0m             | 1.00    | run_tardis.BenchmarkRunTardis.time_run_tardis_rpacket_tracking                                                                      |
|          | 2.06±0m                      | 2.06±0m             | 1.00    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_FormalIntegrator_functions                                 |
|          | 1.66±0.01ms                  | 1.65±0ms            | 1.00    | transport_montecarlo_main_loop.BenchmarkTransportMontecarloMontecarloMainLoop.time_montecarlo_main_loop                             |
|          | 30.9±0.01μs                  | 31.1±0.04μs         | 1.00    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list                  |
|          | 62.5±0.4ms                   | 61.6±0.04ms         | 0.99    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_rpacket_trackers_to_dataframe                  |
|          | 3.01±0.5μs                   | 2.99±0.6μs          | 0.99    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_within_shell                              |
|          | 208±0.02ns                   | 203±0.1ns           | 0.98    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_intensity_black_body                                       |
|          | 1.21±0μs                     | 1.19±0μs            | 0.98    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_boundary                |
|          | 1.35±0.4μs                   | 1.32±0.3μs          | 0.98    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line                    |
|          | 2.38±0.4ms                   | 2.32±0.4ms          | 0.98    | transport_montecarlo_single_packet_loop.BenchmarkTransportMontecarloSinglePacketLoop.time_single_packet_loop                        |
|          | 6.05±0.6μs                   | 5.96±0.7μs          | 0.98    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket                                           |
|          | 42.1±20μs                    | 41.0±20μs           | 0.97    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter                                          |
|          | 1.97±1μs                     | 1.88±0.9μs          | 0.96    | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators       |
|          | 571±100ns                    | 541±100ns           | 0.95    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation                                      |
|          | 760±0.6ns                    | 725±0.5ns           | 0.95    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_thomson_scatter                                       |
|          | 20.6±5μs                     | 19.5±4μs            | 0.95    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list |
|          | 7.54±1μs                     | 6.87±1μs            | 0.91    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley                                    |

If you want to see the graph of the results, you can check it here

@atharva-2001 atharva-2001 marked this pull request as draft November 4, 2024 11:55
@atharva-2001
Copy link
Member Author

Closing since working on a Panel implementation in #2872

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants