diff --git a/jhub_apps/__about__.py b/jhub_apps/__about__.py index b414021a..a1839622 100644 --- a/jhub_apps/__about__.py +++ b/jhub_apps/__about__.py @@ -1 +1 @@ -__version__ = "2024.4.1rc7" +__version__ = "2024.4.1rc8" diff --git a/jhub_apps/service/models.py b/jhub_apps/service/models.py index 2a91a3c7..cd4efdf5 100644 --- a/jhub_apps/service/models.py +++ b/jhub_apps/service/models.py @@ -63,6 +63,9 @@ class UserOptions(BaseModel): profile: typing.Optional[str] = str() # Make app available to public (unauthenticated Hub users) public: typing.Optional[bool] = False + # Keep app alive, even when there is no activity + # So that it's not killed by idle culler + keep_alive: typing.Optional[bool] = False class ServerCreation(BaseModel): diff --git a/jhub_apps/spawner/command.py b/jhub_apps/spawner/command.py index 283a5bc6..bd7a2700 100644 --- a/jhub_apps/spawner/command.py +++ b/jhub_apps/spawner/command.py @@ -55,7 +55,6 @@ def get_substituted_args(self, **kwargs): "-m", "jhsingle_native_proxy.main", TString("--authtype=$authtype"), - "--no-force-alive", ] ) diff --git a/jhub_apps/spawner/spawner_creation.py b/jhub_apps/spawner/spawner_creation.py index 0c01ec73..eff9b686 100644 --- a/jhub_apps/spawner/spawner_creation.py +++ b/jhub_apps/spawner/spawner_creation.py @@ -102,6 +102,17 @@ async def start(self): python_exec=self.config.JAppsConfig.python_exec, authtype=auth_type, ) + # Only for non-JupyterLab apps + if self.user_options.get("keep_alive"): + logger.info( + "Flag set to force keep alive, will not be deleted by idle culler", + app=self.user_options.get("display_name"), + framework=self.user_options.get("framework") + ) + self.cmd.append("--force-alive") + else: + self.cmd.append("--no-force-alive") + if framework == Framework.jupyterlab.value: self.cmd = [ self.config.JAppsConfig.python_exec,