jupyter / nb2kg

Other
73 stars 31 forks source link

Automatically increase KG_REQUEST_TIMEOUT if less than KERNEL_LAUNCH_TIMEOUT #36

Closed kevin-bates closed 5 years ago

kevin-bates commented 5 years ago

KG_REQUEST_TIMEOUT is used by the HTTP request to set an expiration for the request to complete. KERNEL_LAUNCH_TIMEOUT is used by EG to set an expiration for the kernel's launch to complete. If KG_REQUEST_TIMEOUT is less that KERNEL_LAUNCH_TIMEOUT, then you can get into a situation where the request times out prior to the completion of the kernel's launch. In such cases, the kernel could be orphaned because the launch eventually succeeds, yet there's no way for the client to use (and shutdown) the kernel.

In cases where KG_REQUEST_TIMEOUT is less than KERNEL_LAUNCH_TIMEOUT (plus some small addition), we should automatically increase its value to KERNEL_LAUNCH_TIMEOUT (plus some small addition). I think two seconds is a reasonable value for the plus some small addition portion. So let's say that KG_REQUEST_TIMEOUT would need to be at least KERNEL_LAUNCH_TIMEOUT + 2.

Note that there's no default value for KERNEL_LAUNCH_TIMEOUT (the EG server will provide one if the client request does not), while the default for KG_REQUEST_TIMEOUT was recently increased to 60. As a result, it might be good to provide a default value of, say, 30 seconds.