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

Adding a logger widget for logging in run_tardis #2700

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

Conversation

DeekshaMohanty
Copy link

@DeekshaMohanty DeekshaMohanty commented Jul 12, 2024

📝 Description

Fixes #2701

Type: 🚀 feature

  • Added an output ipyidget with tabs to logger.py
  • Removed colored_logger.py

🚦 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.

@tardis-bot
Copy link
Contributor

tardis-bot commented Jul 12, 2024

*beep* *bop*

Hi, human.

The docs workflow has failed

Click here to see the build log.

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

*beep* *bop*

Hi, human.

I'm the @tardis-bot and couldn't find your records in my database. I think we don't know each other, or you changed your credentials recently.

Please add your name and email to .mailmap in your current branch and push the changes to this pull request.

In case you need to map an existing alias, follow this example.

@tardis-bot
Copy link
Contributor

*beep* *bop*

Hi, human.

I'm the @tardis-bot and couldn't find your records in my database. I think we don't know each other, or you changed your credentials recently.

Please add your name and email to .mailmap in your current branch and push the changes to this pull request.

In case you need to map an existing alias, follow this example.

@tardis-bot
Copy link
Contributor

*beep* *bop*

Hi, human.

I'm the @tardis-bot and couldn't find your records in my database. I think we don't know each other, or you changed your credentials recently.

Please add your name and email to .mailmap in your current branch and push the changes to this pull request.

In case you need to map an existing alias, follow this example.

@tardis-bot
Copy link
Contributor

*beep* *bop*

Hi, human.

I'm the @tardis-bot and couldn't find your records in my database. I think we don't know each other, or you changed your credentials recently.

Please add your name and email to .mailmap in your current branch and push the changes to this pull request.

In case you need to map an existing alias, follow this example.

@tardis-bot
Copy link
Contributor

*beep* *bop*

Hi, human.

I'm the @tardis-bot and couldn't find your records in my database. I think we don't know each other, or you changed your credentials recently.

Please add your name and email to .mailmap in your current branch and push the changes to this pull request.

In case you need to map an existing alias, follow this example.

@wkerzendorf
Copy link
Member

@DeekshaMohanty can you please fix the .mailmap problem.

@tardis-bot
Copy link
Contributor

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

Complete output(might be large):

@DeekshaMohanty DeekshaMohanty marked this pull request as ready for review July 28, 2024 23:04
@DeekshaMohanty DeekshaMohanty marked this pull request as draft July 28, 2024 23:06
@DeekshaMohanty
Copy link
Author

DeekshaMohanty commented Jul 28, 2024

Points 6 and 7 for the issue linked to this PR need some further discussion. #2701

Copy link

codecov bot commented Jul 29, 2024

Codecov Report

Attention: Patch coverage is 89.04110% with 8 lines in your changes missing coverage. Please review.

Project coverage is 69.32%. Comparing base (f8f664c) to head (ef2b439).
Report is 38 commits behind head on master.

Files Patch % Lines
tardis/io/logger/logger.py 89.04% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2700      +/-   ##
==========================================
- Coverage   69.68%   69.32%   -0.36%     
==========================================
  Files         181      190       +9     
  Lines       14469    15016     +547     
==========================================
+ Hits        10082    10410     +328     
- Misses       4387     4606     +219     

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

Copy link
Member

@jaladh-singhal jaladh-singhal left a comment

Choose a reason for hiding this comment

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

This is a great addition @DeekshaMohanty - thanks for taking initiative on this!

I've left some comments, please address them when you get a chance. We need to make sure that we address all the points in #2701

@@ -116,7 +116,7 @@
"sim = run_tardis(\"tardis_example.yml\", \n",
" virtual_packet_logging=True,\n",
" show_convergence_plots=True,\n",
" export_convergence_plots=True,\n",
" export_convergence_plots=False, #TODO: to avoid double plots\n",
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we need to replace this parameter with a new parameter (maybe called export_static_output) which can show convergence plots and logger-widget (or atleast a fixed height html text area) for static HTML documentation website.

And setting this param to True should be controllable by identifying if the notebook execution is being done by nbsphinx/nbconvert - there should be some setting to detect that but needs research.


logging_level = (
log_level if log_level else tardis_config["debug"]["log_level"]
tardis_config["debug"].get("specific_log_level", specific_log_level)
Copy link
Member

Choose a reason for hiding this comment

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

good cleanup!

Comment on lines +79 to +82
"WARNING/ERROR": Output(layout=Layout(height='300px', overflow_y='auto')),
"INFO": Output(layout=Layout(height='300px', overflow_y='auto')),
"DEBUG": Output(layout=Layout(height='300px', overflow_y='auto')),
"ALL": Output(layout=Layout(height='300px', overflow_y='auto'))
Copy link
Member

Choose a reason for hiding this comment

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

you can define a function that returns a Output widget and call for each of the keys, instead of repeating code.

tab.set_title(2, "DEBUG")
tab.set_title(3, "ALL")

display(tab)
Copy link
Member

Choose a reason for hiding this comment

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

do we really need to do it global level? shouldn't display be inside some function/class that gets called/instantiated?

If not, maybe move it together with other global level code at L184

elif record.levelno == logging.DEBUG:
color = 'blue'
else:
color = 'black'
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 cleaner if colors come from a dictionary, instead of defining here

@@ -517,7 +517,7 @@ def log_plasma_state(
plasma_state_log["next_w"] = next_dilution_factor
plasma_state_log.columns.name = "Shell No."

if is_notebook():
if False and is_notebook(): #TODO: remove it with something better
Copy link
Member

Choose a reason for hiding this comment

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

I think we can simply remove the if block since we are controlling display now

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.

Add logger widget for run_tardis():
4 participants