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

Bokeh's log level set on import affects Panel/Bokeh apps #8750

Open
maximlt opened this issue Jul 4, 2024 · 2 comments
Open

Bokeh's log level set on import affects Panel/Bokeh apps #8750

maximlt opened this issue Jul 4, 2024 · 2 comments

Comments

@maximlt
Copy link

maximlt commented Jul 4, 2024

Describe the issue:

Panel is a Python dashboarding framework that builds on and extends Bokeh. We have observed (holoviz/panel#2302) that importing distributed in a Panel application affects the logs emitted by Bokeh.

The issue is that on import distributed configures some loggers, including Bokeh's logger that is set to the ERROR level, while it's by default at the INFO level.

initialize_logging(dask.config.config)

loggers: dict[str, str | int] = { # default values
"distributed": "info",
"distributed.client": "warning",
"bokeh": "error",
"tornado": "critical",
"tornado.application": "error",

I would say that setting Bokeh's logger should not be done on import but only when the Dask dashboard is launched.

Minimal Complete Verifiable Example:

Install panel, launch this app with panel serve app.py and visit it at http://localhost:5006.

# app.py
import distributed
import panel as pn

pn.panel("Hello world!").servable()

You will get these logs printed in the console:

2024-07-04 15:19:44,133 Starting Bokeh server version 3.5.0rc1 (running on Tornado 6.4)
2024-07-04 15:19:44,135 User authentication hooks NOT provided (default user enabled)
2024-07-04 15:19:44,137 Bokeh app running at: http://localhost:5006/app
2024-07-04 15:19:44,137 Starting Bokeh server with process id: 75848

However, you should get these logs (comment out import distributed), with two additional lines.

2024-07-04 15:19:10,793 Starting Bokeh server version 3.5.0rc1 (running on Tornado 6.4)
2024-07-04 15:19:10,808 User authentication hooks NOT provided (default user enabled)
2024-07-04 15:19:10,810 Bokeh app running at: http://localhost:5006/app
2024-07-04 15:19:10,810 Starting Bokeh server with process id: 75753
2024-07-04 15:19:12,419 WebSocket connection opened
2024-07-04 15:19:12,419 ServerConnection created

Anything else we need to know?:

There's been some discussion already on this topic in 2019 when the bokeh log level set by distributed was decreased from CRITICAL to ERROR.

#1683
#3087

Environment:

  • Dask version: 2024.6.2
  • Python version: 3.12
  • Operating System: MacOS
  • Install method (conda, pip, source): conda
@fjetter
Copy link
Member

fjetter commented Jul 4, 2024

With #8634 this will be a little less severe since we're delaying the initialization of logging until we actually need it but once we do it may still be global

@maximlt
Copy link
Author

maximlt commented Jul 4, 2024

Cool I didn't see this PR, it's definitely going in the right direction :) Thanks for working on that!

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

No branches or pull requests

2 participants