File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
jupyter_server/services/kernelspecs Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -51,13 +51,15 @@ def _cache_enabled_default(self):
51
51
52
52
kernel_spec_manager = Instance ("jupyter_client.kernelspec.KernelSpecManager" )
53
53
54
+ monitor_name_env = "JUPYTER_KERNELSPEC_MONITOR_NAME"
54
55
monitor_name = Unicode (
55
- help = """The name of the entry_point used to monitor changes to kernelspecs.""" ,
56
+ help = """The name of the entry_point used to monitor changes to kernelspecs.
57
+ (JUPYTER_KERNELSPEC_MONITOR_NAME env var)""" ,
56
58
).tag (config = True )
57
59
58
60
@default ("monitor_name" )
59
61
def _monitor_name_default (self ):
60
- return "polling-monitor"
62
+ return os . getenv ( self . monitor_name_env , "polling-monitor" )
61
63
62
64
# The kernelspec cache consists of a dictionary mapping the kernel name to the actual
63
65
# kernelspec data (CacheItemType).
Original file line number Diff line number Diff line change 1
1
"""KernelSpec watchdog monitor used by KernelspecCache."""
2
2
# Copyright (c) Jupyter Development Team.
3
3
# Distributed under the terms of the Modified BSD License.
4
-
5
4
import json
5
+ import os
6
6
from hashlib import md5
7
7
8
8
from overrides import overrides
9
- from traitlets .traitlets import Float
9
+ from traitlets .traitlets import Float , default
10
10
11
11
from ..kernelspec_cache import KernelSpecCache , KernelSpecMonitorBase
12
12
13
13
14
14
class KernelSpecPollingMonitor (KernelSpecMonitorBase ):
15
15
"""Polling monitor that uses a periodic poll period to reload the kernelspec cache."""
16
16
17
+ interval_env = "JUPYTER_POLLING_MONITOR_INTERVAL"
17
18
interval = Float (
18
- default_value = 30.0 ,
19
19
config = True ,
20
- help = """The interval (in seconds) at which kernelspecs are updated in the cache.""" ,
20
+ help = """The interval (in seconds) at which kernelspecs are updated in the cache.
21
+ (JUPYTER_POLLING_MONITOR_INTERVAL env var)""" ,
21
22
)
22
23
24
+ @default ("interval" )
25
+ def _interval_default (self ):
26
+ return float (os .getenv (self .interval_env , "30.0" ))
27
+
23
28
_pcallback = None
24
29
25
30
# Keep track of hash values for each entry placed into the cache. This will lessen
You can’t perform that action at this time.
0 commit comments