jupyter-server / gateway_provisioners

Provides remote kernel provisioners for various resource-managed clusters.
https://gateway-provisioners.readthedocs.io
Other
33 stars 15 forks source link

Make `_determine_next_host` an async function #102

Open divyansshhh opened 1 year ago

divyansshhh commented 1 year ago

Problem

We are creating a custom kernel provisioner and we have an API for finding a host based on certain parameters but this API takes upto 20s to send the host. This 20s wait blocks the server and makes lab unusable during those 20s. We tried making the _determine_next_host function async ourselves by running the host fetching API in a asyncio's run_in_executor and awaiting the _determine_next_host call in the launch_kernel function.

A simple reproducer for this is adding a asyncio.sleep(10) in the DistributedProvisioner._determine_next_host function. The result will be that the kernel never reaches an alive state.

Proposed Solution

We would like a way to asynchronously determine the next host.

Additional context

I'm using gateway_provisioners v0.2.0