Skip to content

Commit

Permalink
Make workers in fast api service configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
aktech committed Jan 9, 2024
1 parent 43a29ce commit 31e7b5e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion jhub_apps/config_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from traitlets import Unicode, Union, List, Callable
from traitlets import Unicode, Union, List, Callable, Integer
from traitlets.config import SingletonConfigurable, Enum


Expand Down Expand Up @@ -43,3 +43,8 @@ class JAppsConfig(SingletonConfigurable):
"127.0.0.1",
help="Hub Host name, in k8s environment it would be the container name, e.g. 'hub'",
).tag(config=True)

service_workers = Integer(
2,
help="The number of workers to create for the JHub Apps FastAPI service",
).tag(config=True)
4 changes: 4 additions & 0 deletions jhub_apps/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ def install_jhub_apps(c, spawner_to_subclass):
c.JAppsConfig.jupyterhub_config_path = (
JAppsConfig.jupyterhub_config_path.default_value
)
if not isinstance(c.JAppsConfig.service_workers, int):
c.JAppsConfig.service_workers = (
JAppsConfig.service_workers.default_value
)

if not isinstance(bind_url, str):
raise ValueError(f"c.JupyterHub.bind_url is not set: {c.JupyterHub.bind_url}")
Expand Down

0 comments on commit 31e7b5e

Please sign in to comment.