Skip to content

Commit 1f73b15

Browse files
committed
Make the launch_timeout_pad be flow for consitency with other timeouts defined in this file
1 parent 96faf7c commit 1f73b15

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

jupyter_server/gateway/gateway_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ def gateway_retry_max_default(self):
343343

344344
launch_timeout_pad_default_value = 2
345345
launch_timeout_pad_env = "JUPYTER_GATEWAY_LAUNCH_TIMEOUT_PAD"
346-
launch_timeout_pad = Int(
346+
launch_timeout_pad = Float(
347347
default_value=launch_timeout_pad_default_value,
348348
config=True,
349349
help="""Timeout pad to be ensured between KERNEL_LAUNCH_TIMEOUT and request_timeout
@@ -353,7 +353,7 @@ def gateway_retry_max_default(self):
353353

354354
@default("launch_timeout_pad")
355355
def launch_timeout_pad_default(self):
356-
return int(
356+
return float(
357357
os.environ.get(
358358
"JUPYTER_GATEWAY_LAUNCH_TIMEOUT_PAD",
359359
self.launch_timeout_pad_default_value,
@@ -382,7 +382,7 @@ def init_static_args(self):
382382
self.request_timeout = minimum_request_timeout
383383
elif self.request_timeout > minimum_request_timeout:
384384
GatewayClient.KERNEL_LAUNCH_TIMEOUT = (
385-
int(self.request_timeout) - self.launch_timeout_pad
385+
int(self.request_timeout - self.launch_timeout_pad)
386386
)
387387
# Ensure any adjustments are reflected in env.
388388
os.environ["KERNEL_LAUNCH_TIMEOUT"] = str(GatewayClient.KERNEL_LAUNCH_TIMEOUT)

tests/test_gateway.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def init_gateway(monkeypatch):
186186
monkeypatch.setenv("JUPYTER_GATEWAY_HTTP_USER", mock_http_user)
187187
monkeypatch.setenv("JUPYTER_GATEWAY_REQUEST_TIMEOUT", "44.4")
188188
monkeypatch.setenv("JUPYTER_GATEWAY_CONNECT_TIMEOUT", "44.4")
189-
monkeypatch.setenv("JUPYTER_GATEWAY_LAUNCH_TIMEOUT_PAD", "1")
189+
monkeypatch.setenv("JUPYTER_GATEWAY_LAUNCH_TIMEOUT_PAD", "1.1")
190190
yield
191191
GatewayClient.clear_instance()
192192

@@ -199,7 +199,7 @@ async def test_gateway_env_options(init_gateway, jp_serverapp):
199199
jp_serverapp.gateway_config.connect_timeout == jp_serverapp.gateway_config.request_timeout
200200
)
201201
assert jp_serverapp.gateway_config.connect_timeout == 44.4
202-
assert jp_serverapp.gateway_config.launch_timeout_pad == 1
202+
assert jp_serverapp.gateway_config.launch_timeout_pad == 1.1
203203

204204
GatewayClient.instance().init_static_args()
205205
assert GatewayClient.instance().KERNEL_LAUNCH_TIMEOUT == 43
@@ -211,7 +211,7 @@ async def test_gateway_cli_options(jp_configurable_serverapp):
211211
"--GatewayClient.http_user=" + mock_http_user,
212212
"--GatewayClient.connect_timeout=44.4",
213213
"--GatewayClient.request_timeout=96.0",
214-
"--GatewayClient.launch_timeout_pad=6",
214+
"--GatewayClient.launch_timeout_pad=5.1",
215215
]
216216

217217
GatewayClient.clear_instance()
@@ -222,7 +222,7 @@ async def test_gateway_cli_options(jp_configurable_serverapp):
222222
assert app.gateway_config.http_user == mock_http_user
223223
assert app.gateway_config.connect_timeout == 44.4
224224
assert app.gateway_config.request_timeout == 96.0
225-
assert app.gateway_config.launch_timeout_pad == 6
225+
assert app.gateway_config.launch_timeout_pad == 5.1
226226
GatewayClient.instance().init_static_args()
227227
assert (
228228
GatewayClient.instance().KERNEL_LAUNCH_TIMEOUT == 90

0 commit comments

Comments
 (0)