|
4 | 4 | c = get_config() #noqa |
5 | 5 |
|
6 | 6 | # Fix websocket ping timeout warning |
| 7 | +# Set both to same value to avoid timeout > interval warning |
7 | 8 | c.ServerApp.websocket_ping_interval = 30 |
8 | 9 | c.ServerApp.websocket_ping_timeout = 30 |
9 | 10 |
|
|
14 | 15 | c.ServerApp.allow_origin = '*' |
15 | 16 | c.ServerApp.allow_credentials = True |
16 | 17 |
|
| 18 | +# Disable history manager to suppress Almond kernel history_request errors |
| 19 | +# Almond kernel doesn't support history operations, causing JSON decode errors |
| 20 | +c.HistoryManager.enabled = False |
| 21 | + |
| 22 | +# Disable notebook trust warnings in container environment |
| 23 | +# All notebooks are from trusted source (bootcamp materials) |
| 24 | +c.ServerApp.trust_xheaders = False |
| 25 | + |
17 | 26 | # Keep INFO level for essential startup messages (URL, port, etc) |
18 | 27 | # but suppress specific noisy loggers |
19 | 28 | c.ServerApp.log_level = 'INFO' |
|
23 | 32 | logging.getLogger('tornado.access').setLevel(logging.ERROR) |
24 | 33 | logging.getLogger('tornado.application').setLevel(logging.ERROR) |
25 | 34 |
|
| 35 | +# Suppress LabApp schema validation warnings |
| 36 | +logging.getLogger('LabApp').setLevel(logging.ERROR) |
| 37 | + |
26 | 38 | # Create a custom filter to suppress specific warning messages |
27 | | -class SuppressAuthWarning(logging.Filter): |
| 39 | +class SuppressWarnings(logging.Filter): |
28 | 40 | def filter(self, record): |
29 | | - return 'All authentication is disabled' not in record.getMessage() |
| 41 | + # Only filter WARNING level messages, not INFO |
| 42 | + if record.levelno != logging.WARNING: |
| 43 | + return True |
| 44 | + |
| 45 | + msg = record.getMessage() |
| 46 | + # Suppress specific warnings |
| 47 | + return not any([ |
| 48 | + 'All authentication is disabled' in msg, |
| 49 | + 'Clearing invalid/expired login cookie' in msg, |
| 50 | + 'is not trusted' in msg, |
| 51 | + 'Could not determine jupyterlab build status' in msg |
| 52 | + ]) |
30 | 53 |
|
31 | 54 | # Apply the filter to ServerApp logger |
32 | 55 | server_logger = logging.getLogger('ServerApp') |
33 | | -server_logger.addFilter(SuppressAuthWarning()) |
| 56 | +server_logger.addFilter(SuppressWarnings()) |
34 | 57 |
|
35 | 58 | # Hide system and build files from file browser |
36 | 59 | # Students only need to see notebook files (*.ipynb) |
|
0 commit comments